diff options
author | Bryan Bishop <kanzure@gmail.com> | 2015-06-08 10:35:40 -0500 |
---|---|---|
committer | Bryan Bishop <kanzure@gmail.com> | 2015-06-08 10:35:40 -0500 |
commit | 267f63b9d64ea26ecbb36cf6901492bab8e277d2 (patch) | |
tree | a4dfb2cb181e5e9457d10f62f351cc5699dff06b | |
parent | 3c080d9f9233974586f7a9d95d77e5f51c4e073b (diff) | |
download | rpcblockchainexplorer-267f63b9d64ea26ecbb36cf6901492bab8e277d2.tar.gz rpcblockchainexplorer-267f63b9d64ea26ecbb36cf6901492bab8e277d2.zip |
some more rpc command endpoints, no layouts
-rw-r--r-- | rpcblockchainexplorer/api.py | 31 |
1 files changed, 31 insertions, 0 deletions
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/<blockhash>") +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/<blockheight>") +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 |