From d44e1cbe4345746db67db7255105d8897267a991 Mon Sep 17 00:00:00 2001 From: Alex Sharov Date: Thu, 21 Apr 2022 14:34:08 +0700 Subject: [PATCH] Readme update: built-in rpc daemon and syncmode=snap (#3924) * save * save --- README.md | 50 ++++++++++++++++++-------------------------------- 1 file changed, 18 insertions(+), 32 deletions(-) diff --git a/README.md b/README.md index f64af24ae..798592f69 100644 --- a/README.md +++ b/README.md @@ -63,6 +63,10 @@ make erigon ./build/bin/erigon ``` +Default `--syncmode=snap` for `mainnet`, `goerli`, `bsc`. Other networks now have default `--syncmode=fast`. Increase download speed by flag `--torrent.download.rate=20mb` + +Use `--datadir` to choose where to store data. + ### Optional stages There is an optional stage that can be enabled through flags: @@ -169,25 +173,18 @@ This piece of info needs to be specified in the Consensus Layer as well in order ### Multiple Instances / One Machine -Here's an example of running multiple instances of Erigon against different chains on the same machine: - -Against mainnet: +Define 5 flags to avoid conflicts: `--datadir --port --http.port --torrent.port --private.api.addr`. Example of multiple chains on the same machine: ``` -./build/bin/erigon --datadir "" --private.api.addr=localhost:9091 -port 30303 --chain mainnet -./build/bin/rpcdaemon --datadir "" --private.api.addr=localhost:9091 --http.api=eth,debug,net,trace,web3,erigon --http.port 8546 +# mainnet +./build/bin/erigon --datadir="" --chain=mainnet --port=30303 --http.port=8545 --torrent.port=42069 --private.api.addr=127.0.0.1:9090 --http --ws --http.api=eth,debug,net,trace,web3,erigon + + +# rinkeby +./build/bin/erigon --datadir="" --chain=rinkeby --port=30304 --http.port=8546 --torrent.port=42068 --private.api.addr=127.0.0.1:9091 --http --ws --http.api=eth,debug,net,trace,web3,erigon ``` -As usual, use the same `datadir` and `private.api.addr` for both Erigon and RPC. Explicitly specify the chain and the other ports to make things clearer. Quote your path if it has spaces. - -Against rinkeby: - -``` -./build/bin/erigon --datadir "" --private.api.addr=localhost:9092 -port 30304 --chain rinkeby -./build/bin/rpcdaemon --datadir "" --private.api.addr=localhost:9092 --http.api=eth,debug,net,trace,web3,erigon --http.port 8547 -``` - -Same command, but use different `datadir` and different ports throughout. +Quote your path if it has spaces. ### Dev Chain 🔬 Detailed explanation is [DEV_CHAIN](/DEV_CHAIN.md). @@ -244,24 +241,11 @@ Examples of stages are: ### JSON-RPC daemon -In Erigon 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 Erigon binary or -it can run from a snapshot of a database for read-only calls. +Most of Erigon's components can work inside Erigon and as independent process. -🔬 See [RPC-Daemon docs](./cmd/rpcdaemon/README.md) +To enable built-in RPC server: `--http` and `--ws` (sharing same port with http) -#### **For local DB** - -This is only possible if RPC daemon runs on the same computer as Erigon. This mode uses shared memory access to the -database of Erigon, which has better performance than accessing via TPC socket (see "For remote DB" section below). -Provide both `--datadir` and `--private.api.addr` options: - -```sh -make erigon -./build/bin/erigon --private.api.addr=localhost:9090 -make rpcdaemon -./build/bin/rpcdaemon --datadir= --private.api.addr=localhost:9090 --http.api=eth,erigon,web3,net,debug,trace,txpool -``` +Run RPCDaemon as separated process: this daemon can use local DB (with running Erigon or on snapshot of a database) or remote DB (run on another server). 🔬 See [RPC-Daemon docs](./cmd/rpcdaemon/README.md) #### **For remote DB** @@ -275,7 +259,9 @@ make rpcdaemon ./build/bin/rpcdaemon --private.api.addr=localhost:9090 --http.api=eth,erigon,web3,net,debug,trace,txpool ``` -**gRPC ports**: `9090` erigon, `9091` sentry, `9092` consensus engine, `9093` snapshot downloader, `9094` TxPool +#### **gRPC ports** + +`9090` erigon, `9091` sentry, `9092` consensus engine, `9093` torrent downloader, `9094` transactions pool Supported JSON-RPC calls ([eth](./cmd/rpcdaemon/commands/eth_api.go), [debug](./cmd/rpcdaemon/commands/debug_api.go) , [net](./cmd/rpcdaemon/commands/net_api.go), [web3](./cmd/rpcdaemon/commands/web3_api.go)):