L0vdL0vd

eth_simulateV1

Simulates a sequence of calls across one or more blocks with state and block overrides, without sending anything.

归档 · 可查询任意历史区块

Like eth_call, but for several dependent calls at once: approve then swap, deposit then withdraw. Each call sees the state left by the previous one.

curl https://eth.l0vdinfra.com/YOUR_KEY \
  -X POST \
  -H "Content-Type: application/json" \
  --data '{"jsonrpc":"2.0","id":1,"method":"eth_simulateV1","params":[{"blockStateCalls":[{"calls":[{"to":"0xdAC17F958D2ee523a2206206994597C13D831ec7","data":"0x18160ddd"}]}]},"0x1208a5f"]}'

响应示例

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": [
    {
      "baseFeePerGas": "0x0",
      "calls": [
        {
          "returnData": "0x00000000000000000000000000000000000000000000000000953de484d045c9",
          "logs": [],
          "gasUsed": "0x644b",
          "maxUsedGas": "0x644b",
          "status": "0x1"
        }
      ],
      "difficulty": "0x0",
      "extraData": "0x",
      "gasLimit": "0x1c9c380",
      "gasUsed": "0x644b",
      "hash": "0x1d662b91c7d6751f4e0d6b920756b676c9565dee51edfd72713be3000bde7bd8",
      "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000…",
      "miner": "0xf15689636571dba322b48e9ec9ba6cfb3df818e1",
      "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
      "nonce": "0x0000000000000000",
      "number": "0x1208a60",
      "parentHash": "0xc7a2fd354a9a1512636dad41b44e618905f5e8d2500f08c515c3bbbdf5261f6a",
      "receiptsRoot": "0x9788f6286a09853934702c89862e1d8ac9144af67d44a6aa154aca2e98f1060e",
      "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
      "size": "0x251",
      "stateRoot": "0x0000000000000000000000000000000000000000000000000000000000000000",
      "timestamp": "0x65922b3f",
      "transactions": [
        "0xab9c215d1f47fe9bf56be1048ceaf47dbd9e23c475ae047dd93882b447a04eaa"
      ],
      "transactionsRoot": "0x8541231e121f8bbfb24b3c6ef272986d5c70eb3ac9d761a823617be147849d4b",
      "uncles": [],
      "withdrawals": [],
      "withdrawalsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421"
    }
  ]
}

示例中较长的数组和十六进制字符串已截断。

参数与您的端点

参数

payloadobject必填
blockStateCalls: list of blocks, each with calls (transaction objects) and optional stateOverrides and blockOverrides; optional validation, traceTransfers and returnFullTransactions flags.
blockstring必填
Block number in hex (e.g. "0x1208a5f") or a tag: "latest", "safe", "finalized", "earliest" or "pending". L0vd endpoints run archive nodes, so any historical block works.

返回值

array One simulated block per entry, each with calls: returnData, logs, gasUsed and status.

适用场景

Simulate several dependent calls in one request: approve then swap, deposit then withdraw, or a whole multi-step strategy at a past block.

Test what-if scenarios with state overrides (balances, code, storage) and block overrides (timestamp, base fee) without deploying anything.

如何解读结果

The result has one entry per simulated block; each has calls with status, returnData, gasUsed and logs. Decode returnData with the ABI, as for eth_call.

提示

  • Set validation to false (the default) to skip balance and nonce checks, which is what you want for analytics.
  • Use it instead of many eth_call requests when calls depend on each other.

相关方法