diff --git a/docker/README.md b/docker/README.md index 4feaff7..21dc9df 100644 --- a/docker/README.md +++ b/docker/README.md @@ -1,6 +1,6 @@ # Intro -Deal Module - the BitDeals daemon that provides a special interfaces for creating and modifying user accounts and deals. +Deal Module (dm) - the BitDeals daemon that provides a special interfaces for creating and modifying user accounts and deals. # Running DM docker container @@ -28,6 +28,7 @@ services: - PUID=1000 - PGID=1000 - TZ=UTC + - TESTNET=1 #optional - BITCOIN=
#optional - FEE=<0.1%> #optional - PGP_PUB= #optional @@ -49,6 +50,7 @@ services: ```sh docker run -d \ --name=bitdeals-dm \ + -e TESTNET=1 `#optional` \ -e BITCOIN=
`#optional` \ -e FEE=<0.1%> `#optional` \ -e PGP_PUB=$(gpg2 --armor --export Account_URL) `#optional` \ @@ -72,6 +74,7 @@ Container images are configured using parameters passed at runtime. |-p 80|WebUI port TCP| |-p 4977|Module API port TCP [(API documentation)](https://bitbucket.org/bitdeals/apostol-dm)| |-e ACCOUNT_URL=|User site address to provide a deal service. On first run the initialization script will create and save a new PGP keys with this Account_URL in key details.| +|-e TESTNET=|Enable bitcoin testnet mode.| |-e BITCOIN=|User account bitcoin address.| |-e FEE=|User fee for created deals.| |-e PGP_PUB=|Variable with ASCII armored PGP public key.| diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index 889f51f..dd24235 100644 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -11,6 +11,7 @@ DM_CONF_FILE="/etc/dm/dm.conf" OAUTH_CONF_FILE="/etc/dm/oauth2/default.json" PGP_PUB_FILE="/etc/dm/pgp.pub" PGP_SEC_FILE="/etc/dm/pgp.sec" +BX_CONF_FILE="/usr/local/etc/libbitcoin/bx.cfg" ## Write a variables to config file sed -i "/\[main\]/,/\[/ s/user=.*/user=module/" "$DM_CONF_FILE" @@ -83,6 +84,23 @@ then B=$(tput bold) N=$(tput sgr0) + ## Setup testnet settings in libbitcoin-explorer config + test $TESTNET -eq 1 && \ + sed -i -e "/\[wallet\]/,/\[/ s/wif_version? =.*/wif_version = 239/" \ + -e "/\[wallet\]/,/\[/ s/hd_public_version =.*/hd_public_version = 70617039/" \ + -e "/\[wallet\]/,/\[/ s/hd_secret_version =.*/hd_secret_version = 70615956/" \ + -e "/\[wallet\]/,/\[/ s/pay_to_public_key_hash_version =.*/pay_to_public_key_hash_version = 111/" \ + -e "/\[wallet\]/,/\[/ s/pay_to_script_hash_version =.*/pay_to_script_hash_version = 196/" \ + -e "/\[network\]/,/\[/ s/identifier =.*/identifier = 118034699/" \ + -e "/seed = mainnet[0-9].libbitcoin.net:8333/ s/^/#/" \ + -e "/url = tcp:\/\/mainnet.libbitcoin.net:9091/ s/^/#/" \ + -e "/block_url = tcp:\/\/mainnet.libbitcoin.net:9093/ s/^/#/" \ + -e "/transaction_url = tcp:\/\/mainnet.libbitcoin.net:9094/ s/^/#/" \ + -e "/#seed = testnet[0-9].libbitcoin.net:18333/ s/^#//" \ + -e "/#url = tcp:\/\/testnet.libbitcoin.net:19091/ s/^#//" \ + -e "/#block_url = tcp:\/\/testnet.libbitcoin.net:19093/ s/^#//" \ + -e "/#transaction_url = tcp:\/\/testnet.libbitcoin.net:19094/ s/^#//" "$BX_CONF_FILE" + ## Generate bitcoin keys PRIVKEY="$(cat /dev/random | tr -cd "[:digit:]" | head -c 64)" PUBKEY="$(bx ec-to-public $PRIVKEY)"