diff --git a/README.md b/README.md index fb8cfdc..6e901f9 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ # cyphernode + Modular Bitcoin full-node microservices API server architecture and utilities toolkit to build scalable, secure and featureful apps and services without trusted third parties. # What is cyphernode? @@ -19,7 +20,7 @@ Hardware wallets (ColdCard, Trezor) will be utilized for key generation and sign It is currently in production by Bylls.com, Canada's first and largest Bitcoin payment processor, as well as Bitcoin Outlet, a fixed-rate Bitcoin exchange service alternative to Coinbase which allows Canadians to purchase bitcoins sent directly to their own Bitcoin wallet. -The docker containers used in this project are hosted at www.bitcoindockers.com +The docker containers used in this project are hosted at www.bitcoindockers.com The project is in **heavy development** - we are currently looking for review, new features, user feedback and contributors to our roadmap. diff --git a/cron_docker/README.md b/cron_docker/README.md index 4de2c64..1a5b8b8 100644 --- a/cron_docker/README.md +++ b/cron_docker/README.md @@ -23,6 +23,6 @@ docker run --rm -d --network cyphernodenet --env-file env.properties cyphernode/ ## Configure your container by modifying `env.properties` file ```properties -TX_CONF_URL=cyphernode:8888/executecallbacks -OTS_URL=cyphernode:8888/ots_backoffice +TX_CONF_URL=proxy:8888/executecallbacks +OTS_URL=proxy:8888/ots_backoffice ``` diff --git a/dist/setup.sh b/dist/setup.sh index b3d0d05..95e6fea 100755 --- a/dist/setup.sh +++ b/dist/setup.sh @@ -638,14 +638,14 @@ ALWAYSYES=0 SUDO_REQUIRED=0 AUTOSTART=0 -# CYPHERNODE VERSION "v0.1.0-rc.1" +# CYPHERNODE VERSION "v0.1.0-rc.2" VERSION_OVERRIDE="true" -CONF_VERSION="v0.1-rc.1" -GATEKEEPER_VERSION="v0.1-rc.1" -PROXY_VERSION="v0.1-rc.1" -PROXYCRON_VERSION="v0.1-rc.1" -OTSCLIENT_VERSION="v0.1-rc.1" -PYCOIN_VERSION="v0.1-rc.1" +CONF_VERSION="v0.1-rc.2" +GATEKEEPER_VERSION="v0.1-rc.2" +PROXY_VERSION="v0.1-rc.2" +PROXYCRON_VERSION="v0.1-rc.2" +OTSCLIENT_VERSION="v0.1-rc.2" +PYCOIN_VERSION="v0.1-rc.2" BITCOIN_VERSION="v0.17.0" LIGHTNING_VERSION="v0.6.2" diff --git a/install/generator-cyphernode/generators/app/templates/installer/docker/docker-compose.yaml b/install/generator-cyphernode/generators/app/templates/installer/docker/docker-compose.yaml index d39a559..eba5633 100644 --- a/install/generator-cyphernode/generators/app/templates/installer/docker/docker-compose.yaml +++ b/install/generator-cyphernode/generators/app/templates/installer/docker/docker-compose.yaml @@ -69,7 +69,8 @@ services: restart: always proxycron: environment: - - "PROXY_URL=proxy:8888/executecallbacks" + - "TX_CONF_URL=proxy:8888/executecallbacks" + - "OTS_URL=proxy:8888/ots_backoffice" image: cyphernode/proxycron:<%= proxycron_version %> # deploy: # placement: diff --git a/proxy_docker/app/script/callbacks_job.sh b/proxy_docker/app/script/callbacks_job.sh index 26f539b..3edd87b 100644 --- a/proxy_docker/app/script/callbacks_job.sh +++ b/proxy_docker/app/script/callbacks_job.sh @@ -115,7 +115,9 @@ build_callback() data="${data}\"received\":\"$(date -Is -d @${ts_firstseen})\"," data="${data}\"size\":${size}," data="${data}\"vsize\":${vsize}," - data="${data}\"fees\":${fee}," + if [ -n "${fee}" ]; then + data="${data}\"fees\":${fee}," + fi data="${data}\"is_replaceable\":${is_replaceable}" if [ -n "${blocktime}" ]; then data="${data},\"blockhash\":\"${blockhash}\"," diff --git a/proxy_docker/app/script/ots.sh b/proxy_docker/app/script/ots.sh index d3a54af..70548cb 100644 --- a/proxy_docker/app/script/ots.sh +++ b/proxy_docker/app/script/ots.sh @@ -221,7 +221,7 @@ serve_ots_getfile() local hash=${1} trace "[serve_ots_getfile] hash=${hash}" - binfile_response_to_client "/otsfiles/" "${hash}.ots" + binfile_response_to_client "otsfiles/" "${hash}.ots" returncode=$? trace_rc ${returncode} diff --git a/proxy_docker/app/script/tests.sh b/proxy_docker/app/script/tests.sh index 6db9b60..4cdad64 100644 --- a/proxy_docker/app/script/tests.sh +++ b/proxy_docker/app/script/tests.sh @@ -9,10 +9,10 @@ tests() local response # getbestblockhash - # (GET) http://cyphernode:8888/getbestblockhash + # (GET) http://proxy:8888/getbestblockhash echo "Testing getbestblockhash..." - response=$(curl -s cyphernode:8888/getbestblockhash) + response=$(curl -s proxy:8888/getbestblockhash) echo "response=${response}" local blockhash=$(echo ${response} | jq ".result" | tr -d '\"') echo "blockhash=${blockhash}" @@ -22,10 +22,10 @@ tests() echo "Tested getbestblockhash." # getbestblockinfo - # curl (GET) http://cyphernode:8888/getbestblockinfo + # curl (GET) http://proxy:8888/getbestblockinfo echo "Testing getbestblockinfo..." - response=$(curl -s cyphernode:8888/getbestblockinfo) + response=$(curl -s proxy:8888/getbestblockinfo) echo "response=${response}" local blockhash2=$(echo ${response} | jq ".result.hash" | tr -d '\"') echo "blockhash2=${blockhash2}" @@ -35,10 +35,10 @@ tests() echo "Tested getbestblockinfo." # getblockinfo - # (GET) http://cyphernode:8888/getblockinfo/000000006f82a384c208ecfa04d05beea02d420f3f398ddda5c7f900de5718ea + # (GET) http://proxy:8888/getblockinfo/000000006f82a384c208ecfa04d05beea02d420f3f398ddda5c7f900de5718ea echo "Testing getblockinfo..." - response=$(curl -s cyphernode:8888/getblockinfo/${blockhash}) + response=$(curl -s proxy:8888/getblockinfo/${blockhash}) echo "response=${response}" blockhash2=$(echo ${response} | jq ".result.hash" | tr -d '\"') echo "blockhash2=${blockhash2}" @@ -48,10 +48,10 @@ tests() echo "Tested getblockinfo." # gettransaction - # (GET) http://cyphernode:8888/gettransaction/af867c86000da76df7ddb1054b273ca9e034e8c89d049b5b2795f9f590f67648 + # (GET) http://proxy:8888/gettransaction/af867c86000da76df7ddb1054b273ca9e034e8c89d049b5b2795f9f590f67648 echo "Testing gettransaction..." - response=$(curl -s cyphernode:8888/gettransaction/af867c86000da76df7ddb1054b273ca9e034e8c89d049b5b2795f9f590f67648) + response=$(curl -s proxy:8888/gettransaction/af867c86000da76df7ddb1054b273ca9e034e8c89d049b5b2795f9f590f67648) echo "response=${response}" local txid=$(echo ${response} | jq ".result.txid" | tr -d '\"') echo "txid=${txid}" @@ -61,26 +61,26 @@ tests() echo "Tested gettransaction." # getnewaddress - # (GET) http://cyphernode:8888/getnewaddress + # (GET) http://proxy:8888/getnewaddress # returns {"address":"2MuiUu8AyuByAGYRDAqqhdYxt8gXcsQ1Ymw"} echo "Testing getnewaddress..." - response=$(curl -s cyphernode:8888/getnewaddress) + response=$(curl -s proxy:8888/getnewaddress) echo "response=${response}" address1=$(echo ${response} | jq ".address" | tr -d '\"') echo "address1=${address1}" if [ -z "${address1}" ]; then exit 10 fi - address2=$(curl -s cyphernode:8888/getnewaddress | jq ".address" | tr -d '\"') + address2=$(curl -s proxy:8888/getnewaddress | jq ".address" | tr -d '\"') echo "address2=${address2}" echo "Tested getnewaddress." # getbalance - # (GET) http://cyphernode:8888/getbalance + # (GET) http://proxy:8888/getbalance echo "Testing getbalance..." - response=$(curl -s cyphernode:8888/getbalance) + response=$(curl -s proxy:8888/getbalance) echo "response=${response}" local balance=$(echo ${response} | jq ".balance") echo "balance=${balance}" @@ -90,7 +90,7 @@ tests() echo "Tested getbalance." # watch - # POST http://cyphernode:8888/watch + # POST http://proxy:8888/watch # BODY {"address":"2N8DcqzfkYi8CkYzvNNS5amoq3SbAcQNXKp","unconfirmedCallbackURL":"192.168.122.233:1111/callback0conf","confirmedCallbackURL":"192.168.122.233:1111/callback1conf"} echo "Testing watch..." @@ -98,7 +98,7 @@ tests() local url2="$(hostname):1111/callback1conf" echo "url1=${url1}" echo "url2=${url2}" - response=$(curl -s -H "Content-Type: application/json" -d "{\"address\":\"${address1}\",\"unconfirmedCallbackURL\":\"${url1}\",\"confirmedCallbackURL\":\"${url2}\"}" cyphernode:8888/watch) + response=$(curl -s -H "Content-Type: application/json" -d "{\"address\":\"${address1}\",\"unconfirmedCallbackURL\":\"${url1}\",\"confirmedCallbackURL\":\"${url2}\"}" proxy:8888/watch) echo "response=${response}" local id=$(echo "${response}" | jq ".id" | tr -d '\"') @@ -135,15 +135,15 @@ tests() fi # Let's watch another address just to be able to test unwatch later and test if found in getactivewatches - response=$(curl -s -H "Content-Type: application/json" -d "{\"address\":\"${address2}\",\"unconfirmedCallbackURL\":\"${url1}2\",\"confirmedCallbackURL\":\"${url2}2\"}" cyphernode:8888/watch) + response=$(curl -s -H "Content-Type: application/json" -d "{\"address\":\"${address2}\",\"unconfirmedCallbackURL\":\"${url1}2\",\"confirmedCallbackURL\":\"${url2}2\"}" proxy:8888/watch) echo "response=${response}" echo "Tested watch." # getactivewatches - # (GET) http://cyphernode:8888/getactivewatches + # (GET) http://proxy:8888/getactivewatches echo "Testing getactivewatches..." - response=$(curl -s cyphernode:8888/getactivewatches) + response=$(curl -s proxy:8888/getactivewatches) echo "response=${response}" response=$(echo ${response} | jq ".watches[]") echo "response=${response}" @@ -160,10 +160,10 @@ tests() echo "Tested getactivewatches." # unwatch - # (GET) http://cyphernode:8888/unwatch/2N8DcqzfkYi8CkYzvNNS5amoq3SbAcQNXKp + # (GET) http://proxy:8888/unwatch/2N8DcqzfkYi8CkYzvNNS5amoq3SbAcQNXKp echo "Testing unwatch..." - response=$(curl -s cyphernode:8888/unwatch/${address2}) + response=$(curl -s proxy:8888/unwatch/${address2}) echo "response=${response}" event=$(echo "${response}" | jq ".event" | tr -d '\"') echo "event=${event}" @@ -175,7 +175,7 @@ tests() if [ "${address}" != "${address2}" ]; then exit 110 fi - response=$(curl -s cyphernode:8888/getactivewatches) + response=$(curl -s proxy:8888/getactivewatches) echo "response=${response}" response=$(echo "${response}" | jq ".watches[]") echo "response=${response}" @@ -187,11 +187,11 @@ tests() echo "Tested unwatch." # deriveindex - # (GET) http://cyphernode:8888/deriveindex/25-30 + # (GET) http://proxy:8888/deriveindex/25-30 # {"addresses":[{"address":"2N6Q9kBcLtNswgMSLSQ5oduhbctk7hxEJW8"},{"address":"2NFLhFghAPKEPuZCKoeXYYxuaBxhKXbmhBV"},{"address":"2N7gepbQtRM5Hm4PTjvGadj9wAwEwnAsKiP"},{"address":"2Mth8XDZpXkY9d95tort8HYEAuEesow2tF6"},{"address":"2MwqEmAXhUw6H7bJwMhD13HGWVEj2HgFiNH"},{"address":"2N2Y4BVRdrRFhweub2ehHXveGZC3nryMEJw"}]} echo "Testing deriveindex..." - response=$(curl -v cyphernode:8888/deriveindex/25-30) + response=$(curl -v proxy:8888/deriveindex/25-30) echo "response=${response}" local nbaddr=$(echo "${response}" | jq ".addresses | length") if [ "${nbaddr}" -ne "6" ]; then @@ -204,12 +204,12 @@ tests() echo "Tested deriveindex." # derivepubpath - # (GET) http://cyphernode:8888/derivepubpath + # (GET) http://proxy:8888/derivepubpath # BODY {"pub32":"upub5GtUcgGed1aGH4HKQ3vMYrsmLXwmHhS1AeX33ZvDgZiyvkGhNTvGd2TA5Lr4v239Fzjj4ZY48t6wTtXUy2yRgapf37QHgt6KWEZ6bgsCLpb","path":"0/25-30"} # {"addresses":[{"address":"2N6Q9kBcLtNswgMSLSQ5oduhbctk7hxEJW8"},{"address":"2NFLhFghAPKEPuZCKoeXYYxuaBxhKXbmhBV"},{"address":"2N7gepbQtRM5Hm4PTjvGadj9wAwEwnAsKiP"},{"address":"2Mth8XDZpXkY9d95tort8HYEAuEesow2tF6"},{"address":"2MwqEmAXhUw6H7bJwMhD13HGWVEj2HgFiNH"},{"address":"2N2Y4BVRdrRFhweub2ehHXveGZC3nryMEJw"}]} echo "Testing derivepubpath..." - response=$(curl -v -H "Content-Type: application/json" -d "{\"pub32\":\"upub5GtUcgGed1aGH4HKQ3vMYrsmLXwmHhS1AeX33ZvDgZiyvkGhNTvGd2TA5Lr4v239Fzjj4ZY48t6wTtXUy2yRgapf37QHgt6KWEZ6bgsCLpb\",\"path\":\"0/25-30\"}" cyphernode:8888/derivepubpath) + response=$(curl -v -H "Content-Type: application/json" -d "{\"pub32\":\"upub5GtUcgGed1aGH4HKQ3vMYrsmLXwmHhS1AeX33ZvDgZiyvkGhNTvGd2TA5Lr4v239Fzjj4ZY48t6wTtXUy2yRgapf37QHgt6KWEZ6bgsCLpb\",\"path\":\"0/25-30\"}" proxy:8888/derivepubpath) echo "response=${response}" local nbaddr=$(echo "${response}" | jq ".addresses | length") if [ "${nbaddr}" -ne "6" ]; then @@ -222,27 +222,27 @@ tests() echo "Tested derivepubpath." # spend - # POST http://cyphernode:8888/spend + # POST http://proxy:8888/spend # BODY {"address":"2N8DcqzfkYi8CkYzvNNS5amoq3SbAcQNXKp","amount":0.00233} # By spending to a watched address, we will test the spending feature and trigger the confirmation to test # confirmations of watched addresses... Cleva!!! echo "Testing spend, conf and callbacks..." - response=$(curl -v -H "Content-Type: application/json" -d "{\"address\":\"${address1}\",\"amount\":0.00001}" cyphernode:8888/spend) + response=$(curl -v -H "Content-Type: application/json" -d "{\"address\":\"${address1}\",\"amount\":0.00001}" proxy:8888/spend) echo "response=${response}" wait_for_callbacks echo "Tested spend, conf and callbacks." # addtobatch - # POST http://cyphernode:8888/addtobatch + # POST http://proxy:8888/addtobatch # BODY {"address":"2N8DcqzfkYi8CkYzvNNS5amoq3SbAcQNXKp","amount":0.00233} # By spending to a watched address, we will test the spending feature and trigger the confirmation to test # confirmations of watched addresses... Cleva!!! # echo "Testing addtobatch..." -# response=$(curl -v -H "Content-Type: application/json" -d "{\"address\":\"${address1}\",\"amount\":0.00001}" cyphernode:8888/spend) +# response=$(curl -v -H "Content-Type: application/json" -d "{\"address\":\"${address1}\",\"amount\":0.00001}" proxy:8888/spend) # echo "response=${response}" # wait_for_callbacks # echo "Tested addtobatch ." @@ -251,7 +251,7 @@ tests() # conf - # (GET) http://cyphernode:8888/conf/b081ca7724386f549cf0c16f71db6affeb52ff7a0d9b606fb2e5c43faffd3387 + # (GET) http://proxy:8888/conf/b081ca7724386f549cf0c16f71db6affeb52ff7a0d9b606fb2e5c43faffd3387 # Let's trigger tx confirmation even if not confirmed. Will be funny. Should take care of # multiple confirmations of the same state. @@ -261,22 +261,22 @@ tests() # executecallbacks # (GET) http://cyphernode::8080/executecallbacks - #echo "GET /getbestblockinfo" | nc cyphernode:8888 - | sed -En "s/^(\{.*)/\1/p" | jq + #echo "GET /getbestblockinfo" | nc proxy:8888 - | sed -En "s/^(\{.*)/\1/p" | jq # spend - # POST http://cyphernode:8888/spend + # POST http://proxy:8888/spend # BODY {"address":"2N8DcqzfkYi8CkYzvNNS5amoq3SbAcQNXKp","amount":0.00233} - #curl -v -H "Content-Type: application/json" -d '{"address":"2MsWyaQ8APbnqasFpWopqUKqsdpiVY3EwLE","amount":0.0001}' cyphernode:8888/spend + #curl -v -H "Content-Type: application/json" -d '{"address":"2MsWyaQ8APbnqasFpWopqUKqsdpiVY3EwLE","amount":0.0001}' proxy:8888/spend # ln_getinfo - # (GET) http://cyphernode:8888/ln_getinfo + # (GET) http://proxy:8888/ln_getinfo echo "Testing ln_getinfo..." - response=$(curl -s cyphernode:8888/ln_getinfo) + response=$(curl -s proxy:8888/ln_getinfo) echo "response=${response}" local port=$(echo ${response} | jq ".binding[] | select(.type == \"ipv4\") | .port") echo "port=${port}" @@ -286,10 +286,10 @@ tests() echo "Tested ln_getinfo." # ln_newaddr - # (GET) http://cyphernode:8888/ln_newaddr + # (GET) http://proxy:8888/ln_newaddr echo "Testing ln_newaddr..." - response=$(curl -s cyphernode:8888/ln_newaddr) + response=$(curl -s proxy:8888/ln_newaddr) echo "response=${response}" address=$(echo ${response} | jq ".address") echo "address=${address}" @@ -299,11 +299,11 @@ tests() echo "Tested ln_newaddr." # ln_create_invoice - # POST http://cyphernode:8888/ln_create_invoice + # POST http://proxy:8888/ln_create_invoice # BODY {"msatoshi":"10000","label":"koNCcrSvhX3dmyFhW","description":"Bylls order #10649","expiry":"10"} #echo "Testing ln_create_invoice..." - #response=$(curl -v -H "Content-Type: application/json" -d "{\"msatoshi\":10000,\"label\":\"koNCcrSvhX3dmyFhW\",\"description\":\"Bylls order #10649\",\"expiry\":10}" cyphernode:8888/ln_create_invoice) + #response=$(curl -v -H "Content-Type: application/json" -d "{\"msatoshi\":10000,\"label\":\"koNCcrSvhX3dmyFhW\",\"description\":\"Bylls order #10649\",\"expiry\":10}" proxy:8888/ln_create_invoice) #echo "response=${response}" #echo "Tested ln_create_invoice."