go-ethereum icon indicating copy to clipboard operation
go-ethereum copied to clipboard

internal/ethapi: add GetTransactionReceiptsByBlockNumber

Open tursom opened this issue 2 years ago • 3 comments

This api due to accelerate exeplorer indexer service by batch query transation receipts.

Example on goerli testnet:

> eth.getTransactionReceiptsByBlockNumber("0x6e5471")
[{
    blockHash: "0x7b3d1ff3e97e1f135518ebf41ba9da351f3bedd2e019684d774d30a3ba5ddd56",
    blockNumber: "0x6e82f4",
    contractAddress: null,
    cumulativeGasUsed: "0x8b4e",
    from: "0xd05526a73bf45dadf7f9a99dcceac23c2d43c6c7",
    gasUsed: "0x8b4e",
    logs: [],
    logsBloom: "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000",
    status: "0x0",
    to: "0xf5de760f2e916647fd766b4ad9e85ff943ce3a2b",
    transactionHash: "0x5dc80d36bb9c446025c31c68b6d828bdc16bff636c134cc4c7a85deca6280287",
    transactionIndex: "0x0"
}]

tursom avatar Jul 17 '22 15:07 tursom

Posting the graphql query to get this data for anyone who needs it until this API method goes through the process:

{
  block {
    number
    hash
    logsBloom
    transactions {
      hash
      index
      status
      cumulativeGasUsed
      logs { topics }
      from { address }
      to { address }
    }
  }
}

s1na avatar Jul 18 '22 08:07 s1na

Posting the graphql query to get this data for anyone who needs it until this API method goes through the process:

{
  block {
    number
    hash
    logsBloom
    transactions {
      hash
      index
      status
      cumulativeGasUsed
      logs { topics }
      from { address }
      to { address }
    }
  }
}

thanks for remind. I will add it later

tursom avatar Jul 19 '22 17:07 tursom

@tursom sorry I somehow missed your comment. No you don't need to add anything graphql related to the PR. The graphql already supports what you want to do. You can try by pasting the query I shared in the graphiql interface.

s1na avatar Aug 08 '22 13:08 s1na