This repository was archived by the owner on Jun 3, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 175
This repository was archived by the owner on Jun 3, 2022. It is now read-only.
eth_simulateTransaction #8
Copy link
Copy link
Open
Description
summary
eth_simulateTransaction
should be introduced to replace eth_call
and eth_estimateGas
eth_simulateTransaction
can provide information including:
- return value
- gas consumption
- if an error was thrown
This helps solve the problem of trying to differentiate between correct response and error response with eth_call
and eth_estimateGas
spec
eth_simulateTransaction
Executes a new message call without creating a transaction on the block chain.
Parameters
Object
- The transaction call object
from
:DATA
, 20 Bytes - (optional) The address the transaction is sent from.to
:DATA
, 20 Bytes - The address the transaction is directed to.gas
:QUANTITY
- (optional) Integer of the gas provided for the transaction execution. eth_call consumes zero gas, but this parameter may be needed by some executions.gasPrice
:QUANTITY
- (optional) Integer of the gasPrice used for each paid gasvalue
:QUANTITY
- (optional) Integer of the value send with this transactiondata
:DATA
- (optional) Hash of the method signature and encoded parameters. For details see Ethereum Contract ABI
QUANTITY|TAG
- integer block number, or the string"latest"
,"earliest"
or"pending"
, see the default block parameter
Returns
Object
- A transaction summary object
returnValue
:DATA
, 32 Bytes - hash of the transaction.gasUsed
:QUANTITY
- The amount of gas used by this specific transaction alone.contractAddress
:DATA
, 20 Bytes - The contract address created, if the transaction was a contract creation, otherwisenull
.logs
:Array
- Array of log objects, which this transaction generated.errorCode
:null
orstring
- (needs spec) Whether or not an error such as a top-level OOG, invalid jump, or other vm-halting error occurred. Code should indicate the status in this way:- (successful)
- out of gas
- stack overflow
- stack underflow
- invalid jump (no JUMPDEST present)
- invalid instruction
- possibly the INVALID instruction could have its own code
- stop by REVERT
Example
// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_simulateTransaction","params":[{"to": "0xCD111aa492a9c77a367C36E6D6AF8e6f212E0C8E"}],"id":1}'
// Result
{
"id":1,
"jsonrpc": "2.0",
"result": {
"returnValue": "0x4242",
"gasUsed": "0x5208",
"contractAddress": null,
"logs": [],
"errorCode": null
}
}
pipermerriam, adridadou, Georgi87, simondlr, aemaeth-me and 7 moreftm1337
Metadata
Metadata
Assignees
Labels
No labels