Files
cyphernode/proxy_docker/app/script/bitcoin.sh
Markus Wolf e1ee367430 moved configs into environment (#17)
* moved configs into environment

* fixed copy pasta

* changed proxyuser to proxy in data paths

* fixed typo
2018-10-12 13:10:31 -04:00

45 lines
1.0 KiB
Bash

#!/bin/sh
. ./trace.sh
deriveindex()
{
trace "Entering deriveindex()..."
local index=${1}
trace "[deriveindex] index=${index}"
local pub32=$DERIVATION_PUB32
local path=$(echo -e $DERIVATION_PATH | sed -En "s/n/${index}/p")
# pub32=$(grep "derivation.pub32" config.properties | cut -d'=' -f2)
# path=$(grep "derivation.path" config.properties | cut -d'=' -f2 | sed -En "s/n/${index}/p")
local data="{\"pub32\":\"${pub32}\",\"path\":\"${path}\"}"
trace "[deriveindex] data=${data}"
send_to_pycoin "${data}"
return $?
}
send_to_pycoin()
{
trace "Entering send_to_pycoin()..."
local data=${1}
local result
local returncode
trace "[send_to_pycoin] curl -s -H \"Content-Type: application/json\" -d \"${data}\" ${PYCOIN_CONTAINER}/derive"
result=$(curl -s -H "Content-Type: application/json" -d "${data}" ${PYCOIN_CONTAINER}/derive)
returncode=$?
trace_rc ${returncode}
trace "[send_to_pycoin] result=${result}"
# Output response to stdout before exiting with return code
echo "${result}"
trace_rc ${returncode}
return ${returncode}
}