I'm trying to understand how to convert my transaction data into the id hash before signing the transaction.

Let's say I have this data:

transaction = {
    'to': to_address,
    'from': from_address,
    'value': 4200000000000000,
    'gas': 21000,
    'gasPrice': 22000000000,
    'chainId': 1,
    'nonce': '0x0'

How can I convert this into the id hash?


Are you looking for the transaction hash that most web3 APIs use, like w3.eth.getTransaction(transaction_hash)?

That transaction hash is generated from the signed and rlp-encoded transaction. There isn't a way to predict the final transaction hash without signing it.

  • Thanks @carver. That's what I suspected. I'm using BlockCypher today and it looks they do provide this hash. I'll double-check it now. – Avi Sep 26 '18 at 9:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.