April 2020
Intermediate to advanced
244 pages
7h 20m
English
We'll now see an example script that fetches information pertaining to a blockchain's block:
from bloxplorer import bitcoin_testnet_explorer blk_id = "00000000000001bcfbd6242711752c6d8eb15701eb19e410a39a45fa363926e9" block = bitcoin_testnet_explorer.blocks.get(blk_id) print("Block ID: ", block.data['id']) print("Merkle tree root: ", block.data['merkle_root']) print("Previous block hash: ", block.data['previousblockhash']) print("Block timestamp: ", block.data['timestamp'])
Upon launching the script, this will be its outcome:
Block ID : 00000000000001bcfbd6242711752c6d8eb15701eb19e410a39a45fa363926e9 Merkle tree root :55cdb5be1689027c81c9bf8731c05f955be49eece5639d99ad95ccbf9374cada Previous block hash : 00000000000001 ...
Read now
Unlock full access