mirror of
https://github.com/yzernik/squeaknode.git
synced 2026-08-13 12:33:25 +02:00
Use bitcoincore for bitcoin node (#481)
* Got docker-compose working with bitcoin-core * Got itest working * Add bitcoin use_ssl config * Rename service to bitcoin-core in docker-compose
This commit is contained in:
parent
5babad14ac
commit
a43576a10e
7 changed files with 77 additions and 18 deletions
|
|
@ -6,7 +6,7 @@ sync_interval_s=10
|
|||
host=lnd
|
||||
|
||||
[bitcoin]
|
||||
rpc_host=btcd
|
||||
rpc_host=bitcoin-core
|
||||
rpc_user=devuser
|
||||
rpc_pass=devpass
|
||||
|
||||
|
|
|
|||
|
|
@ -1,18 +1,34 @@
|
|||
version: '3'
|
||||
services:
|
||||
|
||||
btcd:
|
||||
image: btcd
|
||||
container_name: btcd
|
||||
build:
|
||||
context: ../
|
||||
dockerfile: docker/btcd/Dockerfile
|
||||
# btcd:
|
||||
# image: btcd
|
||||
# container_name: btcd
|
||||
# build:
|
||||
# context: ../
|
||||
# dockerfile: docker/btcd/Dockerfile
|
||||
# volumes:
|
||||
# - shared:/rpc
|
||||
# - ~/.btcd/data:/data
|
||||
# environment:
|
||||
# - NETWORK
|
||||
# entrypoint: ["./start-btcd.sh"]
|
||||
|
||||
bitcoin-core:
|
||||
image: ruimarinho/bitcoin-core
|
||||
container_name: bitcoin-core
|
||||
volumes:
|
||||
- shared:/rpc
|
||||
- ~/.btcd/data:/data
|
||||
environment:
|
||||
- NETWORK
|
||||
entrypoint: ["./start-btcd.sh"]
|
||||
- ~/.bitcoin:/home/bitcoin/.bitcoin
|
||||
command:
|
||||
-printtoconsole
|
||||
-testnet=1
|
||||
-server=1
|
||||
-rpcbind=0.0.0.0
|
||||
-rpcallowip=0.0.0.0/0
|
||||
-rpcuser=devuser
|
||||
-rpcpassword=devpass
|
||||
-zmqpubrawblock=tcp://0.0.0.0:28332
|
||||
-zmqpubrawtx=tcp://0.0.0.0:28333
|
||||
|
||||
lnd:
|
||||
image: lnd
|
||||
|
|
@ -22,14 +38,15 @@ services:
|
|||
dockerfile: docker/lnd/Dockerfile
|
||||
environment:
|
||||
- NETWORK
|
||||
- RPCHOST=btcd
|
||||
- RPCHOST=bitcoin-core
|
||||
- BACKEND=bitcoind
|
||||
volumes:
|
||||
- shared:/rpc
|
||||
- ~/.lnd:/root/.lnd
|
||||
ports:
|
||||
- 9735:9735
|
||||
links:
|
||||
- "btcd:btcd"
|
||||
- "bitcoin-core:bitcoin-core"
|
||||
sysctls:
|
||||
- net.ipv6.conf.all.disable_ipv6=0
|
||||
entrypoint: ["./start-lnd.sh"]
|
||||
|
|
@ -56,7 +73,7 @@ services:
|
|||
- 8774:8774
|
||||
- 12994:12994
|
||||
links:
|
||||
- "btcd:btcd"
|
||||
- "bitcoin-core:bitcoin-core"
|
||||
- "lnd:lnd"
|
||||
sysctls:
|
||||
- net.ipv6.conf.all.disable_ipv6=0
|
||||
|
|
|
|||
|
|
@ -58,6 +58,40 @@ if [[ "$BACKEND" == "neutrino" ]]; then
|
|||
--debuglevel="$DEBUG" \
|
||||
--tlsextradomain=lnd \
|
||||
"$@"
|
||||
elif [[ "$BACKEND" == "bitcoind" ]]; then
|
||||
|
||||
sleep 60
|
||||
echo lnd \
|
||||
--noseedbackup \
|
||||
--logdir="/data" \
|
||||
"--$CHAIN.active" \
|
||||
"--$CHAIN.$NETWORK" \
|
||||
"--$CHAIN.node"="$BACKEND" \
|
||||
"--$BACKEND.rpchost"="$RPCHOST" \
|
||||
"--$BACKEND.rpcuser"="$RPCUSER" \
|
||||
"--$BACKEND.rpcpass"="$RPCPASS" \
|
||||
"--$BACKEND.zmqpubrawblock"="tcp://${RPCHOST}:28332" \
|
||||
"--$BACKEND.zmqpubrawtx"="tcp://${RPCHOST}:28333" \
|
||||
--rpclisten=0.0.0.0:10009 \
|
||||
--debuglevel="$DEBUG" \
|
||||
--tlsextradomain=lnd \
|
||||
"$@"
|
||||
|
||||
exec lnd \
|
||||
--noseedbackup \
|
||||
--logdir="/data" \
|
||||
"--$CHAIN.active" \
|
||||
"--$CHAIN.$NETWORK" \
|
||||
"--$CHAIN.node"="$BACKEND" \
|
||||
"--$BACKEND.rpchost"="$RPCHOST" \
|
||||
"--$BACKEND.rpcuser"="$RPCUSER" \
|
||||
"--$BACKEND.rpcpass"="$RPCPASS" \
|
||||
"--$BACKEND.zmqpubrawblock"="tcp://${RPCHOST}:28332" \
|
||||
"--$BACKEND.zmqpubrawtx"="tcp://${RPCHOST}:28333" \
|
||||
--rpclisten=0.0.0.0:10009 \
|
||||
--debuglevel="$DEBUG" \
|
||||
--tlsextradomain=lnd \
|
||||
"$@"
|
||||
else
|
||||
exec lnd \
|
||||
--noseedbackup \
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ external_host=lnd_server
|
|||
rpc_host=btcd
|
||||
rpc_user=devuser
|
||||
rpc_pass=devpass
|
||||
rpc_use_ssl=true
|
||||
|
||||
[postgresql]
|
||||
host=db
|
||||
|
|
|
|||
|
|
@ -19,8 +19,10 @@ class BitcoinBlockchainClient(BlockchainClient):
|
|||
port: int,
|
||||
rpc_user: str,
|
||||
rpc_password: str,
|
||||
use_ssl: bool,
|
||||
) -> None:
|
||||
self.url = f"https://{rpc_user}:{rpc_password}@{host}:{port}"
|
||||
protocol = "https" if use_ssl else "http"
|
||||
self.url = f"{protocol}://{rpc_user}:{rpc_password}@{host}:{port}"
|
||||
self.headers = {"content-type": "application/json"}
|
||||
|
||||
def get_best_block_info(self) -> BlockInfo:
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@ WEBADMIN_HOST = "0.0.0.0"
|
|||
WEBADMIN_PORT = 12994
|
||||
DEFAULT_BITCOIN_RPC_PORT = 8334
|
||||
BITCOIN_RPC_PORT = {
|
||||
'mainnet': 8334,
|
||||
'testnet': 18334,
|
||||
'mainnet': 8332,
|
||||
'testnet': 18332,
|
||||
'simnet': 18556,
|
||||
}
|
||||
DEFAULT_LND_PORT = 9735
|
||||
|
|
@ -44,6 +44,7 @@ class Config:
|
|||
self._configs['bitcoin_rpc_port'] = self._get_bitcoin_rpc_port()
|
||||
self._configs['bitcoin_rpc_user'] = self._get_bitcoin_rpc_user()
|
||||
self._configs['bitcoin_rpc_pass'] = self._get_bitcoin_rpc_pass()
|
||||
self._configs['bitcoin_rpc_use_ssl'] = self._get_bitcoin_rpc_use_ssl()
|
||||
|
||||
#lnd
|
||||
self._configs['lnd_host'] = self._get_lnd_host()
|
||||
|
|
@ -107,6 +108,9 @@ class Config:
|
|||
def _get_bitcoin_rpc_pass(self):
|
||||
return self.parser.get("bitcoin", "rpc_pass")
|
||||
|
||||
def _get_bitcoin_rpc_use_ssl(self):
|
||||
return self.parser.getboolean("bitcoin", "rpc_use_ssl", fallback=False)
|
||||
|
||||
def _get_lnd_host(self):
|
||||
return self.parser.get("lnd", "host")
|
||||
|
||||
|
|
|
|||
|
|
@ -119,6 +119,7 @@ def load_blockchain_client(config):
|
|||
config.bitcoin_rpc_port,
|
||||
config.bitcoin_rpc_user,
|
||||
config.bitcoin_rpc_pass,
|
||||
config.bitcoin_rpc_use_ssl,
|
||||
)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue