Skip to content

Commit

Permalink
Merge pull request #12 from Samourai-Wallet/feat_mydojo_rpc_api2
Browse files Browse the repository at this point in the history
extend support of external apps
  • Loading branch information
kenshin-samourai authored Jun 18, 2019
2 parents 5d55db6 + a99e6b6 commit 3a560f6
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 23 deletions.
2 changes: 2 additions & 0 deletions doc/DOCKER_advanced_setups.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,10 @@ nano ./conf/docker-bitcoind.conf
```

With this setting, external applications running on your local machine should be able to access the following ports:
* 9500: bitcoind zmqpubhashtx notifications
* 9501: bitcoind zmqpubrawtx notifications
* 9502: bitcoind zmqpubhashblock notifications
* 9503: bitcoind zmqpubrawblock notifications
* 28256: bitcoind RPC API

Note: this option has no effect if your setup relies on a external full node (i.e. if BITCOIND_INSTALL is set to "off").
Expand Down
57 changes: 34 additions & 23 deletions docker/my-dojo/bitcoin/restart.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,37 @@
set -e

echo "## Start bitcoind #############################"
bitcoind -datadir=/home/bitcoin/.bitcoin \
-server=1 \
-listen=1 \
-bind=172.28.1.5 \
-port=8333 \
-proxy=172.28.1.4:9050 \
-rpcport=28256 \
-rpcallowip=::/0 \
-rpcbind=172.28.1.5 \
-txindex=1 \
-disablewallet=1 \
-zmqpubhashblock=tcp://0.0.0.0:9502 \
-zmqpubrawtx=tcp://0.0.0.0:9501 \
-dbcache=$BITCOIND_DB_CACHE \
-dnsseed=$BITCOIND_DNSSEED \
-dns=$BITCOIND_DNS \
-rpcuser=$BITCOIND_RPC_USER \
-rpcpassword=$BITCOIND_RPC_PASSWORD \
-maxconnections=$BITCOIND_MAX_CONNECTIONS \
-maxmempool=$BITCOIND_MAX_MEMPOOL \
-mempoolexpiry=$BITCOIND_MEMPOOL_EXPIRY \
-minrelaytxfee=$BITCOIND_MIN_RELAY_TX_FEE \
-externalip=$(cat /var/lib/tor/hsv2bitcoind/hostname)

bitcoind_options=(
-bind=172.28.1.5
-datadir=/home/bitcoin/.bitcoin
-dbcache=$BITCOIND_DB_CACHE
-disablewallet=1
-dns=$BITCOIND_DNS
-dnsseed=$BITCOIND_DNSSEED
-externalip=$(cat /var/lib/tor/hsv2bitcoind/hostname)
-listen=1
-maxconnections=$BITCOIND_MAX_CONNECTIONS
-maxmempool=$BITCOIND_MAX_MEMPOOL
-mempoolexpiry=$BITCOIND_MEMPOOL_EXPIRY
-minrelaytxfee=$BITCOIND_MIN_RELAY_TX_FEE
-port=8333
-proxy=172.28.1.4:9050
-rpcallowip=::/0
-rpcbind=172.28.1.5
-rpcpassword=$BITCOIND_RPC_PASSWORD
-rpcport=28256
-rpcthreads=$BITCOIND_RPC_THREADS
-rpcuser=$BITCOIND_RPC_USER
-server=1
-txindex=1
-zmqpubhashblock=tcp://0.0.0.0:9502
-zmqpubrawtx=tcp://0.0.0.0:9501
)

if [ "$BITCOIND_RPC_EXTERNAL" == "on" ]; then
bitcoind_options+=(-zmqpubhashtx=tcp://0.0.0.0:9500)
bitcoind_options+=(-zmqpubrawblock=tcp://0.0.0.0:9503)
fi

bitcoind "${bitcoind_options[@]}"
4 changes: 4 additions & 0 deletions docker/my-dojo/conf/docker-bitcoind.conf.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ BITCOIND_MAX_MEMPOOL=1024
# Type: integer
BITCOIND_DB_CACHE=1024

# Number of threads to service RPC calls
# Type: integer
BITCOIND_RPC_THREADS=6

# Mempool expiry in hours
# Defines how long transactions stay in your local mempool before expiring
# Type: integer
Expand Down
2 changes: 2 additions & 0 deletions docker/my-dojo/overrides/bitcoind.rpc.expose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@ services:
bitcoind:
ports:
- "${BITCOIND_RPC_EXTERNAL_IP}:28256:28256"
- "${BITCOIND_RPC_EXTERNAL_IP}:9500:9500"
- "${BITCOIND_RPC_EXTERNAL_IP}:9501:9501"
- "${BITCOIND_RPC_EXTERNAL_IP}:9502:9502"
- "${BITCOIND_RPC_EXTERNAL_IP}:9503:9503"

0 comments on commit 3a560f6

Please # to comment.