Files
cyphernode/proxy_docker/app/script/blockchainrpc.sh
kexkey f0855025fd Height issue (#23)
* Height was not in 1-conf callback

* Height bug

* Block height fix

* Smarter
2018-11-22 15:26:29 -05:00

70 lines
1.6 KiB
Bash

#!/bin/sh
. ./trace.sh
. ./sendtobitcoinnode.sh
get_best_block_hash()
{
trace "Entering get_best_block_hash()..."
local data='{"method":"getbestblockhash"}'
send_to_watcher_node "${data}"
return $?
}
getestimatesmartfee()
{
trace "Entering getestimatesmartfee()..."
local nb_blocks=${1}
trace "[getestimatesmartfee] nb_blocks=${nb_blocks}"
send_to_watcher_node "{\"method\":\"estimatesmartfee\",\"params\":[${nb_blocks}]}" | jq ".result.feerate" | awk '{ printf "%.8f", $0 }'
return $?
}
get_block_info()
{
trace "Entering get_block_info()..."
local block_hash=${1}
trace "[get_block_info] block_hash=${block_hash}"
local data="{\"method\":\"getblock\",\"params\":[\"${block_hash}\"]}"
trace "[get_block_info] data=${data}"
send_to_watcher_node "${data}"
return $?
}
get_best_block_info()
{
trace "Entering get_best_block_info()..."
local block_hash=$(echo "$(get_best_block_hash)" | jq ".result" | tr -d '"')
trace "[get_best_block_info] block_hash=${block_hash}"
get_block_info ${block_hash}
return $?
}
get_rawtransaction()
{
trace "Entering get_rawtransaction()..."
local txid=${1}
trace "[get_rawtransaction] txid=${txid}"
local data="{\"method\":\"getrawtransaction\",\"params\":[\"${txid}\",true]}"
trace "[get_rawtransaction] data=${data}"
send_to_watcher_node "${data}"
return $?
}
get_transaction()
{
trace "Entering get_transaction()..."
local txid=${1}
trace "[get_transaction] txid=${txid}"
local data="{\"method\":\"gettransaction\",\"params\":[\"${txid}\",true]}"
trace "[get_transaction] data=${data}"
send_to_watcher_node "${data}"
return $?
}