Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
kochetkov-av committed Feb 8, 2022
0 parents commit e9e5e80
Show file tree
Hide file tree
Showing 11 changed files with 145 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.idea
9 changes: 9 additions & 0 deletions blockbook.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"coin_name": "Regtest",
"coin_shortcut": "rBTC",
"coin_label": "Bitcoin Regtest",
"rpc_url": "http://bitcoin:18443",
"rpc_user": "btc",
"rpc_pass": "btc",
"message_queue_binding": "tcp://bitcoin-blockbook:48321"
}
9 changes: 9 additions & 0 deletions blockbook2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"coin_name": "Regtest",
"coin_shortcut": "rBTC",
"coin_label": "Bitcoin Regtest",
"rpc_url": "http://bitcoin2:18443",
"rpc_user": "btc",
"rpc_pass": "btc",
"message_queue_binding": "tcp://bitcoin-blockbook2:48321"
}
74 changes: 74 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
version: "3"

services:

bitcoin:
image: ruimarinho/bitcoin-core:alpine
ports:
- "18443:18443"
command:
-printtoconsole
-regtest
-rpcauth='btc:9cd88b070f00d57a0bdbfbcc31cb0008$$7d80d4fca52cfc293b2311933b8a9d83dbdbc773a228c6dcf0b34743d9efb146'
-fallbackfee=0.00001
-rpcallowip=0.0.0.0/0
-rpcbind=0.0.0.0

bitcoin2:
image: ruimarinho/bitcoin-core:alpine
ports:
- "28443:18443"
command:
-printtoconsole
-regtest
-rpcauth='btc:9cd88b070f00d57a0bdbfbcc31cb0008$$7d80d4fca52cfc293b2311933b8a9d83dbdbc773a228c6dcf0b34743d9efb146'
-fallbackfee=0.00001
-rpcallowip=0.0.0.0/0
-rpcbind=0.0.0.0

bitcoin-explorer:
image: getumbrel/btc-rpc-explorer:v3.1.1
ports:
- "3001:3002"
environment:
- BTCEXP_HOST=0.0.0.0
- BTCEXP_BITCOIND_HOST=bitcoin
- BTCEXP_BITCOIND_PORT=18443
- BTCEXP_BITCOIND_USER=btc
- BTCEXP_BITCOIND_PASS=btc
- BTCEXP_BITCOIND_RPC_TIMEOUT=5000
- BTCEXP_BASIC_AUTH_PASSWORD=btc


bitcoin-explorer2:
image: getumbrel/btc-rpc-explorer:v3.1.1
ports:
- "3002:3002"
environment:
- BTCEXP_HOST=0.0.0.0
- BTCEXP_BITCOIND_HOST=bitcoin2
- BTCEXP_BITCOIND_PORT=18443
- BTCEXP_BITCOIND_USER=btc
- BTCEXP_BITCOIND_PASS=btc
- BTCEXP_BITCOIND_RPC_TIMEOUT=5000
- BTCEXP_BASIC_AUTH_PASSWORD=btc

bitcoin-blockbook:
image: kochetkov/blockbook:dev
restart: always
depends_on:
- bitcoin
ports:
- "9130:9130"
volumes:
- ./blockbook.json:/opt/blockbook/blockchaincfg.json

bitcoin-blockbook2:
image: kochetkov/blockbook:dev
restart: always
depends_on:
- bitcoin
ports:
- "9131:9130"
volumes:
- ./blockbook2.json:/opt/blockbook/blockchaincfg.json
11 changes: 11 additions & 0 deletions step1.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Init 3 wallets, generate 2 addresses

curl -d '{"jsonrpc":"2.0","id":"1","method":"createwallet", "params": ["w1"]}' -u btc:btc localhost:18443
curl -d '{"jsonrpc":"2.0","id":"1","method":"createwallet", "params": ["w2"]}' -u btc:btc localhost:18443
curl -d '{"jsonrpc":"2.0","id":"1","method":"createwallet", "params": ["w3"]}' -u btc:btc localhost:28443

btc=$(curl -d '{"jsonrpc":"2.0","id":"1","method":"getnewaddress", "params": []}' -u btc:btc localhost:18443/wallet/w1 | jq .result)
btc2=$(curl -d '{"jsonrpc":"2.0","id":"1","method":"getnewaddress", "params": []}' -u btc:btc localhost:18443/wallet/w2 | jq .result)

echo "BTC mining: ${btc}"
echo "BTC second: ${btc2}"
3 changes: 3 additions & 0 deletions step2.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Create first 110 blocks

curl -d '{"jsonrpc":"2.0","id":"1","method":"generatetoaddress", "params":[110, "ADDRESS_HERE"]}' -u btc:btc localhost:18443/wallet/w1
3 changes: 3 additions & 0 deletions step3.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# sendtoaddress

curl -d '{"jsonrpc":"2.0","id":"1","method":"sendtoaddress", "params":["ADDRESS2_HERE", 0.123]}' -u btc:btc localhost:18443/wallet/w1
8 changes: 8 additions & 0 deletions step4.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# connect nodes and sync

curl -d '{"jsonrpc":"2.0","id":"1","method":"addnode", "params":["bitcoin:18444", "add"]}' -u btc:btc localhost:28443

curl -d '{"jsonrpc":"2.0","id":"1","method":"getaddednodeinfo", "params":[]}' -u btc:btc localhost:28443 | jq

curl -d '{"jsonrpc":"2.0","id":"1","method":"getpeerinfo", "params":[]}' -u btc:btc localhost:28443 | jq

15 changes: 15 additions & 0 deletions step5.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# disconnect and sendtoaddress (this will be forked in next steps)

curl -d '{"jsonrpc":"2.0","id":"1","method":"addnode", "params":["bitcoin:18444", "remove"]}' -u btc:btc localhost:28443

curl -d '{"jsonrpc":"2.0","id":"1","method":"getaddednodeinfo", "params":[]}' -u btc:btc localhost:28443 | jq

curl -d '{"jsonrpc":"2.0","id":"1","method":"disconnectnode", "params":["bitcoin:18444"]}' -u btc:btc localhost:28443

curl -d '{"jsonrpc":"2.0","id":"1","method":"getpeerinfo", "params":[]}' -u btc:btc localhost:28443 | jq

curl -d '{"jsonrpc":"2.0","id":"1","method":"sendtoaddress", "params":["ADDRESS2_HERE", 0.345]}' -u btc:btc localhost:18443/wallet/w1
curl -d '{"jsonrpc":"2.0","id":"1","method":"sendtoaddress", "params":["ADDRESS2_HERE", 0.245]}' -u btc:btc localhost:18443/wallet/w1
curl -d '{"jsonrpc":"2.0","id":"1","method":"sendtoaddress", "params":["ADDRESS2_HERE", 0.445]}' -u btc:btc localhost:18443/wallet/w1

curl -d '{"jsonrpc":"2.0","id":"1","method":"generatetoaddress", "params":[1, "ADDRESS_HERE"]}' -u btc:btc localhost:18443/wallet/w1
4 changes: 4 additions & 0 deletions step6.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# mine fork on node2

curl -d '{"jsonrpc":"2.0","id":"1","method":"generatetoaddress", "params":[10, "ADDRESS_HERE"]}' -u btc:btc localhost:28443/wallet/w1

8 changes: 8 additions & 0 deletions step7.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# and connect again

curl -d '{"jsonrpc":"2.0","id":"1","method":"addnode", "params":["bitcoin:18444", "add"]}' -u btc:btc localhost:28443

curl -d '{"jsonrpc":"2.0","id":"1","method":"getaddednodeinfo", "params":[]}' -u btc:btc localhost:28443 | jq

curl -d '{"jsonrpc":"2.0","id":"1","method":"getpeerinfo", "params":[]}' -u btc:btc localhost:28443 | jq

0 comments on commit e9e5e80

Please sign in to comment.