-
Notifications
You must be signed in to change notification settings - Fork 827
Description
Description
Implementation of the JSON-RPC
interface as described in https://github.com/ethereum/wiki/wiki/JSON-RPC.
This encompasses a server implementation and the implementation of the various API calls.
Possible Implementation
It probably best to start with an early-on implementation of 2-3 exemplary API calls and then refine this for some time to work out a good internal structure to build upon and extend with the further calls.
There are various Javascript libraries out there touching the topic, not sure if any can be of help here or be integrated/used, this should be examined more closely.
UI
The RPC server should be constantly running and be available via some configured address and port.
Implement all JSON-RPC Endpoints
Update (2018-07-10): This has been adressed in ethereumjs/ethereumjs-client#30 by @yurenju, providing a very solid structure for implementation and testing. It is now possible to implement the single RPC endpoints (limited by the functionality already implemented in the core client code).
Checklist of endpoints to support, and which are supported in master or pull requests (taken from Py-EVM:
- Support all the web_* methods
- web3_clientVersion
- web3_sha3
To pick up a draggable item, press the space bar. While dragging, use the arrow keys to move the item. Press space again to drop the item in its new position, or press escape to cancel.To pick up a draggable item, press the space bar. While dragging, use the arrow keys to move the item. Press space again to drop the item in its new position, or press escape to cancel.
- support all the net_* methods
- net_listening
- net_peerCount
- net_version Benchmark ci fixes #840
To pick up a draggable item, press the space bar. While dragging, use the arrow keys to move the item. Press space again to drop the item in its new position, or press escape to cancel.To pick up a draggable item, press the space bar. While dragging, use the arrow keys to move the item. Press space again to drop the item in its new position, or press escape to cancel.
- support all the eth_* write methods
- make list of methods
To pick up a draggable item, press the space bar. While dragging, use the arrow keys to move the item. Press space again to drop the item in its new position, or press escape to cancel.To pick up a draggable item, press the space bar. While dragging, use the arrow keys to move the item. Press space again to drop the item in its new position, or press escape to cancel.
- support all the eth_* read-only methods
- eth_protocolVersion
- eth_syncing
- eth_coinbase
- eth_mining
- eth_hashrate
- eth_gasPrice
- eth_accounts
- eth_blockNumber
- eth_getBalance
- eth_getStorageAt
- eth_getTransactionCount
- eth_getBlockTransactionCountByHash
- eth_getBlockTransactionCountByNumber
- eth_getUncleCountByBlockHash
- eth_getUncleCountByBlockNumber block int
- eth_getUncleCountByBlockNumber block string
- eth_getCode
- eth_call
- eth_estimateGas
- eth_getBlockByHash
- eth_getBlockByNumber block int
- eth_getBlockByNumber block string
- eth_getTransactionByHash
- eth_getTransactionByBlockHashAndIndex
- eth_getTransactionByBlockNumberAndIndex
- eth_getTransactionReceipt
- eth_getUncleByBlockHashAndIndex
- eth_getUncleByBlockNumberAndIndex block int
- eth_getUncleByBlockNumberAndIndex block string
- eth_getCompilers
- eth_getLogs
- eth_getWork
To pick up a draggable item, press the space bar. While dragging, use the arrow keys to move the item. Press space again to drop the item in its new position, or press escape to cancel.To pick up a draggable item, press the space bar. While dragging, use the arrow keys to move the item. Press space again to drop the item in its new position, or press escape to cancel.
Note: On a first round I've just copied over all calls, this might be limited by functionality which eventually shall not be implemented in the client (mining related stuff e.g.).
Activity
[-]JSON RPC interface support[/-][+]JSON-RPC Server / interface support[/+][-]JSON-RPC Server / interface support[/-][+]JSON-RPC Support[/+]kikoncuo commentedon Jun 6, 2018
How can we approach this?
I'm lost, here is my general impression:
Create an express web server to accept the defined petitions
Execute the transactions with ethereumjs-vm
Use ethereumjs-accounts to manage accounts
Read .ldb files to get info about blocks
yurenju commentedon Jun 11, 2018
some clue from ganache-core
https://github.com/trufflesuite/ganache-core/blob/develop/lib/server.js
it should be a good start to use node.js built-in web server since JSON-RPC only has a single endpoint. express is pretty powerful with route path config and static file host, but JSON-RPC doesn't need these features.
maybe we should go with built-in HTTP server?
yurenju commentedon Jun 12, 2018
before go deep into this issue I want to have a rough WIP commit to see if we are on the same page, here we go:
yurenju/ethereumjs-client@6d917a5
This is WIP commit only to verify the idea. This commit refers py-evm implementation to have a
this.modules
to lookup what module we should handle an RPC request. With this commit you can use--rpc
to enable RPC server:and use
curl
to try this API:curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["0x1b4", true],"id":1}' http://127.0.0.1:8545
then you should get
not implement yet
on the console.@holgerd77 any thought? Is it too rough? Let me how should I contribute on this issue :D
holgerd77 commentedon Jun 12, 2018
@yurenju cool that you are taking on this! From a first look I would say that this is going into the right direction. I am in Croatia on holidays at the moment, so can't look into this deeper, back on the weekend and will have a closer look next week.
If you want you can already submit this as a PR and we can continue from there or you can await a deeper review, as you like.
yurenju commentedon Jun 12, 2018
Cool, if this is the right direction I would like to finish one API call like
eth_getBlockByNumber
with test and send a PR, thank you!btw I also went Croatia last year, pretty cool country especially Rovinj & Dubrovnik. enjoy your vacation and no rush to reply here!!
Fixed #17: Implemented eth_getBlockByNumber()
Fixed #17: Implemented eth_getBlockByNumber()
Issue #17: Implemented eth_getBlockByNumber()
Issue #17: Implemented eth_getBlockByNumber()
Issue #17: Implemented eth_getBlockByNumber()
yurenju commentedon Jun 13, 2018
PR ethereumjs/ethereumjs-client#30 is sent
Issue #17: Implemented eth_getBlockByNumber()
Merge pull request #30 from yurenju/issue-17
11 remaining items
holgerd77 commentedon Aug 17, 2018
@benjamincburns Thanks for letting us know, we will definitely have a closer look here.
aunyks commentedon Nov 8, 2018
I've opened a PR for
web3_*
at ethereumjs/ethereumjs-client#65.aunyks commentedon Dec 5, 2018
net_*
are complete.tomonari-t commentedon Jun 7, 2020
I guess
web_*
andeth_getBlockByHash
are complete[-]JSON-RPC Support[/-][+]Client JSON-RPC Support[/+]holgerd77 commentedon Feb 15, 2021
@ryanio I've read in some internal chats - I think from someone from the geth team - that RPC methods would be valuable for debugging and comparing results when clients are joining the Yolo testnet. So if you are not sure what to work on next adding (some) RPC methods is always a good candidate I guess. Maybe you want to have a closer look what might be the more useful ones to have, not sure, haven't given this any thought yet (others can suggest as well of course).
ryanio commentedon Feb 16, 2021
@holgerd77 sounds good, I really like the setup of the RPC modules code with the methods on the classes, it makes it natural to use in TypeScript. I'm seeing that it's currently callback based though, I can start with a PR updating it to async/promises then start adding some useful methods.
I started a tracking table in #1114 to visualize some more namespaces I found.
holgerd77 commentedon Feb 16, 2021
Ok, great! 😄
Will then close here in favor of #1114
[-]Client JSON-RPC Support[/-][+]Client JSON-RPC Support (old)[/+]