Digine-Labs / rosettanet

Ethereum <> Starknet RPC middleware.
MIT License
34 stars 26 forks source link

feat: Implement trace_block #188

Open Boreas09 opened 2 months ago

Boreas09 commented 2 months ago

Get trace information about all the transactions in a given block. This can be useful for debugging purposes or for analyzing the behavior of a blockchain.

Parameters :

Returns :

A list of calls to other contracts containing one object per call, in transaction execution order.

Request :

curl https://mainnet.infura.io/v3/YOUR-API-KEY \
  -X POST \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","method":"trace_block","params":["0x6"],"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"
    },
    {
      "action": {
        "address": "0x0020000000000000000000000000000000000000",
        "balance": "0x300",
        "refundAddress": "0x0000000000000999000000000000000000000000"
      },
      "blockHash": "0x71512d31e18f828cef069a87bc2c7514a8ca334f9ee72625efdf5cc2d43768dd",
      "blockNumber": 6,
      "result": null,
      "subtraces": 0,
      "traceAddress": [0],
      "transactionHash": "0x91eeabc671e2dd2b1c8ddebb46ba59e8cb3e7d189f80bcc868a9787728c6e59e",
      "transactionPosition": 0,
      "type": "suicide"
    },
    {
      "action": {
        "author": "0x0000000000000000000000000000000000000000",
        "rewardType": "block",
        "value": "0x1bc16d674ec80000"
      },
      "blockHash": "0x71512d31e18f828cef069a87bc2c7514a8ca334f9ee72625efdf5cc2d43768dd",
      "blockNumber": 6,
      "result": null,
      "subtraces": 0,
      "traceAddress": [],
      "transactionHash": null,
      "transactionPosition": null,
      "type": "reward"
    }
  ],
  "id": 1
}

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

/rosettanet/docs/methodsStatus.md

methodsStatus.md

Iwueseiter commented 2 months ago

Hi @Boreas09 can I work on this?

ermvrs commented 2 months ago

Need deep search about it, similar like simulate transaction. I remember there is something exist on starknet but I'm not sure can we fit that into this.

Boreas09 commented 1 month ago

use starknet_traceBlockTransactions