at master 2.2 kB view raw
1{ pkgs, ... }: 2{ 3 name = "bitcoind"; 4 meta = with pkgs.lib; { 5 maintainers = with maintainers; [ _1000101 ]; 6 }; 7 8 nodes.machine = 9 { ... }: 10 { 11 services.bitcoind."mainnet" = { 12 enable = true; 13 rpc = { 14 port = 8332; 15 users.rpc.passwordHMAC = "acc2374e5f9ba9e62a5204d3686616cf$53abdba5e67a9005be6a27ca03a93ce09e58854bc2b871523a0d239a72968033"; 16 users.rpc2.passwordHMAC = "1495e4a3ad108187576c68f7f9b5ddc5$accce0881c74aa01bb8960ff3bdbd39f607fd33178147679e055a4ac35f53225"; 17 }; 18 }; 19 20 environment.etc."test.blank".text = ""; 21 services.bitcoind."testnet" = { 22 enable = true; 23 configFile = "/etc/test.blank"; 24 testnet = true; 25 rpc = { 26 port = 18332; 27 }; 28 extraCmdlineOptions = [ 29 "-rpcuser=rpc" 30 "-rpcpassword=rpc" 31 "-rpcauth=rpc2:1495e4a3ad108187576c68f7f9b5ddc5$accce0881c74aa01bb8960ff3bdbd39f607fd33178147679e055a4ac35f53225" 32 ]; 33 }; 34 }; 35 36 testScript = '' 37 start_all() 38 39 machine.wait_for_unit("bitcoind-mainnet.service") 40 machine.wait_for_unit("bitcoind-testnet.service") 41 42 machine.wait_until_succeeds( 43 'curl --fail --user rpc:rpc --data-binary \'{"jsonrpc": "1.0", "id":"curltest", "method": "getblockchaininfo", "params": [] }\' -H \'content-type: text/plain;\' localhost:8332 | grep \'"chain":"main"\' ' 44 ) 45 machine.wait_until_succeeds( 46 'curl --fail --user rpc2:rpc2 --data-binary \'{"jsonrpc": "1.0", "id":"curltest", "method": "getblockchaininfo", "params": [] }\' -H \'content-type: text/plain;\' localhost:8332 | grep \'"chain":"main"\' ' 47 ) 48 machine.wait_until_succeeds( 49 'curl --fail --user rpc:rpc --data-binary \'{"jsonrpc": "1.0", "id":"curltest", "method": "getblockchaininfo", "params": [] }\' -H \'content-type: text/plain;\' localhost:18332 | grep \'"chain":"test"\' ' 50 ) 51 machine.wait_until_succeeds( 52 'curl --fail --user rpc2:rpc2 --data-binary \'{"jsonrpc": "1.0", "id":"curltest", "method": "getblockchaininfo", "params": [] }\' -H \'content-type: text/plain;\' localhost:18332 | grep \'"chain":"test"\' ' 53 ) 54 ''; 55}