Skip to content

Commit

Permalink
Adding Arbitrum
Browse files Browse the repository at this point in the history
  • Loading branch information
productshiv committed Apr 5, 2024
1 parent 76d5015 commit ce6b7ef
Show file tree
Hide file tree
Showing 45 changed files with 3,063 additions and 0 deletions.
9 changes: 9 additions & 0 deletions v1.0/RPC Nodes/rpc-evm/rpc-arbitrum.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
title: "Arbitrum"
slug: "rpc-arbitrum"
excerpt: ""
category: 65c5e93c623cad004b45d505
hidden: false
createdAt: "Wed Mar 06 2024 10:35:18 GMT+0000 (Coordinated Universal Time)"
updatedAt: "Wed Mar 06 2024 13:09:53 GMT+0000 (Coordinated Universal Time)"
---
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
---
title: "debug_storageRangeAt"
slug: "rpc-ethereum-debug_storagerangeat"
excerpt: "Ethereum RPC"
category: 65c5e93c623cad004b45d505
hidden: false
metadata:
description: "Ethereum RPC"
image: []
keywords: "ethereum, rpc"
robots: "index"
createdAt: "Wed Mar 06 2024 10:35:44 GMT+0000 (Coordinated Universal Time)"
updatedAt: "Tue Apr 02 2024 08:40:59 GMT+0000 (Coordinated Universal Time)"
---
[block:html]{"html":"<div style=\"padding: 10px 20px; border-radius: 5px; background-color: #e6e2ff; margin: 0 0 30px 0;\">\n <h5>Archive Method</h5>\n <p>Only on the full archive nodes. Complex queries might take longer and incur additional cost</p>\n</div>"}[/block]

## Overview

`debug_storageRangeAt` is an RPC method that allows you to retrieve the contract storage range for a given block and address. This can be useful for developers and auditors who want to inspect the storage state of a specific contract at a particular point in time. This method can also help in debugging and identifying potential issues with contract storage, as well as understanding how storage evolves as transactions are executed.

## Parameters

| Name | Type | Required | Description |
| :-------------------- | :------------ | :------- | :---------------------------------------------------------------------------------- |
| blockHash/blockNumber | string/object | yes | The block hash in string format or block number as hexadecimal in the object format |
| txIndex | integer | yes | The transaction index for the point in which we want the list of accounts |
| address | string | yes | The contract address |
| startKey | string | yes | The offset (hash of storage key) |
| limit | string | yes | The number of storage entries to return |

## Returns

- **Storage** - An object with hash values, and for each of them the key and value it represents.
- **hash** - The hash value.
- **key** - The key associated with the hash.
- **value** - The value associated with the hash.
- **nextkey** - The hash of next key if further storage in range. Otherwise, not included.

## Request Example

```json cURL
curl --location 'https://api.tatum.io/v3/blockchain/node/ethereum-mainnet/' \
--header 'Content-Type: application/json' \
--header 'x-api-key: {API_KEY}' \
--data '{
"jsonrpc":"2.0",
"method":"debug_storageRangeAt",
"params":[
"0xe9793319714333112d41473d33bc06556b6d32d347517b782eb1cdaec296a20b",
5,
"0xdAC17F958D2ee523a2206206994597C13D831ec7",
"0x00000000000000000000000000000000",
2
],
"id":1
}'
```
```javascript JS SDK
// yarn add @tatumio/tatum

import { TatumSDK, Ethereum, Network } from '@tatumio/tatum'

const tatum = await TatumSDK.init<Ethereum>({network: Network.ETHEREUM})

const result = await tatum.rpc.debugStorageRangeAt(
'0x48dfcf43404dffdb3b93a0b0d9982b642b221187bc3ed5c023bdab6c0e863e3d',
1, '0xa41d19F4258a388c639B7CcD938FCE3fb7D05e86', "0x0000000000000000000000000000000000000000000000000000000000000000", 1)

await tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
---
title: "debug_traceBlockByHash"
slug: "rpc-ethereum-debug_traceblockbyhash"
excerpt: "Ethereum RPC"
category: 65c5e93c623cad004b45d505
hidden: false
metadata:
image: []
keywords: "Ethereum, rpc"
robots: "index"
createdAt: "Mon Mar 18 2024 13:51:30 GMT+0000 (Coordinated Universal Time)"
updatedAt: "Tue Apr 02 2024 08:41:16 GMT+0000 (Coordinated Universal Time)"
---
[block:html]{"html":"<div style=\"padding: 10px 20px; border-radius: 5px; background-color: #e6e2ff; margin: 0 0 30px 0;\">\n <h5>Archive Method</h5>\n <p>Only on the full archive nodes. Complex queries might take longer and incur additional cost</p>\n</div>"}[/block]

## Overview

`debug_traceBlockByHash`method allows developers to trace the execution of transactions within a block specified by its hash. This method is particularly useful for debugging purposes, as it provides detailed information about the execution of each transaction within the block, including the type of call, the addresses involved, the value transferred, the gas used, the input data, the output data, and any sub-calls made during the transaction.

## Parameters

### 1.blockHash (required)

A string representing the hash of the block to be traced.

### 2.tracer (required)

An object that specifies the tracer to use for the transaction trace, one of the following:

| Name | Type | Required | Description |
| :------------- | :----- | :------- | :--------------------------------------------------------------------------------------------------- |
| callTracer | string | Yes | Tracks all call frames generated during a transaction, including those at depth 0. |
| prestateTracer | string | Yes | Replays the transaction and monitors every aspect of the state that occurred throughout the process. |

### tracerConfig

An object that allows specifying configurations for the tracer:

| Name | Type | Required | Description |
| :---------- | :------ | :------- | :------------------------------------------------------------------------------ |
| onlyTopCall | boolean | Yes | A boolean indicating whether to trace only the top-level call or all sub-calls. |

## Returns

`callTracer` response

| Name | Description |
| :---------------- | :------------------------------------------------------------------------------------------------------------------------- |
| type of the call | The type of the call. |
| from | The address from which the transaction is sent. |
| to | The address to which the transaction is directed. |
| gas | The integer value of the gas used. |
| transaction value | The specific amount deducted from the sender's account per unit of gas consumed. |
| gasUsed | The total gas consumed during the call, represented in hexadecimal format. |
| input | The input data accompanying the transaction, optionally provided, typically utilised for interacting with smart contracts. |
| output | The data returned as output from the transaction. |
| error | The type of error encountered during the transaction, if any. |
| revertReason | The Solidity revert reason, if any. |
| calls | A list of sub-calls made during the transaction's execution. |

`prestateTracer` response

| Name | Description |
| :--------------------- | :------------------------------------------------------------------------------------------------------------------------ |
| smart contract address | The smart contract address linked to the outcome. |
| balance | The balance of the contract , shown in hexadecimal format, and measured in wei. |
| code | The contract's bytecode encoded as a hexadecimal string |
| nonce | The account's nonce connected to the contract, shown as a unsigned integer |
| storage | A collection of pairs showing the storage slots of the contract, with both keys and values encoded in hexadecimal format. |

## Request Example

```curl
curl --location 'https://api.tatum.io/v3/blockchain/node/ethereum-mainnet/' \
--header 'Content-Type: application/json' \
--header 'x-api-key: {API_KEY}' \
--data '{
"method": "debug_traceBlockByHash",
"params": [
"0x97b49e43632ac70c46b4003434058b18db0ad809617bd29f3448d46ca9085576",
{
"tracer": "callTracer"
}
],
"id": 1,
"jsonrpc": "2.0"
}'
```
```javascript JS SDK
// yarn add @tatumio/tatum

import { TatumSDK, Ethereum, Network } from '@tatumio/tatum'

const tatum = await TatumSDK.init<Ethereum>({network: Network.ETHEREUM})

const result = await tatum.rpc.debugTraceBlockByHash(
'0x3c4523b7e8c21e3d68f1c3af3d18e8a87c0d43e35b2c1b7f8f4e87e4d4db9c82',
{
tracer: 'callTracer',
tracerConfig: {
onlyTopCall: true,
timeout: '5s',
}
}
)

await tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs
```
146 changes: 146 additions & 0 deletions v1.0/RPC Nodes/rpc-evm/rpc-arbitrum/rpc-ethereum-debug_tracecall.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
---
title: "debug_traceCall"
slug: "rpc-ethereum-debug_tracecall"
excerpt: "Ethereum RPC"
category: 65c5e93c623cad004b45d505
hidden: false
metadata:
image: []
keywords: "Ethereum, rpc"
robots: "index"
createdAt: "Thu Mar 07 2024 09:21:24 GMT+0000 (Coordinated Universal Time)"
updatedAt: "Tue Apr 02 2024 08:41:05 GMT+0000 (Coordinated Universal Time)"
---
[block:html]{"html":"<div style=\"padding: 10px 20px; border-radius: 5px; background-color: #e6e2ff; margin: 0 0 30px 0;\">\n <h5>Archive Method</h5>\n <p>Only on the full archive nodes. Complex queries might take longer and incur additional cost</p>\n</div>"}[/block]

## Overview

`debug_traceCall` is an Ethereum RPC method that allows you to execute a given call (message), tracing the steps of its execution. This can be helpful for developers and auditors who want to inspect and analyze the internal operations and state changes of a contract call without modifying the blockchain state. This method can assist in debugging and identifying potential issues with contract execution, as well as understanding how gas is consumed during the execution of a call.

## Parameters

### 1. Transaction call object (required)

`object` - The eth_call data

| Name | Type | Required | Description |
| :------- | :------ | :------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| from | string | no | The address the transaction is sent from |
| to | string | yes | The address the transaction is directed to |
| gas | integer | no | The integer of the gas provided for the transaction execution. Although eth_call consumes zero gas, this parameter may still be needed by some executions. |
| gasPrice | integer | no | The integer of the gasPrice used for each paid gas |
| value | integer | no | The integer of the value sent with this transaction |
| data | string | no | The hash of the method signature and encoded parameters. Additional information is available at [Ethereum Contract ABI](https://docs.soliditylang.org/en/v0.7.0/abi-spec.html) |

### 2. Block parameter (required)

- hexadecimal block number
- block hash
- The `Tag` "latest", "earliest", "pending", "safe" or "finalized" "Safe" and "finalized" are only available on Ethereum and Arbitrum One chain. [Ethereum documentation](https://ethereum.org/en/developers/docs/apis/json-rpc/#default-block).

### 3. Trace type (optional)

- ` The type of tracer` - String - It might be `callTracer` or `prestateTracer`
- `callTracer` - The calltracer keeps track of all call frames, including depth 0 calls, that are made during a transaction.
- `prestateTracer` - The prestateTracer replays the transaction and tracks every part of state that occured during the transaction.
- `tracerConfig` - The object to specify the configurations of the tracer
- `onlyTopCall` - When set to true, this will only trace the primary (top-level) call and not any sub-calls. It eliminates the additional processing for each call frame.

#### Additional configuration parameters

- `disableStorage` — when enabled, it prevents tracing of storage changes made by the transaction being analyzed, which can reduce the resource requirements of the analysis. By default, debug_traceTransaction traces both memory and storage changes, but storage tracing can be particularly resource-intensive, especially for large transactions.
- `disableStack` — when enabled, it skips tracing of stack changes made by the transaction being analyzed.
- `disableMemory` — when true, it stops tracing of memory changes made by the transaction being analyzed, reducing resource requirements.
- `disableReturnData` — when true, it prevents the method from tracing the return data of a transaction. This return data tracing can be very demanding on resources, as it requires a lot of time and processing power.
- `timeout` (default: 5s) — allows to customize the method's timeout period for JavaScript-based tracing calls.

> 🚧 When using a tracer type , `disableMemory`, `disableStorage`, `disableStack`, or `disableReturnData` will not have any effect. When no tracer is selected, the response defaults to [Struct/opcode logger](https://geth.ethereum.org/docs/developers/evm-tracing/built-in-tracers#structopcode-logger).
## Returns

`callTracer` response:

| Name | Description |
| :---------------- | :-------------------------------------------------------------------------------------------------------- |
| type of the call | Type of the call |
| from | The transaction sender. |
| to | The address of the transaction recipient. |
| gas | The gas included in the transaction by the sender. |
| transaction value | The actual value per gas deducted from the sender's account. |
| gasUsed | The total used gas by the call. Encoded as hexadecimal. |
| input | The optional input data sent with the transaction, usually used to interact with smart contracts. |
| output | The return value of the call, encoded as a hexadecimal string. |
| error | An error message in case the execution failed. |
| calls | A list of sub-calls made by the contract during the call, each represented as a nested call frame object. |
| revertReason | The reason why the transaction was reverted, returned by the smart contract if any. |

`prestateTracer` response

- `smart contract address` — The address of the smart contract associated with the result.
- `balance` — The balance of the contract, expressed in wei and encoded as a hexadecimal string.
- `code` — The bytecode of the contract, encoded as a hexadecimal string.
- `nonce` — The nonce of the account associated with the contract, represented as an unsigned integer.
- `storage` — A map of key-value pairs representing the storage slots of the contract. The keys and values are both encoded as hexadecimal strings.

`Struct/opcode` response

- `The transaction trace object:`
- `failed` - Successful or failed
- `gas` - The total consumed gas in the transaction
- `returnValue` - The return value of the executed contract call
- `structLogs` - The trace result of each step:
- `pc` - The current index in bytecode.
- `op` - The name of current executing operation.
- `gas` - The available gas in the execution.
- `gasCost` - The gas cost of the operation.
- `depth` - The number of levels of calling functions.
- `stack` - An array of values in the current stack.
- `storage` - The mapping of the current storage.
- `refund` - The total of current refund value.
- `error` - The error of the execution.
- `memory` - An array of values in the current memory.

## Request Example

```json cURL
curl --location 'https://api.tatum.io/v3/blockchain/node/ethereum-mainnet/' \
--header 'Content-Type: application/json' \
--header 'x-api-key: {API_KEY}' \
--data '{
"method":"debug_traceCall",
"params":[{
"to":"0x742d35Cc6634C0532925a3b844Bc454e4438f44e"
},
"latest"
],
"id":1,
"jsonrpc":"2.0"
}'
```
```javascript JS SDK
// yarn add @tatumio/tatum

import { TatumSDK, Ethereum, Network } from '@tatumio/tatum'

const tatum = await TatumSDK.init<Ethereum>({network: Network.ETHEREUM})

const result = await tatum.rpc.debugTraceCall({
"from": "0xa7d9ddbe1f17865597fbd27ec712455208b6b76d",
"to": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
"gas": "0x76c0",
"gasPrice": "0x9184e72a000",
"value": "0x9184e72a",
"data": "0x606060..."
},
"0x1b4",
{
tracer: 'callTracer',
tracerConfig: {
onlyTopCall: true,
timeout: '5s',
}
}
)

await tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs
```
Loading

0 comments on commit ce6b7ef

Please sign in to comment.