Open
Description
Background
Currently, Ethereum provides the eth_simulateV1
method, which allows developers to simulate transactions before broadcasting them. This is useful for estimating gas usage, detecting potential reverts, and debugging smart contract interactions. However, Tron Protocol does not currently support this method, which limits the ability of developers to perform pre-execution checks efficiently.
Rationale
Why should this feature exist?
- Enhances developer experience by allowing transaction simulation before execution.
- Reduces the risk of failed transactions due to insufficient resources or contract failures.
- Aligns Tron’s JSON-RPC API with Ethereum’s, improving compatibility for developers building cross-chain applications.
What are the use-cases?
- Gas and Energy Estimation: Developers can estimate energy consumption and fees before executing a transaction.
- Smart Contract Debugging: Allows developers to test interactions with contracts without submitting real transactions.
- Transaction Outcome Prediction: Helps applications check whether a transaction will succeed before submitting it to the network.
Specification
The eth_simulateV1
method should be implemented in the Tron JSON-RPC API, following Ethereum’s standard behavior. The method should:
- Accept transaction input parameters similar to
eth_call
. - Return execution results, including status, logs, and estimated energy used.
- Handle different contract call scenarios, including internal calls and delegate calls.
- Provide error messages if the transaction would fail.
Scope Of Impact
- Requires changes to the Tron JSON-RPC API.
- May require modifications to the execution engine to provide accurate simulation results.
- No backward compatibility issues, as this is a new method.
Metadata
Metadata
Assignees
Type
Projects
Status
Backlog