First push from Satoshi Portal's own cyphernode

This commit is contained in:
kexkey
2018-09-22 14:49:26 -04:00
commit c39f81f683
47 changed files with 3517 additions and 0 deletions

View 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}
}