有没有一种简单的方法可以使用Python访问记录在某个特定区块高度的比特币区块中的所有交易?

我想以一定的块高检索一个块内的所有事务,而无需运行完整的节点或下载几GB的数据。

Not sticking to Python, tried to use the Block Height section of this. Following the example given there,

https://blockchain.info/block-height/$100?format=json

返回:

Invalid Numerical Value

有没有简单的Pythonic方法可以做到这一点?

评论
糖长老
糖长老

You have to use without $ which was only information that $block_height is not part of url but variable which you have to replace,

https://blockchain.info/block-height/100?format=json
import requests

r = requests.get('https://blockchain.info/block-height/100?format=json')
data = r.json()

#print(r.text)
#print(data)
print(data['blocks'][0]['hash'])
点赞
评论