diff options
author | Bryan Bishop <kanzure@gmail.com> | 2015-06-08 11:54:17 -0500 |
---|---|---|
committer | Bryan Bishop <kanzure@gmail.com> | 2015-06-08 11:54:17 -0500 |
commit | f67d5a00077912dadfaeb825cf9367c9e4ffdd06 (patch) | |
tree | e22a4f325da9a48d292716837394fa92f900816e | |
parent | 267f63b9d64ea26ecbb36cf6901492bab8e277d2 (diff) | |
download | rpcblockchainexplorer-f67d5a00077912dadfaeb825cf9367c9e4ffdd06.tar.gz rpcblockchainexplorer-f67d5a00077912dadfaeb825cf9367c9e4ffdd06.zip |
display transactions in each block
-rw-r--r-- | rpcblockchainexplorer/api.py | 9 | ||||
-rw-r--r-- | rpcblockchainexplorer/templates/block.html | 9 |
2 files changed, 16 insertions, 2 deletions
diff --git a/rpcblockchainexplorer/api.py b/rpcblockchainexplorer/api.py index c83ffc2..aedfe83 100644 --- a/rpcblockchainexplorer/api.py +++ b/rpcblockchainexplorer/api.py @@ -198,7 +198,14 @@ def index(): @api.route("/block/<blockhash>") def _getblock(blockhash): block = g.bitcoin_rpc_client._call("getblock", blockhash) - return render_template("block.html", block=block) + + # store txids to be listed separately + txids = block["tx"] + + # don't display txids in the block output + del block["tx"] + + return render_template("block.html", block=block, txids=txids) @api.route("/getblockcount") def _getblockcount(): diff --git a/rpcblockchainexplorer/templates/block.html b/rpcblockchainexplorer/templates/block.html index 4d48f38..06cec4a 100644 --- a/rpcblockchainexplorer/templates/block.html +++ b/rpcblockchainexplorer/templates/block.html @@ -10,5 +10,12 @@ {% endfor %} </table> -block transactions go here +<h3>Transactions</h3> + +<ul> + {% for txid in txids %} + <li><a href="/getrawtransaction/{{ txid }}">{{ txid }}</a></li> + {% endfor %} +</ul> + {% endblock %} |