Skip to content

Instantly share code, notes, and snippets.

@bh2smith
Last active July 5, 2023 18:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bh2smith/55ff4ac773243836da85ead37c74cd92 to your computer and use it in GitHub Desktop.
Save bh2smith/55ff4ac773243836da85ead37c74cd92 to your computer and use it in GitHub Desktop.
Elementary EVM RPC Requests

Curl Requests made as follows JSON files will be provided per section

 export ARCHIVE_NODE_URL=
 export JSON_FILE_PATH=
curl $ARCHIVE_NODE_URL -X POST -H "Content-Type: application/json" --data $JSON_FILE_PATH | jq

Transaction Receipt (for Logs)

Use JSON_FILE_PATH=@receipt_request.json

with file

{
  "method": "eth_getTransactionReceipt",
  "params": [
    "0x1231f2c9b519adc5ae7db17c84418e140553e234b2868d6b1d7f66a692683e73"
  ],
  "id": 1,
  "jsonrpc": "2.0"
}
  • This does not require an archive node.

Get Transaction By Hash (used for decode input data)...

Just replace eth_getTransactionReceipt with eth_getTransactionByHash from the previous example and decode input field from the response.

ETH Balances Differences by Tx (read from traces)

Snippet partially borrowed from here

With the file JSON_FILE_PATH=trace_request.json

{
  "method": "trace_replayTransaction",
  "params": [
    "0x8e5cd4d97881b558b7c4a120c41193b944db0612bc45807ae056d5488b82700e",
    [
      "stateDiff"
    ]
  ],
  "id": 1,
  "jsonrpc": "2.0"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment