下面给出了 Ethereum Gateway 支持的 API 方法的完整列表。如果指定的并非受支持方法,网关将返回 403。
有关 JSON-RPC API 方法的完整列表,请参阅 JSON-RPC 规范 ↗。
EVM traces 是一种跟踪以太坊区块链上智能合约执行的方法。它记录以太坊虚拟机(EVM)在运行智能合约时采取的所有步骤。这包括诸如执行的特定操作、消耗的 gas 成本以及因此对区块链所做的任何更改等信息。trace 模块是一种允许开发人员访问和分析这些 trace 的工具,这对于调试、测试和监控智能合约非常有用。它可用于识别和修复错误、优化性能并深入了解智能合约如何与区块链交互。
trace_filter 方法在单个请求中检索多个交易的 trace。此方法对于在以太坊区块链上调试和监控特定地址特别有用。
fromBlock:Quantity或Tag- (可选)开始接收 trace 的区块号。toBlock:Quantity或Tag- (可选)停止接收 trace 的区块号。fromAddress:Array- (可选)开始接收 trace 的地址数组。toAddress:Address- (可选)停止检索 trace 的地址数组。after:Quantity- (可选)偏移 trace 数count:Quantity- (可选)要返回的 trace 数量。
此方法返回与给定过滤器匹配的 trace Array。
curl https://web3-trial.cloudflare-eth.com/v1/mainnet \
-X POST \
-H 'Content-Type: application/json' \
--data '{
"jsonrpc":"2.0",
"method":"trace_filter",
"params":[
{
"count": 200,
"fromBlock": "0xccb943",
"toBlock": "0xccbc62",
"fromAddress": [
"0xEdC763b3e418cD14767b3Be02b667619a6374076"
]
}
],
"id":1
}'{
"jsonrpc": "2.0",
"result": [
{
"action": {
"from": "0xedc763b3e418cd14767b3be02b667619a6374076",
"callType": "call",
"gas": "0x8462",
"input": "0x095ea7b30000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"to": "0x7ff4169a6b5122b664c51c95727d87750ec07c84",
"value": "0x0"
},
"blockHash": "0x351e7c06ec010c8f7e7358eb580238dd23e1e129be96822aa93ebb6da08558e6",
"blockNumber": 13416771,
"result": {
"gasUsed": "0x6009",
"output": "0x0000000000000000000000000000000000000000000000000000000000000001"
},
"subtraces": 0,
"traceAddress": [],
"transactionHash": "0x054bbb9fbb855bf23f755e548c7409f45fc5eff8a824b2ad06380bc038d7b049",
"transactionPosition": 54,
"type": "call"
}
],
"id": 1
}trace_filter 方法有一些限制,以确保我们的节点不会过载。
trace_filter方法的区块范围限制为 800 个区块。- trace
count限制为 200