diff options
-rw-r--r-- | rpcblockchainexplorer/api.py | 7 | ||||
-rw-r--r-- | rpcblockchainexplorer/templates/transaction.html | 4 |
2 files changed, 11 insertions, 0 deletions
diff --git a/rpcblockchainexplorer/api.py b/rpcblockchainexplorer/api.py index aedfe83..d759e04 100644 --- a/rpcblockchainexplorer/api.py +++ b/rpcblockchainexplorer/api.py @@ -207,6 +207,13 @@ def _getblock(blockhash): return render_template("block.html", block=block, txids=txids) +@api.route("/transaction/<txid>") +def _transaction(txid): + transaction = g.bitcoin_rpc_client._call("getrawtransaction", b2x(x(txid)), 1) + blockhash = transaction["blockhash"] + del transaction["blockhash"] + return render_template("transaction.html", transaction=transaction, blockhash=blockhash) + @api.route("/getblockcount") def _getblockcount(): blockcount = g.bitcoin_rpc_client.getblockcount() diff --git a/rpcblockchainexplorer/templates/transaction.html b/rpcblockchainexplorer/templates/transaction.html index 2cd67c8..dde57ed 100644 --- a/rpcblockchainexplorer/templates/transaction.html +++ b/rpcblockchainexplorer/templates/transaction.html @@ -2,6 +2,10 @@ {% block content %} <table> + <tr> + <th>block</th> + <td><a href="/block/{{ blockhash }}">{{ blockhash }}</a></td> + </tr> {% for key_name in transaction.keys() %} <tr> <th>{{ key_name }}</th> |