Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 6 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ FROM docker.io/library/alpine:3.17
RUN apk add --no-cache ca-certificates libstdc++ tzdata
RUN apk add --no-cache curl jq bind-tools

WORKDIR /usr/local/bin
RUN wget https://github.com/grpc-ecosystem/grpc-health-probe/releases/download/v0.4.11/grpc_health_probe-linux-amd64 -P /usr/local/bin/ && \
mv /usr/local/bin/grpc_health_probe-linux-amd64 /usr/local/bin/grpc_health_probe && \
chmod +x /usr/local/bin/grpc_health_probe

# Setup user and group
#
# from the perspective of the container, uid=1000, gid=1000 is a sensible choice
Expand Down Expand Up @@ -76,6 +81,7 @@ COPY --from=builder /app/build/bin/sentry /usr/local/bin/sentry
COPY --from=builder /app/build/bin/state /usr/local/bin/state
COPY --from=builder /app/build/bin/txpool /usr/local/bin/txpool
COPY --from=builder /app/build/bin/verkle /usr/local/bin/verkle
COPY --from=builder /app/build/bin/caplin-phase1 /usr/local/bin/caplin-phase1



Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.debian
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ COPY --from=builder /app/build/bin/erigon-cl /usr/local/bin/erigon-cl
COPY --from=builder /app/build/bin/evm /usr/local/bin/evm
COPY --from=builder /app/build/bin/hack /usr/local/bin/hack
COPY --from=builder /app/build/bin/integration /usr/local/bin/integration
COPY --from=builder /app/build/bin/lightclient /usr/local/bin/lightclient
COPY --from=builder /app/build/bin/observer /usr/local/bin/observer
COPY --from=builder /app/build/bin/pics /usr/local/bin/pics
COPY --from=builder /app/build/bin/rpcdaemon /usr/local/bin/rpcdaemon
Expand All @@ -75,6 +74,7 @@ COPY --from=builder /app/build/bin/sentry /usr/local/bin/sentry
COPY --from=builder /app/build/bin/state /usr/local/bin/state
COPY --from=builder /app/build/bin/txpool /usr/local/bin/txpool
COPY --from=builder /app/build/bin/verkle /usr/local/bin/verkle
COPY --from=builder /app/build/bin/caplin-phase1 /usr/local/bin/caplin-phase1

EXPOSE 8545 \
8551 \
Expand Down
20 changes: 11 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ CGO_CFLAGS += -Wno-error=strict-prototypes # for Clang15, remove it when can htt
CGO_CFLAGS := CGO_CFLAGS="$(CGO_CFLAGS)"
DBG_CGO_CFLAGS += -DMDBX_DEBUG=1

BUILD_TAGS = nosqlite,noboltdb
BUILD_TAGS = nosqlite,noboltdb,netgo # about netgo see: https://github.com/golang/go/issues/30310#issuecomment-471669125
PACKAGE = github.com/ledgerwatch/erigon

GO_FLAGS += -trimpath -tags $(BUILD_TAGS) -buildvcs=false
Expand All @@ -42,8 +42,8 @@ default: all

## go-version: print and verify go version
go-version:
@if [ $(shell $(GO) version | cut -c 16-17) -lt 18 ]; then \
echo "minimum required Golang version is 1.18"; \
@if [ $(shell $(GO) version | cut -c 16-17) -lt 19 ]; then \
echo "minimum required Golang version is 1.19"; \
exit 1 ;\
fi

Expand Down Expand Up @@ -105,6 +105,7 @@ geth: erigon
erigon: go-version erigon.cmd
@rm -f $(GOBIN)/tg # Remove old binary to prevent confusion where users still use it because of the scripts

COMMANDS += starter
COMMANDS += devnet
COMMANDS += erigon-el-mock
COMMANDS += downloader
Expand All @@ -120,9 +121,9 @@ COMMANDS += state
COMMANDS += txpool
COMMANDS += verkle
COMMANDS += evm
COMMANDS += lightclient
COMMANDS += sentinel
COMMANDS += erigon-el
COMMANDS += erigon-el
COMMANDS += caplin-phase1

# build each command using %.cmd rule
$(COMMANDS): %: %.cmd
Expand All @@ -136,6 +137,7 @@ db-tools:

go mod vendor
cd vendor/github.com/torquem-ch/mdbx-go && MDBX_BUILD_TIMESTAMP=unknown make tools
mkdir -p $(GOBIN)
cd vendor/github.com/torquem-ch/mdbx-go/mdbxdist && cp mdbx_chk $(GOBIN) && cp mdbx_copy $(GOBIN) && cp mdbx_dump $(GOBIN) && cp mdbx_drop $(GOBIN) && cp mdbx_load $(GOBIN) && cp mdbx_stat $(GOBIN)
rm -rf vendor
@echo "Run \"$(GOBIN)/mdbx_stat -h\" to get info about mdbx db file."
Expand Down Expand Up @@ -166,7 +168,7 @@ lintci:
## lintci-deps: (re)installs golangci-lint to build/bin/golangci-lint
lintci-deps:
rm -f ./build/bin/golangci-lint
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b ./build/bin v1.51.1
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b ./build/bin v1.52.2

## clean: cleans the go cache, build dir, libmdbx db dir
clean:
Expand All @@ -181,10 +183,10 @@ devtools:
# Notice! If you adding new binary - add it also to cmd/hack/binary-deps/main.go file
$(GOBUILD) -o $(GOBIN)/go-bindata github.com/kevinburke/go-bindata/go-bindata
$(GOBUILD) -o $(GOBIN)/gencodec github.com/fjl/gencodec
$(GOBUILD) -o $(GOBIN)/codecgen github.com/ugorji/go/codec/codecgen
$(GOBUILD) -o $(GOBIN)/abigen ./cmd/abigen
$(GOBUILD) -o $(GOBIN)/codecgen github.com/ugorji/go/codec/codecgen
PATH=$(GOBIN):$(PATH) go generate ./common
PATH=$(GOBIN):$(PATH) go generate ./core/types
# PATH=$(GOBIN):$(PATH) go generate ./core/types
PATH=$(GOBIN):$(PATH) go generate ./consensus/aura/...
#PATH=$(GOBIN):$(PATH) go generate ./eth/ethconfig/...
@type "npm" 2> /dev/null || echo 'Please install node.js and npm'
Expand Down Expand Up @@ -214,7 +216,7 @@ git-submodules:
@git submodule update --quiet --init --recursive --force || true

PACKAGE_NAME := github.com/ledgerwatch/erigon
GOLANG_CROSS_VERSION ?= v1.19.5
GOLANG_CROSS_VERSION ?= v1.20.2

.PHONY: release-dry-run
release-dry-run: git-submodules
Expand Down
89 changes: 51 additions & 38 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Erigon

Erigon is an implementation of Ethereum (execution client with light client for consensus layer), on the efficiency frontier. [Archive Node](https://ethereum.org/en/developers/docs/nodes-and-clients/archive-nodes/#what-is-an-archive-node) by default.
Erigon is an implementation of Ethereum (execution client with light client for consensus layer), on the efficiency
frontier. [Archive Node](https://ethereum.org/en/developers/docs/nodes-and-clients/archive-nodes/#what-is-an-archive-node)
by default.

![Build status](https://github.com/ledgerwatch/erigon/actions/workflows/ci.yml/badge.svg)

Expand All @@ -24,7 +26,7 @@ Erigon is an implementation of Ethereum (execution client with light client for
+ [Faster Initial Sync](#faster-initial-sync)
+ [JSON-RPC daemon](#json-rpc-daemon)
+ [Run all components by docker-compose](#run-all-components-by-docker-compose)
+ [Grafana dashboar god](#grafana-dashboard)
+ [Grafana dashboard](#grafana-dashboard)
- [Documentation](#documentation)
- [FAQ](#faq)
- [Getting in touch](#getting-in-touch)
Expand All @@ -39,7 +41,8 @@ Erigon is an implementation of Ethereum (execution client with light client for
**Disclaimer**: this software is currently a tech preview. We will do our best to keep it stable and make no breaking
changes but we don't guarantee anything. Things can and will break.

**Important defaults**: Erigon is an Archive Node by default (to remove history see: `--prune` flags in `erigon --help`). We don't allow change this flag after first start.
**Important defaults**: Erigon is an Archive Node by default (to remove history see: `--prune` flags
in `erigon --help`). We don't allow change this flag after first start.

<code>In-depth links are marked by the microscope sign (🔬) </code>

Expand All @@ -54,16 +57,16 @@ System Requirements

* Gnosis Chain Archive: 370GB (January 2023).

* BSC Archive: 7TB. BSC Full: 1TB.
* BSC Archive: 7TB. BSC Full: 1TB. (April 2022).

* Polygon Mainnet Archive: 5TB. Polygon Mumbai Archive: 1TB.
* Polygon Mainnet Archive: 5TB. Polygon Mumbai Archive: 1TB. (April 2022).

SSD or NVMe. Do not recommend HDD - on HDD Erigon will always stay N blocks behind chain tip, but not fall behind.
Bear in mind that SSD performance deteriorates when close to capacity.

RAM: >=16GB, 64-bit architecture.

[Golang version >= 1.18](https://golang.org/doc/install); GCC 10+ or Clang; On Linux: kernel > v4
[Golang version >= 1.19](https://golang.org/doc/install); GCC 10+ or Clang; On Linux: kernel > v4

<code>🔬 more details on disk storage [here](https://erigon.substack.com/p/disk-footprint-changes-in-new-erigon?s=r)
and [here](https://ledgerwatch.github.io/turbo_geth_release.html#Disk-space).</code>
Expand Down Expand Up @@ -94,39 +97,41 @@ make erigon
./build/bin/erigon
```

Default `--snapshots` for `mainnet`, `goerli`, `gnosis`, `bsc`. Other networks now have default `--snapshots=false`. Increase
Default `--snapshots` for `mainnet`, `goerli`, `gnosis`, `bsc`. Other networks now have default `--snapshots=false`.
Increase
download speed by flag `--torrent.download.rate=20mb`. <code>🔬 See [Downloader docs](./cmd/downloader/readme.md)</code>

Use `--datadir` to choose where to store data.

Use `--chain=gnosis` for [Gnosis Chain](https://www.gnosis.io/), `--chain=bor-mainnet` for Polygon Mainnet, and `--chain=mumbai` for Polygon Mumbai.
For Gnosis Chain you need a [Consensus Layer](#beacon-chain-consensus-layer) client alongside Erigon (https://docs.gnosischain.com/node/guide/beacon).
Use `--chain=gnosis` for [Gnosis Chain](https://www.gnosis.io/), `--chain=bor-mainnet` for Polygon Mainnet,
and `--chain=mumbai` for Polygon Mumbai.
For Gnosis Chain you need a [Consensus Layer](#beacon-chain-consensus-layer) client alongside
Erigon (https://docs.gnosischain.com/node/guide/beacon).

Running `make help` will list and describe the convenience commands available in the [Makefile](./Makefile).

### Datadir structure

- chaindata: recent blocks, state, recent state history. low-latency disk recommended.
- chaindata: recent blocks, state, recent state history. low-latency disk recommended.
- snapshots: old blocks, old state history. can symlink/mount it to cheaper disk. mostly immutable.
- temp: can grow to ~100gb, but usually empty. can symlink/mount it to cheaper disk.
- txpool: pending transactions. safe to remove.
- nodes: p2p peers. safe to remove.


### Logging

_Flags:_

- `verbosity`
- `log.console.verbosity` (overriding alias for `verbosity`)
- `log.json`
- `log.console.json` (alias for `log.json`)
- `log.dir.path`
- `log.dir.verbosity`
- `log.dir.json`
_Flags:_

- `verbosity`
- `log.console.verbosity` (overriding alias for `verbosity`)
- `log.json`
- `log.console.json` (alias for `log.json`)
- `log.dir.path`
- `log.dir.verbosity`
- `log.dir.json`

In order to log only to the stdout/stderr the `--verbosity` (or `log.console.verbosity`) flag can be used to supply an int value specifying the highest output log level:
In order to log only to the stdout/stderr the `--verbosity` (or `log.console.verbosity`) flag can be used to supply an
int value specifying the highest output log level:

```
LvlCrit = 0
Expand All @@ -137,9 +142,12 @@ In order to log only to the stdout/stderr the `--verbosity` (or `log.console.ver
LvlTrace = 5
```

To set an output dir for logs to be collected on disk, please set `--log.dir.path`. The flag `--log.dir.verbosity` is also available to control the verbosity of this logging, with the same int value as above, or the string value e.g. 'debug' or 'info'. Default verbosity is 'debug' (4), for disk logging.
To set an output dir for logs to be collected on disk, please set `--log.dir.path`. The flag `--log.dir.verbosity` is
also available to control the verbosity of this logging, with the same int value as above, or the string value e.g. '
debug' or 'info'. Default verbosity is 'debug' (4), for disk logging.

Log format can be set to json by the use of the boolean flags `log.json` or `log.console.json`, or for the disk output `--log.dir.json`.
Log format can be set to json by the use of the boolean flags `log.json` or `log.console.json`, or for the disk
output `--log.dir.json`.

### Modularity

Expand All @@ -151,9 +159,10 @@ How to start Erigon's services as separated processes, see in [docker-compose.ym

### Embedded Consensus Layer

By default, on Ethereum Mainnet, Görli, and Sepolia, the Engine API is disabled in favour of the Erigon native Embedded Consensus Layer.
If you want to use an external Consensus Layer, run Erigon with flag `--externalcl`.
_Warning:_ Staking (block production) is not possible with the embedded CL – use `--externalcl` instead.
On Ethereum Mainnet, Görli, and Sepolia, the Engine API can be disabled in favour of the Erigon native Embedded
Consensus Layer.
If you want to use the internal Consensus Layer, run Erigon with flag `--internalcl`.
_Warning:_ Staking (block production) is not possible with the embedded CL.

### Testnets

Expand Down Expand Up @@ -202,7 +211,7 @@ Windows users may run erigon in 3 possible ways:
build on windows :
* [Git](https://git-scm.com/downloads) for Windows must be installed. If you're cloning this repository is very
likely you already have it
* [GO Programming Language](https://golang.org/dl/) must be installed. Minimum required version is 1.18
* [GO Programming Language](https://golang.org/dl/) must be installed. Minimum required version is 1.19
* GNU CC Compiler at least version 10 (is highly suggested that you install `chocolatey` package manager - see
following point)
* If you need to build MDBX tools (i.e. `.\wmake.ps1 db-tools`)
Expand Down Expand Up @@ -369,7 +378,8 @@ Examples of stages are:

### JSON-RPC daemon

Most of Erigon's components (txpool, rpcdaemon, snapshots downloader, sentry, ...) can work inside Erigon and as independent process.
Most of Erigon's components (txpool, rpcdaemon, snapshots downloader, sentry, ...) can work inside Erigon and as
independent process.

To enable built-in RPC server: `--http` and `--ws` (sharing same port with http)

Expand Down Expand Up @@ -492,7 +502,8 @@ Windows support for docker-compose is not ready yet. Please help us with .ps1 po

`docker-compose up prometheus grafana`, [detailed docs](./cmd/prometheus/Readme.md).

###
###

old data

Disabled by default. To enable see `./build/bin/erigon --help` for flags `--prune`
Expand All @@ -518,7 +529,7 @@ FAQ

Detailed explanation: [./docs/programmers_guide/db_faq.md](./docs/programmers_guide/db_faq.md)

### Default Ports and Protocols / Firewalls?
### Default Ports and Firewalls

#### `erigon` ports

Expand Down Expand Up @@ -558,12 +569,11 @@ Port

#### `sentinel` ports

| Port | Protocol | Purpose | Expose |
|:-----:|:---------:|:----------------:|:-------:|
| 4000 | UDP | Peering | Public |
| 4001 | TCP | Peering | Public |
| 7777 | TCP | gRPC Connections | Private |

| Port | Protocol | Purpose | Expose |
|:----:|:--------:|:----------------:|:-------:|
| 4000 | UDP | Peering | Public |
| 4001 | TCP | Peering | Public |
| 7777 | TCP | gRPC Connections | Private |

#### Other ports

Expand All @@ -577,12 +587,13 @@ you'll have to change one if you want to run both at the same time. use `--help`

Reserved for future use: **gRPC ports**: `9092` consensus engine, `9093` snapshot downloader, `9094` TxPool

Hetzner may want strict firewall rules, like:
#### Hetzner expecting strict firewall rules

```
0.0.0.0/8 "This" Network RFC 1122, Section 3.2.1.3
10.0.0.0/8 Private-Use Networks RFC 1918
100.64.0.0/10 Carrier-Grade NAT (CGN) RFC 6598, Section 7
127.0.0.0/8 Loopback RFC 1122, Section 3.2.1.3
127.16.0.0/12 Private-Use Networks RFC 1918
169.254.0.0/16 Link Local RFC 3927
172.16.0.0/12 Private-Use Networks RFC 1918
192.0.0.0/24 IETF Protocol Assignments RFC 5736
Expand All @@ -599,6 +610,8 @@ Hetzner may want strict firewall rules, like:
RFC 922, Section 7
```

Same in [IpTables syntax](https://ethereum.stackexchange.com/questions/6386/how-to-prevent-being-blacklisted-for-running-an-ethereum-client/13068#13068)

### How to get diagnostic for bug report?

- Get stack trace: `kill -SIGUSR1 <pid>`, get trace and stop: `kill -6 <pid>`
Expand Down
Loading