Polygon zkEVM RPC服务

1. 引言

Polygon zkEVM节点可提供如下服务:

  • 1)synchronizer服务:所运行zkEVM节点必须运行的基础服务,其它服务均需依赖于synchronizer服务。负责在L1与L2网络间同步数据。
  • 2)eth-tx-manager服务
  • 3)sequencer服务:用存储于Pool数据库中的交易构建new batches。
  • 4)sequencerSender服务
  • 5)RPC服务:将交易relay给Trusted sequencer。
    启动脚本可为:/app/zkevm-node run --network custom --custom-network-file /app/genesis.json --cfg /app/config.toml --components rpc --http.api eth,net,debug,zkevm,txpool,web3
    依赖:
    • synchronizer服务
    • statedb数据库
    • rpc数据库,即pooldb
    • Prover所提供的Merkle Tree和Executor服务
  • 6)aggregator服务:作为Prover的服务端,接收Prover连接请求,负责为待证明batches 生成proofs。
  • 7)l2gaspricer服务

Polygon zkEVM节点RPC服务所支持的JSON RPC endpoints与以太坊节点的有所不同,当前支持的JSON RPC endpoints有:

  • 1)对应debug api有:【debug endpoints表示相应接口未经深度测试】【对应endpoints_debug.go内各函数】
    • debug_traceBlockByHash
    • debug_traceBlockByNumber
    • debug_traceTransaction
  • 2)对应eth api有:【对应endpoints_eth.go内各函数】
    • eth_blockNumber
    • eth_call
      • doesn’t support state override at the moment and pending block. Will be implemented #1990
      • doesn’t support from values that are smart contract addresses. Will be implemented #2017
    • eth_chainId
    • eth_estimateGas * if the block number is set to pending we assume it is the latest
    • eth_gasPrice
    • eth_getBalance * if the block number is set to pending we assume it is the latest
    • eth_getBlockByHash
    • eth_getBlockByNumber
    • eth_getBlockTransactionCountByHash
    • eth_getBlockTransactionCountByNumber
    • eth_getCode * if the block number is set to pending we assume it is the latest
    • eth_getCompilers * response is always empty
    • eth_getFilterChanges
    • eth_getFilterLogs
    • eth_getLogs
    • eth_getStorageAt * if the block number is set to pending we assume it is the latest
    • eth_getTransactionByBlockHashAndIndex
    • eth_getTransactionByBlockNumberAndIndex * if the block number is set to pending we assume it is the latest
    • eth_getTransactionByHash
    • eth_getTransactionCount
    • eth_getTransactionReceipt * doesn’t include effectiveGasPrice. Will include once EIP1559 is implemented
    • eth_getUncleByBlockHashAndIndex * response is always empty
    • eth_getUncleByBlockNumberAndIndex * response is always empty
    • eth_getUncleCountByBlockHash * response is always zero
    • eth_getUncleCountByBlockNumber * response is always zero
    • eth_newBlockFilter
    • eth_newFilter
    • eth_protocolVersion * response is always zero
    • eth_sendRawTransaction * can relay TXs to another node
    • eth_subscribe
    • eth_syncing
    • eth_uninstallFilter
    • eth_unsubscribe
  • 3)对应net api有:【对应endpoints_net.go内各函数】
    • net_version
  • 4)对应txpool api有:【对应endpoints_txpool.go内各函数】
    • txpool_content * response is always empty
  • 5)对应web3 api有:【对应endpoints_web3.go内各函数】
    • web3_clientVersion
    • web3_sha3
  • 6)对应zkevm api有:【对应endpoints_zkevm.go内各函数】
    • zkevm_batchNumber
    • zkevm_batchNumberByBlockNumber
    • zkevm_consolidatedBlockNumber
    • zkevm_getBatchByNumber
    • zkevm_isBlockConsolidated
    • zkevm_isBlockVirtualized
    • zkevm_verifiedBatchNumber
    • zkevm_virtualBatchNumber

参考资料

[1] Component: RPC
[2] JSON RPC Endpoints

附录:Polygon Hermez 2.0 zkEVM系列博客

猜你喜欢

转载自blog.csdn.net/mutourend/article/details/130642477