# Simulate Ethereum Transactions

Through this endpoint the customer can Simulate transactions and know in advance how they will behave onchain without paying a on chain fee.

- **Endpoint:** `POST https://rest.cryptoapis.io/simulate-transactions/evm/ethereum/{network}`
- **Authentication:** `x-api-key` header
- **Credits cost:** 110 credits for 1 result by default; per blockchain: Ethereum: 110, Ethereum Classic: 143, Binance Smart Chain: 275, Polygon: 220, Arbitrum: 176, Avalanche: 198, Base: 132, Optimism: 154, Tron: 165, Solana: 330, XRP: 110, Tezos: 143, Bitcoin: 110, Bitcoin Cash: 132, Dash: 121, Dogecoin: 121, Litecoin: 121, Zcash: 143, Kaspa: 198
- **Documentation page:** https://developers.cryptoapis.io/v-2.2024-12-12-175/RESTapis/simulate-transactions-evm/simulate-ethereum-transactions/post

## Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `network` | string | yes | Represents the name of the blockchain network used; blockchain networks are usually identical as technology and software, but they differ in data, e.g. - "mainnet" is the live network with actual data while networks like "testnet", "sepolia" are test networks. Allowed values: `sepolia`, `mainnet`. |

## Query parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `context` | string | no | In batch situations the user can use the context to correlate responses with requests. This property is present regardless of whether the response was successful or returned as an error. `context` is specified by the user. |

## Request body (application/json)

```json
{
  "context": "yourExampleString",
  "data": {
    "item": {
      "amount": "0.123",
      "gasLimit": 84000,
      "gasPrice": "47125353",
      "inputData": "0xa9059cbb000000000000000000000000392214d9de6aaafe32f8ce1e166c2b3ac8ce04c700000000000000000000000000000000000000000000000000000000000001F4",
      "maxFeePerGas": "60000000000",
      "maxPriorityFeePerGas": "1000000000",
      "recipient": "0xc01efdde68290f5a107c9ede6ce3200bba47d375",
      "sender": "0xc01efdde68290f5a107c9ede6ce3200bba47d375"
    }
  }
}
```

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `context` | string | no | In batch situations the user can use the context to correlate responses with requests. This property is present regardless of whether the response was successful or returned as an error. `context` is specified by the user. |
| `data` | object | yes |  |
| `data.item` | object | yes |  |
| `data.item.amount` | string | yes | String representation of the amount being transferred in ETH |
| `data.item.gasLimit` | integer | yes | String representation of the gas limit for the transactions |
| `data.item.gasPrice` | string | no | String representation of the gas price for LEGACY transactions in WEI |
| `data.item.inputData` | string | no | String representation of hex data for contract interactions |
| `data.item.maxFeePerGas` | string | no | String representation of the max fee per gas for EIP-1559 transactions in WEI |
| `data.item.maxPriorityFeePerGas` | string | no | String representation of the max priority fee for EIP-1559 transactions in WEI |
| `data.item.recipient` | string | yes | String representation of the to address |
| `data.item.sender` | string | yes | String representation of the from address |

## Responses

| Status | Description |
| --- | --- |
| 201 | Successful transaction result |
| 400 | 400 |
| 401 | 401 |
| 402 | 402 |
| 403 | 403 |
| 409 | The data provided seems to be invalid. |
| 415 | The selected Media Type is unavailable. The Content-Type header should be 'application/json'. |
| 422 | Your request body for POST requests must have a structure of { data: { item: [...properties] } } |
| 429 | The request limit has been reached. There can be maximum {requests} requests per {seconds} second(s) made. Please contact our team via email if you need more or upgrade your plan. |
| 500 | An unexpected server error has occurred, we are working to fix this. Please try again later and in case it occurs again please report it to our team via email. |

### Example 201 response

```json
{
  "apiVersion": "2024-12-12",
  "requestId": "601c1710034ed6d407996b30",
  "context": "yourExampleString",
  "data": {
    "item": {
      "contract": "0x534bD102153EF199abAe8296a2FaE4599fC44Cdc",
      "gasLimit": 21000,
      "gasUsed": 21000,
      "hash": "0xbedfba55a8ef9342d1fe70e1e9adefad20aca7c164b072a648b1bb95d5a6b631",
      "inputData": "0xa9059cbb000000000000000000000000392214d9de6aaafe32f8ce1e166c2b3ac8ce04c700000000000000000000000000000000000000000000000000000000000001F4",
      "internalTransactions": [
        {
          "depth": 1,
          "operationType": "CALL",
          "recipient": "0xc946cb236481c159f460b212b34ab246dac37fcd",
          "sender": "0xadf10d7f6a7069c11fc5f3c6c9b4f419b326bcbc",
          "value": {
            "amount": "0.0123",
            "unit": "ETH"
          }
        }
      ],
      "nonce": 123,
      "positionInBlock": 1,
      "status": "0x1",
      "timestamp": 1669627454,
      "tokenTransfers": [
        {
          "recipient": "0xc6d46aba0c6e2eb6358c4e24804158cc4d847922",
          "sender": "0xc6d46aba0c6e2eb6358c4e24804158cc4d847922",
          "tokenData": {
            "contractAddress": "0xece01807f7d9b93529174533e997e5de168b0b39",
            "fungibleValues": {
              "amount": "0.123",
              "decimals": 18
            },
            "name": "Tether",
            "nonFungibleValues": {
              "tokenId": "73424079983647210902572285069973579475843508985221180214989723113099915952129"
            },
            "standard": "ERC-20",
            "symbol": "USDT"
          }
        }
      ],
      "fee": {
        "amount": "0.0001",
        "unit": "ETH"
      },
      "gasPrice": {
        "amount": 1234567,
        "unit": "WEI"
      },
      "maxFeePerGas": {
        "amount": "3558974297",
        "unit": "WEI"
      },
      "maxPriorityFeePerGas": {
        "amount": "21000",
        "unit": "WEI"
      },
      "minedInBlock": {
        "hash": "0xbedfba55a8ef9342d1fe70e1e9adefad20aca7c164b072a648b1bb95d5a6b631",
        "height": 2408785
      },
      "value": {
        "amount": "0.123",
        "unit": "ETH"
      }
    }
  }
}
```

### 201 response fields

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `apiVersion` | string | yes | Specifies the version of the API that incorporates this endpoint. |
| `requestId` | string | yes | Defines the ID of the request. The `requestId` is generated by Crypto APIs and it's unique for every request. |
| `context` | string | no | In batch situations the user can use the context to correlate responses with requests. This property is present regardless of whether the response was successful or returned as an error. `context` is specified by the user. |
| `data` | object | yes |  |
| `data.item` | object | yes |  |
| `data.item.contract` | string | no | String representation of contract address of the token that was transfered |
| `data.item.gasLimit` | integer | yes | String representation of the transaction gas limit |
| `data.item.gasUsed` | integer | no | String representation of the transaction used gas |
| `data.item.hash` | string | yes | String representation of the transaction hash |
| `data.item.inputData` | string | no | Hex data for contract interaction |
| `data.item.internalTransactions` | array of object | no | Internal transactions executed by transaction |
| `data.item.internalTransactions[].depth` | integer | yes | This simply shows how far we are looking into the transactions. Each Call has a "Depth" value that indicates how far it is away from the original transaction. A depth of 1 means it's a direct call, while Calls higher than 1 shows nested calls. |
| `data.item.internalTransactions[].operationType` | string | yes | String representation of internal transaction type |
| `data.item.internalTransactions[].recipient` | string | yes | String representation of the internal transaction recipient |
| `data.item.internalTransactions[].sender` | string | yes | String representation of the internal transaction sender |
| `data.item.internalTransactions[].value` | object | yes |  |
| `data.item.internalTransactions[].value.amount` | string | yes | String representation of the amount that was transacted |
| `data.item.internalTransactions[].value.unit` | string | no |  |
| `data.item.nonce` | integer | yes | Numeric representation of the transaction nonce |
| `data.item.positionInBlock` | integer | yes | Numeric representation of the transaction index |
| `data.item.status` | string | yes | Status of the transaction |
| `data.item.timestamp` | integer | yes | Numeric representation of the timestamp in seconds since epoch |
| `data.item.tokenTransfers` | array of object | no | Token transfers executed by transaction |
| `data.item.tokenTransfers[].recipient` | string | yes | Defines the address to which the recipient receives the transferred tokens. |
| `data.item.tokenTransfers[].sender` | string | yes | Defines the address from which the sender transfers tokens. |
| `data.item.tokenTransfers[].tokenData` | object | yes | Token data |
| `data.item.tokenTransfers[].tokenData.contractAddress` | string | yes | String representation of contract address of the token that was transfered |
| `data.item.tokenTransfers[].tokenData.fungibleValues` | object | no |  |
| `data.item.tokenTransfers[].tokenData.fungibleValues.amount` | string | no | Amount of the transferred token |
| `data.item.tokenTransfers[].tokenData.fungibleValues.decimals` | integer | no | Decimals of the token (for fungible tokens) |
| `data.item.tokenTransfers[].tokenData.name` | string | no | String representation of the token name |
| `data.item.tokenTransfers[].tokenData.nonFungibleValues` | object | no |  |
| `data.item.tokenTransfers[].tokenData.nonFungibleValues.tokenId` | string | no | Token ID of the token (for non-fungible tokens) |
| `data.item.tokenTransfers[].tokenData.standard` | string | yes | Defines the specific token type. |
| `data.item.tokenTransfers[].tokenData.symbol` | string | no | String representation of the token symbol |
| `data.item.fee` | object | yes |  |
| `data.item.fee.amount` | string | yes | Fee spent for transaction |
| `data.item.fee.unit` | string | yes | Unit in which amount is calculated |
| `data.item.gasPrice` | object | yes |  |
| `data.item.gasPrice.amount` | integer | yes | String representation of the transaction gas price |
| `data.item.gasPrice.unit` | string | yes | String representation of the transaction price unit |
| `data.item.maxFeePerGas` | object | no |  |
| `data.item.maxFeePerGas.amount` | string | no | Max fee per gas for EIP-1559 transactions |
| `data.item.maxFeePerGas.unit` | string | yes |  |
| `data.item.maxPriorityFeePerGas` | object | no |  |
| `data.item.maxPriorityFeePerGas.amount` | string | no | Max priority fee for EIP-1559 transactions |
| `data.item.maxPriorityFeePerGas.unit` | string | yes |  |
| `data.item.minedInBlock` | object | yes |  |
| `data.item.minedInBlock.hash` | string | yes | String representation of the block hash |
| `data.item.minedInBlock.height` | integer | yes | Numeric representation of the block height |
| `data.item.value` | object | yes |  |
| `data.item.value.amount` | string | yes | String representation of the amount |
| `data.item.value.unit` | string | yes |  |
