1import ./make-test-python.nix ({ pkgs, ... }: {
2 name = "bitcoind";
3 meta = with pkgs.lib; {
4 maintainers = with maintainers; [ _1000101 ];
5 };
6
7 machine = { ... }: {
8 services.bitcoind."mainnet" = {
9 enable = true;
10 rpc = {
11 port = 8332;
12 users.rpc.passwordHMAC = "acc2374e5f9ba9e62a5204d3686616cf$53abdba5e67a9005be6a27ca03a93ce09e58854bc2b871523a0d239a72968033";
13 users.rpc2.passwordHMAC = "1495e4a3ad108187576c68f7f9b5ddc5$accce0881c74aa01bb8960ff3bdbd39f607fd33178147679e055a4ac35f53225";
14 };
15 };
16 services.bitcoind."testnet" = {
17 enable = true;
18 configFile = "/test.blank";
19 testnet = true;
20 rpc = {
21 port = 18332;
22 };
23 extraCmdlineOptions = [ "-rpcuser=rpc" "-rpcpassword=rpc" "-rpcauth=rpc2:1495e4a3ad108187576c68f7f9b5ddc5$accce0881c74aa01bb8960ff3bdbd39f607fd33178147679e055a4ac35f53225" ];
24 };
25 };
26
27 testScript = ''
28 start_all()
29
30 machine.wait_for_unit("bitcoind-mainnet.service")
31 machine.wait_for_unit("bitcoind-testnet.service")
32
33 machine.wait_until_succeeds(
34 '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"\' '
35 )
36 machine.wait_until_succeeds(
37 '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"\' '
38 )
39 machine.wait_until_succeeds(
40 '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"\' '
41 )
42 machine.wait_until_succeeds(
43 '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"\' '
44 )
45 '';
46})