Created
August 17, 2017 19:41
-
-
Save bogatyy/cd9ed0506a88866e25879afdb4830a05 to your computer and use it in GitHub Desktop.
Downloads transaction info using Ethereum client API in Python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ pip install requests | |
$ python | |
import json | |
import requests | |
def get_transaction(tx_hash): | |
url = 'http://localhost:8545' | |
headers = {'content-type': 'application/json'} | |
request = { | |
'jsonrpc': '2.0', 'id': 1, | |
'method': 'eth_getTransactionByHash', | |
'params': [tx_hash] | |
} | |
return requests.post( | |
url, data=json.dumps(request), headers=headers).json() | |
print get_transaction('0x314e0246cfc55bc0882cbf165145c168834e99924e3ff7619ebd8290e713386d') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment