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

feat: Implement trace_transaction #189

Open
Boreas09 opened this issue Aug 21, 2024 · 2 comments
Open

feat: Implement trace_transaction #189

Boreas09 opened this issue Aug 21, 2024 · 2 comments
Assignees

Comments

@Boreas09
Copy link
Member

Provides transaction processing of type trace for the specified transaction. Use this API to improve smart contract performance by analyzing its internal transactions and execution steps. You can use this information to identify bottlenecks and optimize the contract for better performance.

Parameters :

transaction hash: [Required] The transaction hash

Returns :

A list of traces in the order called by the transaction.

Request :

curl https://mainnet.infura.io/v3/YOUR-API-KEY \
  -X POST \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc": "2.0", "method": "trace_transaction","params": ["0x4c253746668dca6ac3f7b9bc18248b558a95b5fc881d140872c2dff984d344a7"],"id": 1}'

Response :

{
    "jsonrpc": "2.0",
    "result": [
      {
        "action": {
          "callType": "call",
          "from": "0xfe3b557e8fb62b89f4916b721be55ceb828dbd73",
          "gas": "0xffad82",
          "input": "0x0000000000000000000000000000000000000999",
          "to": "0x0020000000000000000000000000000000000000",
          "value": "0x0"
        },
        "blockHash": "0x71512d31e18f828cef069a87bc2c7514a8ca334f9ee72625efdf5cc2d43768dd",
        "blockNumber": 6,
        "result": {
          "gasUsed": "0x7536",
          "output": "0x"
        },
        "subtraces": 1,
        "traceAddress": [],
        "transactionHash": "0x91eeabc671e2dd2b1c8ddebb46ba59e8cb3e7d189f80bcc868a9787728c6e59e",
        "transactionPosition": 0,
        "type": "call"
      },
}

DO NOT FORGET TO UPDATE methodsStatus.md (set this method as finished)

/rosettanet/docs/methodsStatus.md

methodsStatus.md

@Boreas09
Copy link
Member Author

This rpc-call can be fit to starknet_simulateTransactions. In ethereum call we just need to give a transaction hash. With that transaction hash we can call eth_getTransactionByHash and take values we need. Convert it to starknet and call starknet_simulateTransactions with simulation flags of SKIP_VALIDATE, SKIP_FEE_CHARGE. Finally convert starknet response to ethereum response. Return response.

@Boreas09 Boreas09 self-assigned this Sep 5, 2024
@Digine-Labs Digine-Labs deleted a comment from ooochoche Sep 19, 2024
@Digine-Labs Digine-Labs deleted a comment from ooochoche Sep 19, 2024
@Boreas09
Copy link
Member Author

The method trace_transaction is not available in Infura.

Screenshot_1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant