mirror of
https://github.com/AskDavis/cyphernode.git
synced 2026-01-01 04:25:58 -08:00
First push from Satoshi Portal's own cyphernode
This commit is contained in:
47
pycoin_docker/script/pycoin.sh
Normal file
47
pycoin_docker/script/pycoin.sh
Normal file
@@ -0,0 +1,47 @@
|
||||
#!/bin/sh
|
||||
|
||||
. ./trace.sh
|
||||
|
||||
derive()
|
||||
{
|
||||
trace "Entering derive()..."
|
||||
|
||||
local request=${1}
|
||||
local pub32=$(echo "${request}" | jq ".pub32" | tr -d '"')
|
||||
local path=$(echo "${request}" | jq ".path" | tr -d '"')
|
||||
|
||||
local result
|
||||
local returncode
|
||||
trace "[derive] path=${path}"
|
||||
trace "[derive] pub32=${pub32}"
|
||||
|
||||
result=$(ku -n BTC -s ${path} -a E:${pub32})
|
||||
|
||||
returncode=$?
|
||||
trace_rc ${returncode}
|
||||
trace "[derive] result=${result}"
|
||||
|
||||
local notfirst=false
|
||||
|
||||
echo -n "{\"addresses\":["
|
||||
|
||||
local IFS=$'\n'
|
||||
for address in ${result}
|
||||
do
|
||||
if ${notfirst}; then
|
||||
echo ","
|
||||
else
|
||||
notfirst=true
|
||||
fi
|
||||
trace "[derive] address=${address}"
|
||||
|
||||
data="{\"address\":\"${address}\"}"
|
||||
trace "[derive] data=${data}"
|
||||
|
||||
echo -n "${data}"
|
||||
done
|
||||
|
||||
echo "]}"
|
||||
|
||||
return ${returncode}
|
||||
}
|
||||
Reference in New Issue
Block a user