diff options
author | Wei-Ning Huang <w@byzantine-lab.io> | 2019-09-01 14:20:30 +0800 |
---|---|---|
committer | Wei-Ning Huang <w@byzantine-lab.io> | 2019-09-01 14:20:30 +0800 |
commit | c0b7a59fa92a8850a6fdd4fe8309a5f69ec55c26 (patch) | |
tree | 5f8df41a21566aa0923fc788b1cee733c5952e32 /docs/RPC-Node-Operation-Guide.md | |
download | tangerine-wiki-c0b7a59fa92a8850a6fdd4fe8309a5f69ec55c26.tar tangerine-wiki-c0b7a59fa92a8850a6fdd4fe8309a5f69ec55c26.tar.gz tangerine-wiki-c0b7a59fa92a8850a6fdd4fe8309a5f69ec55c26.tar.bz2 tangerine-wiki-c0b7a59fa92a8850a6fdd4fe8309a5f69ec55c26.tar.lz tangerine-wiki-c0b7a59fa92a8850a6fdd4fe8309a5f69ec55c26.tar.xz tangerine-wiki-c0b7a59fa92a8850a6fdd4fe8309a5f69ec55c26.tar.zst tangerine-wiki-c0b7a59fa92a8850a6fdd4fe8309a5f69ec55c26.zip |
Add wiki material
Diffstat (limited to 'docs/RPC-Node-Operation-Guide.md')
-rw-r--r-- | docs/RPC-Node-Operation-Guide.md | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/docs/RPC-Node-Operation-Guide.md b/docs/RPC-Node-Operation-Guide.md new file mode 100644 index 0000000..cca61dd --- /dev/null +++ b/docs/RPC-Node-Operation-Guide.md @@ -0,0 +1,88 @@ +# Running a RPC node + +## Content + +- [Overview](#overview) +- [System Requirement](#system-requirement) +- [Software Instruction](#software-instruction) + +## Overview + +A RPC node is the data access layer of blockchains. It usually won't join the mining process but only try to sync the latest confirmed state from other nodes. With those datum in hands, a RPC node can provide these functionalities: +- Pack and send transactions +- Allow other services (like **wallet** or **explorer**) to access states on blockchains in standard way, like **jsonrpc**. + +## System Requirement + +Refer to [System requirement](BP-Node-Operation-Guide.md#system-requirement) section in BP node operation guide. + +## Software Instruction + +Different from running a BP node, you don't have to +- create a node key +- register your node + +The command line to start a RPC node is different, too: +``` +docker run -v $PWD:/mnt -it byzantinelab/go-tangerine \ + --datadir=/mnt/datadir \ + --syncmode=fast \ + --rpc \ + --rpcapi=eth,net,web3 \ + --rpcaddr=0.0.0.0 \ + --rpcvhosts=* \ + --rpccorsdomain=* \ + --ws \ + --wsapi=eth,net,web3 \ + --wsaddr=0.0.0.0 \ + --wsorigins=* \ + --cache=1024 \ + --gcmode=archive \ + --metrics \ + --pprof \ + --pprofaddr=0.0.0.0 +``` +You should be able to see these logs, which simply means your RPC node tries to sync blocks from other peers and it would take a while. If not, make sure tcp/30303 and udp/30303 is not blocked by the firewall. +``` +... +INFO [04-18|12:23:33.783] Imported new state entries ... +INFO [04-18|12:23:35.647] Imported new state entries ... +INFO [04-18|12:23:37.714] Imported new block receipts ... +INFO [04-18|12:23:38.471] Imported new block receipts ... +... +``` +To make sure your RPC node is ready for usage, you can try to get the count of blocks it received via this command: +``` +curl -X POST \ + -H "Content-Type: application/json" \ + --data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' \ + http://localhost:8545 +``` +You should be able to see something similar in return (**0xd482e** is the hex form of **870062**): +``` +{"jsonrpc":"2.0","id":1,"result":"0xd482e"} +``` + +### RPC Node for Testnet + +It simply to launch a RPC node for testnet by adding network flag `--testnet`: +``` +docker run -v $PWD:/mnt -it byzantinelab/go-tangerine \ + --testnet \ + --datadir=/mnt/datadir \ + --syncmode=fast \ + --rpc \ + --rpcapi=eth,net,web3 \ + --rpcaddr=0.0.0.0 \ + --rpcvhosts=* \ + --rpccorsdomain=* \ + --ws \ + --wsapi=eth,net,web3 \ + --wsaddr=0.0.0.0 \ + --wsorigins=* \ + --cache=1024 \ + --gcmode=archive \ + --metrics \ + --pprof \ + --pprofaddr=0.0.0.0 +``` |