1
0
mirror of https://github.com/bitcoinbook/bitcoinbook synced 2024-11-22 16:18:11 +00:00
bitcoinbook/code/rpc_example.py

11 lines
267 B
Python
Raw Normal View History

2016-02-05 02:52:15 +00:00
from bitcoin.rpc import RawProxy
# Create a connection to local Bitcoin Core node
p = RawProxy()
# Run the getblockchaininfo command, store the resulting data in info
info = p.getblockchaininfo()
2016-02-05 02:52:15 +00:00
# Retrieve the 'blocks' element from the info
print(info['blocks'])