Skip to content

Field to is missing in eth_getTransactionByHash when a contract creation transaction reverts #4413

@acuarica

Description

@acuarica

Description

After sending a contract creation transaction that does not return any bytecode and revert, the field to is missing in the corresponding eth_getTransactionByHash RPC call.

Steps to reproduce

This example uses Foundry's cast to send a transaction to the network.

(set the PRIVATE_KEY variable to your private key for the chosen network, testnet in this example)

$ cast send -v --rpc-url https://testnet.hashio.io/api --private-key $PRIVATE_KEY --gas-limit 1000000 --gas-price 710000000000 --legacy --create 0x600160015560006000fd blockHash 0xba0a4feca69ccd60b10dcb4eb95691bd31cbdc80a9fe7f79eecc8152cfbdf5fe blockNumber 25348064 contractAddress cumulativeGasUsed 800000 effectiveGasPrice 380000000000 from 0xa3612A87022a4706FC9452C50abd2703ac4Fd7d9 gasUsed 800000 logs [] logsBloom 0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 root status 0 (failed) transactionHash 0x6482f81f267f00be9c021568a1a8bdbd4abd034bc36451c284ad020928dcbb15 transactionIndex 4 type 0 blobGasPrice blobGasUsed revertReason 12408 root 39309028074332508661983559455579427211983204215636056653337583610388178777121 revertReason CONTRACT_REVERT_EXECUTED, data: "0x"

Note

The bytecode 0x600160015560006000fd sent in the transaction corresponds to the following disassembled opcodes

PUSH1 01 PUSH1 01 SSTORE PUSH1 00 PUSH1 00 REVERT 

which translates to the following Yul code

sstore(1, 1) revert(0, 0)

Here is the transaction in Hashscan https://hashscan.io/testnet/transaction/1758742034.663184359/result.

Then, the eth_getTransactionByHash method call returns a transaction but without the to field

$ curl --request POST \  --url https://testnet.hashio.io/api \  --header 'content-type: application/json' \  --data '{ "method": "eth_getTransactionByHash", "id": 1, "jsonrpc": "2.0", "params": [  "0x6482f81f267f00be9c021568a1a8bdbd4abd034bc36451c284ad020928dcbb15"  ] }' | jq {  "result": {  "blockHash": "0xba0a4feca69ccd60b10dcb4eb95691bd31cbdc80a9fe7f79eecc8152cfbdf5fe",  "blockNumber": "0x182c7e0",  "chainId": "0x128",  "from": "0xa3612a87022a4706fc9452c50abd2703ac4fd7d9",  "gas": "0xc3500",  "gasPrice": "0xa54f4c3c00",  "hash": "0x6482f81f267f00be9c021568a1a8bdbd4abd034bc36451c284ad020928dcbb15",  "input": "0x600160015560006000fd",  "nonce": "0x522",  "r": "0xcd7d9d5648c85f2d4ca54c27163abdbc7bcd8726f6ca4798ee10fee5b027cefa",  "s": "0x348182de2e952a47a4bcd16f5a099042f4042ee4340da31a4c0068f35abaf60c",  "transactionIndex": "0x4",  "type": "0x0",  "v": "0x274",  "value": "0x0"  },  "jsonrpc": "2.0",  "id": 1 }

Additional context

No response

Hedera network

testnet

Version

v0.71.0

Operating system

macOS

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions