Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add eth_getReceipt method to the RPC #1042

Closed
frozeman opened this issue May 19, 2015 · 10 comments
Closed

add eth_getReceipt method to the RPC #1042

frozeman opened this issue May 19, 2015 · 10 comments

Comments

@frozeman
Copy link
Contributor

We need a way to retrieve receipts. Jeff and i came up with the following solution:

Method: eth_getReceipt
Param 1: Tx hash, e.g. ['0x12345..']
Result:

{
   transactionHash: '0x432423...',
   transactionIndex:  '0x1', // 1
   blockNumber: '0xb', // 11
   blockHash: ‘0x34243653...,
   cumulativeGasUsed: '0x33bc', // 13244
   gasUsed: '0x4dc', // 1244
   contractAddress: '0x12345678765432567898765432' // or null, if none was created
   logs: [{
       // logs as returned by getFilterLogs, etc.
   }, ...]
}

Internally we have to calculate the gasUsed through subtracting the previous cumulativeGasUsed with the one of the current receipt, e.g. receipts[1].cumulativeGasUsed - receipts[0].cumulativeGasUsed

@obscuren
Copy link
Contributor

During block processing we need to keep track of additional information:

  • gas usage (receipt[i-1].cumulativeGasUsed - receipt[i].cumulativeGasUsed)
  • block hash
  • tx hash
  • tx index
  • block num

This requires:

  1. storing receipts as []*receipt with receipts-H(block) as key
  2. storing individual *receipt with receipt-H(tx) as key but only for the canonical block chain (i.e. when chainManager.insert is called.

@zsfelfoldi
Copy link
Contributor

#1049

@frozeman
Copy link
Contributor Author

@zsfelfoldi is this already implemented according to the specs above?

@obscuren people would love to have the created contract address in here too, as at this point it should be clear.

@tgerring
Copy link
Contributor

tgerring commented Jul 2, 2015

@frozeman Can you add this method to the JSON RPC wiki?

@frozeman
Copy link
Contributor Author

frozeman commented Jul 2, 2015

I would do this after its implemented and tested.

obscuren added a commit to obscuren/go-ethereum that referenced this issue Jul 4, 2015
* Added GetReceiptsFromBlock, GetReceipt, PutReceipts
* Added ContractAddress to receipt. See ethereum#1042
@tgerring
Copy link
Contributor

tgerring commented Jul 4, 2015

Linked PR current status below. Logs are not being set, but all other fields should be accurate

$ curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getTransactionReceipt","params":["0x875912c3a928059bf81416e6358a604f13bb5f6c59d5374348a38e09bb2e397a"],"id":1}' http://127.0.0.1:8545
{
    "id": 1,
    "jsonrpc": "2.0",
    "result": {
        "TransactionHash": "0x875912c3a928059bf81416e6358a604f13bb5f6c59d5374348a38e09bb2e397a",
        "TransactionIndex": "0x0",
        "BlockNumber": "0xa",
        "BlockHash": "0x2889bd97678178467634c8391358a1a7967f48e3b056904cf2ecbf1c43e77dd7",
        "CumulativeGasUsed": "0x5208",
        "GasUsed": "0x15f90",
        "ContractAddress": null,
        "Logs": null
    }
}

@frozeman
Copy link
Contributor Author

frozeman commented Jul 4, 2015

I think logs should always be an array (so even an empty array), so that it is the same behaviour as getBlock

@frozeman
Copy link
Contributor Author

frozeman commented Jul 4, 2015

But looks good so far 👍

@nmushegian
Copy link

Are event filters not going to work for frontier launch??

@frozeman
Copy link
Contributor Author

That is fixed and should be closed. And Event filters work since a very long while already ;)

tony-ricciardi pushed a commit to tony-ricciardi/go-ethereum that referenced this issue Jan 20, 2022
### Description

Out README is currently out of date and does not include much information about getting started. This PR includes more pointers to the docs along with updated information.
maoueh pushed a commit to streamingfast/go-ethereum that referenced this issue Nov 16, 2023
Olexandr88 pushed a commit to Olexandr88/taiko-geth that referenced this issue Oct 1, 2024
…thereum#1042)

* feat(tx pool): fast reject transactions that cannot fit into a block

* add a TestValidateTxBlockSize unit test

* chore: auto version bump [bot]

---------

Co-authored-by: colinlyguo <colinlyguo@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants