有没有一种简单的方法可以使用 Python 访问记录在具有特定区块高度的比特币区块中的所有交易?
Is there an easy way to access all transactions recorded in a bitcoin block with certain block height using Python?
我想在没有 运行 完整节点或下载几 GB 数据的情况下检索具有特定区块高度的区块内的所有交易。
不坚持 Python,尝试使用 this 的 Block Height
部分。按照那里给出的例子,
https://blockchain.info/block-height/0?format=json
returns:
Invalid Numerical Value
有没有简单、Pythonic 的方法来做到这一点?
你必须在没有 $
的情况下使用,这只是 $block_height
不是 url 的一部分的信息,而是你必须替换的变量,
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'])
我想在没有 运行 完整节点或下载几 GB 数据的情况下检索具有特定区块高度的区块内的所有交易。
不坚持 Python,尝试使用 this 的 Block Height
部分。按照那里给出的例子,
https://blockchain.info/block-height/0?format=json
returns:
Invalid Numerical Value
有没有简单、Pythonic 的方法来做到这一点?
你必须在没有 $
的情况下使用,这只是 $block_height
不是 url 的一部分的信息,而是你必须替换的变量,
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'])