Get a list of Transactions By Block

Hello,

how can I get the list of the transactions of a block, for example:

{“blockNumber”:“5048261”,“timeStamp”:“1550556487”,“hash”:“0x1240d2a79cdcc09a50a082df1e6f5f21480c15bf78f12cad36368975e6b8fa8f”,“nonce”:“28”,“blockHash”:“0x1089764c8f583f279e3b83d88e947065284c8db5810a81b009844882c338efe7”,“transactionIndex”:“4”,“from”:“0x25beade120e501d7b984498d196efe4abe6a11f6”,“to”:“0xff1d2dc00b36f5008387b8421c7665c40dfe13d2”,“value”:“53500000000000000”,“gas”:“21000”,“gasPrice”:“12000000000”,“isError”:“0”,“txreceipt_status”:“1”,“input”:“0x”,“contractAddress”:"",“cumulativeGasUsed”:“395668”,“gasUsed”:“21000”,“confirmations”:“2536328”},
{“blockNumber”:“5048261”,“timeStamp”:“1549009907”,“hash”:“0xd8ba46005aca13b14afa252120f195e33da7b066769d5f8789c4802d3de1356a”,“nonce”:“1”,“blockHash”:“0xafbad28c398ccfa83cb37f4f94cb7ef1d9c032d5ac0592fb0f15c3623965d815”,“transactionIndex”:“1”,“from”:“0x25beade120e501d7b984498d196efe4abe6a11f6”,“to”:“0x58ec4559522f96b11c994e64f3d5f6a87a688cc5”,“value”:“0”,“gas”:“7600000”,“gasPrice”:“40000000000”,“isError”:“1”,“txreceipt_status”:“0”,“input”:“0xa9059cbb00000000000000000000000051eddf54821c8bc93edfc04b6fa4b04666316f5d000000000000000000000000000000000000000000000000000000003b9aca00”,“contractAddress”:"",“cumulativeGasUsed”:“81938”,“gasUsed”:“24174”,“confirmations”:“2649722”}, etc.

if possible also for internal tx
Thank You

Hi @brincy, you can use the getBlockByHash or getBlockByNumber RPC methods described here: https://infura.io/docs/ethereum/json-rpc/eth_getBlockByHash . Both return an array of all transaction hashes, and then you can call getTransactionByHash to get the tx data.

Are you using a web3 library to get this data?

Infura does not currently support getting the internal tx, though we are working on that feature.