Add native ETH JSON-RPC server (replaces meter-gear)#33
Open
simonzg wants to merge 3 commits into
Open
Conversation
Replaces the Python meter-gear proxy with a native Go implementation of the Ethereum JSON-RPC API inside meter-pov. This eliminates the extra process and HTTP hop between gear (port 8545) and meter-pov. Phase 1 implements 33 RPC methods across eth, net, web3, rpc, and evm namespaces including: block/tx/receipt queries, eth_call, estimateGas, sendRawTransaction, getLogs, feeHistory, filters, and subscriptions via WebSocket. New package: api/ethapi/ with server.go, api.go, convert.go New CLI flag: --eth-rpc-addr (default localhost:8545) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Tests cover: - convert.go: block/tx/receipt/log conversion, hex helpers, constants, contract creation, multi-clause, empty blocks, multiple events - api.go: CallArgs, LogFilterArgs, Net/Web3/RPC/EVM APIs, ChainId, filter lifecycle, applyTopics, JSON marshaling - server.go: getChainID, CORS handler (headers, preflight, methods) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
8 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
eth,net,web3,rpc, andevmnamespaces using geth'srpcpackage (already a dependency)api/ethapi/with server setup, method implementations, and Meter→Ethereum type conversion--eth-rpc-addr(defaultlocalhost:8545) to configure the listen addressMethods implemented (Phase 1)
Trivial/Static:
eth_chainId,eth_gasPrice,eth_maxPriorityFeePerGas,eth_syncing,net_version,net_listening,net_peerCount,web3_clientVersion,rpc_modules,evm_snapshot,evm_revertSimple:
eth_blockNumber,eth_getBalance,eth_getCode,eth_getStorageAt,eth_getTransactionCount,eth_newBlockFilter,eth_uninstallFilter,eth_getFilterChangesMedium:
eth_getBlockByNumber,eth_getBlockByHash,eth_getTransactionByHash,eth_getTransactionReceipt,eth_getTransactionByBlockNumberAndIndex,eth_getTransactionByBlockHashAndIndex,eth_getBlockTransactionCountByNumber,eth_call,eth_estimateGas,eth_sendRawTransaction,eth_getLogsComplex:
eth_getBlockReceipts,eth_feeHistoryArchitecture
Calls directly into existing
chain,state,txpool,logdbpackages — no new external dependencies.Test plan
eth_getBlockByNumber("latest", true)and verify full block with expanded txseth_getTransactionReceipt(hash)and verify log indices, status, gaseth_getLogswith multiple addresses and verify chunking produces correct resultseth_callwith contract call and verify return data matches geareth_estimateGasand verify estimate is reasonableeth_sendRawTransactionwith a signed EIP-1559 tx/wsendpoint🤖 Generated with Claude Code