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

RPC: "eth_getTransactionByHash" returns a transaction with empty blockHash and blockNumber #608

Closed
frozeman opened this issue Mar 31, 2015 · 5 comments
Labels

Comments

@frozeman
Copy link
Contributor

sending:

{"jsonrpc":"2.0","method":"eth_getTransactionByHash","params":["0x99ab199e1f1ab9d5a08373c4e693d5a71a3ac65d52da5430581ed8b74d5b940a"],"id":4540}

Returns me the transaction but with the following blockHash, blockNumber and transactionIndex (?):

{
    "id": 4540,
    "jsonrpc": "2.0",
    "result": {
        "hash": "0x99ab199e1f1ab9d5a08373c4e693d5a71a3ac65d52da5430581ed8b74d5b940a",
        "nonce": "0x0",
        "blockHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
        "blockNumber": "0x0",
        "transactionIndex": "0x0",
        "from": "0x8b09e3535d27ad599d984fd63b1578b6f068f01b",
        "to": "0x8b09e3535d27ad599d984fd63b1578b6f068f01b",
        "value": "0x2710",
        "gas": "0x0186a0",
        "gasPrice": "0x015f90",
        "input": "0x0"
    }
}

The transactions are correctly returned using eth_getTransactionByBlockHashAndIndex and when inside a block with eth_getBlock and second parameter true.

@frozeman
Copy link
Contributor Author

For you taylor: I would expect it to look like this:

{
    "id": 4541,
    "jsonrpc": "2.0",
    "result": {
        "hash": "0x99ab199e1f1ab9d5a08373c4e693d5a71a3ac65d52da5430581ed8b74d5b940a",
        "nonce": "0x0",
        "blockHash": "0xf447117e1b694ffbeeb43dbe2160549e30adf5da0b8250f9357038c51b907dcd",
        "blockNumber": "0x02de",
        "transactionIndex": "0x0",
        "from": "0x8b09e3535d27ad599d984fd63b1578b6f068f01b",
        "to": "0x8b09e3535d27ad599d984fd63b1578b6f068f01b",
        "value": "0x2710",
        "gas": "0x0186a0",
        "gasPrice": "0x015f90",
        "input": "0x0"
    }
}

@frozeman
Copy link
Contributor Author

additionally should input be 0x according to https://github.com/ethereum/wiki/wiki/JSON-RPC#output-hex-values

@frozeman
Copy link
Contributor Author

and if the tx is pending blockNumber, blockHash and transactionIndex should be null

@tgerring
Copy link
Contributor

The missing values are due to the block context being unavailable at the "transaction" level. In the case of eth_getTransactionByBlockHashAndIndex and eth_getBlock, the block is known and details can be added to the transaction.

Somehow, the RPC needs to be able to look up a transaction hash and return the block number it is contained in. This information can be then added to the output.

@tgerring tgerring mentioned this issue Mar 31, 2015
6 tasks
tgerring added a commit to tgerring/go-ethereum that referenced this issue Mar 31, 2015
Improving this in the future will allow for cleaning up a bit of legacy
code.
@frozeman frozeman added the RPC label Apr 1, 2015
@tgerring
Copy link
Contributor

tgerring commented Apr 1, 2015

@frozeman does this still occur after commit 86ba743?

tony-ricciardi pushed a commit to tony-ricciardi/go-ethereum that referenced this issue Jan 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants