From 267f63b9d64ea26ecbb36cf6901492bab8e277d2 Mon Sep 17 00:00:00 2001 From: Bryan Bishop Date: Mon, 8 Jun 2015 10:35:40 -0500 Subject: some more rpc command endpoints, no layouts --- rpcblockchainexplorer/api.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/rpcblockchainexplorer/api.py b/rpcblockchainexplorer/api.py index 666500c..c83ffc2 100644 --- a/rpcblockchainexplorer/api.py +++ b/rpcblockchainexplorer/api.py @@ -194,3 +194,34 @@ def index(): }) return render_template("blocks.html", blocks=blocks) + +@api.route("/block/") +def _getblock(blockhash): + block = g.bitcoin_rpc_client._call("getblock", blockhash) + return render_template("block.html", block=block) + +@api.route("/getblockcount") +def _getblockcount(): + blockcount = g.bitcoin_rpc_client.getblockcount() + return str(blockcount) + +@api.route("/getblockhash/") +def _getblockhash(blockheight): + blockhash = g.bitcoin_rpc_client.getblockhash(b2lx(lx(blockheight))) + return str(blockhash) + +@api.route("/getdifficulty") +def _getdifficulty(): + difficulty = g.bitcoin_rpc_client.getdifficulty() + return str(difficulty) + +@api.route("/getbestblockhash") +def _getbestblockhash(): + bestblockhash = g.bitcoin_rpc_client.getbestblockhash() + return str(bestblockhash) + +# TODO: getrawtransaction +# TODO: decoderawtransaction +# TODO: getblockchaininfo +# TODO: getchaintips +# TODO: getmempoolinfo -- cgit v1.2.3