erigon-pulse/cmd/rpcdaemon/README.md
Thomas Jay Rush e5f8073d75
1084 various rpc fixes (#1111)
* Fixes issue #1110 - eth_getStorageAt returning inconsistent values

* Adds support for various eth_getUncle calls

* Adding a couple of comments

* Adding support for eth_getTransactionCount

* Cleaning up README's

* Cleaning up README for rpcdaemon

Co-authored-by: tjayrush <jrush@greathill.com>
2020-09-14 07:59:07 +01:00

8.5 KiB

In turbo-geth RPC calls are extracted out of the main binary into a separate daemon. This daemon can use both local or remote DBs. That means, that this RPC daemon doesn't have to be running on the same machine as the main turbo-geth binary or it can run from a snapshot of a database for read-only calls. Docs

Get started

For local DB

> make rpcdaemon
> ./build/bin/rpcdaemon --chaindata ~/Library/TurboGeth/tg/chaindata --http.api=eth,debug,net

For remote DB

Run turbo-geth in one terminal window

> ./build/bin/tg --private.api.addr=localhost:9090

Run RPC daemon

> ./build/bin/rpcdaemon --private.api.addr=localhost:9090

Test

Try eth_blockNumber call. In another console/tab, use curl to make RPC call:

curl -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"eth_blockNumber", "params": [], "id":1}' localhost:8545

It should return something like this (depending on how far your turbo-geth node has synced):

{"jsonrpc":"2.0","id":1,"result":823909}

For Developers

Code generation: go.mod stores right version of generators, use mage grpc to install it and generate code.

protoc version not managed but recommended version is 3.x, install instruction

RPC Implementation Status

eth_getBalance eth_getCode eth_getTransactionCount eth_getStorageAt eth_call When requests are made that act on the state of ethereum, the last default block parameter determines the height of the block.

The following options are possible for the defaultBlock parameter:

HEX String - an integer block number String "earliest" for the earliest/genesis block String "latest" - for the latest mined block String "pending" - for the pending state/transactions Curl Examples Explained The curl options below might return a response where the node complains about the content type, this is because the --data option sets the content type to application/x-www-form-urlencoded . If your node does complain, manually set the header by placing -H “Content-Type: application/json” at the start of the call.

The examples also do not include the URL/IP & port combination which must be the last argument given to curl e.x. 127.0.0.1:8545

Command Available Notes
------------ Web3 ------------
web3_clientVersion Y
web3_sha3 Y
------------ Net ------------
net_listening -
net_peerCount* Y Returns a count of 25 as work continues on Sentry
net_version Y
------------ System ------------
eth_blockNumber Y
eth_chainID -
eth_protocolVersion -
eth_syncing Y
eth_estimateGas Y
eth_gasPrice -
------------ Blocks/Uncles ------------
eth_getBlockByHash Y
eth_getBlockByNumber Y
eth_getBlockTransactionCountByHash Y
eth_getBlockTransactionCountByNumber Y
eth_getUncleByBlockHashAndIndex Y
eth_getUncleByBlockNumberAndIndex Y
eth_getUncleCountByBlockHash Y
eth_getUncleCountByBlockNumber Y
------------ Transactions ------------
eth_getTransactionByHash Y
eth_getTransactionByBlockHashAndIndex Y
eth_getTransactionByBlockNumberAndIndex Y
eth_getTransactionReceipt Y
eth_getLogs Y
------------ State ------------
eth_getBalance Y
eth_getCode Y
eth_getStorageAt Y
------------ Filters ------------
eth_newFilter -
eth_newBlockFilter -
eth_newPendingTransactionFilter -
eth_getFilterChanges -
eth_getFilterLogs -
eth_uninstallFilter -
------------ Accounts ------------
eth_accounts
eth_call Y
eth_getTransactionCount Y
eth_sendRawTransaction Y
eth_sendTransaction -
eth_sign -
eth_signTransaction -
eth_signTypedData -
------------ ????? ------------
eth_getProof -
------------ Mining ------------
eth_mining -
eth_coinbase Y
eth_hashrate -
eth_submitHashrate -
eth_getWork -
eth_submitWork -
------------ Debug ------------
debug_accountRange Y
debug_getModifiedAccountsByNumber Y
debug_getModifiedAccountsByHash Y
debug_storageRangeAt Y
debug_traceTransaction Y
**------------ trace ------------**_
trace_filter Y
_**------------ Retired ------------**_
eth_getCompilers N
eth_compileLLL N
eth_compileSolidity N
eth_compileSerpent N
db_putString N
db_getString N
db_putHex N
db_getHex N
shh_post N
shh_version N
shh_newIdentity N
shh_hasIdentity N
shh_newGroup N
shh_addToGroup N
shh_newFilter N
shh_uninstallFilter N
shh_getFilterChanges N
shh_getMessages N