I’m trying to get details of all the transactions for an entire block. The details I need are:
- sending address
- receiving address
- transaction amount
- transaction hash
The way I am currently doing it is:
- eth_getBlockByNumber: This gives me an array of the transactions, but only the hash of each transaction.
- eth_getTransactionByHash: Call this for each transaction in the block.
If the block has 100 transactions, I am making 101 calls, which seems very inefficient and often leads me to hit rate limits. Is there a more efficient way of doing this?
Good news! You can do this in one call, you just need to set the
SHOW TRANSACTION DETAILS FLAG to True, outline in the docs here, https://infura.io/docs/ethereum/json-rpc/eth_getBlockByNumber
oh wow. Don’t know how I missed that. Thanks, that helps me a lot.
…I just went back to my code. It’s because I’m using Nethereum, so the calls are a little different. I see it now.
Thanks for the help
Hi @mike - One other field I require is status of the transaction. I need to know if this transaction was successful or a failure. Is there any way to get that information from the Transaction object? Or must I do a " eth_getTransactionReceipt" call for each transaction?
Correct you need to check the transaction receipt for the transaction to determine if it succeeded or failed. The transaction object is merely the input.