Running a node
The latest binaries can be found on the Github release page.
- goos:
linux/darwin
; - goarch:
amd64
;
The binaries can be built from the source using the make commands (Golang version 1.14 or greater is required):
- Get the source:
go get github.com/hermeznetwork/hermez-node
; - Run
make build
; - The binaries are located into the
bin/
folder; - Check the version
/bin/node version
;
Running the node requires a PostgreSQL database.
For local development proposes the PostgreSQL with docker can be easily run (don't forget to change the password!):
$ docker run --rm --name hermez-db -p 5432:5432 -e POSTGRES_DB=hermez -e POSTGRES_USER=hermez -e POSTGRES_PASSWORD="<POSTGRES_PASSWORD>" -d postgres
After spinning up the database, you must edit the following parameters into the cfg.buidler.toml
config file:
[StateDB]
Path = "<STATE_DB_DIRECTORY>/statedb"
[PostgreSQL]
PortWrite = <POSTGRES_PORT>
HostWrite = "<POSTGRES_HOST>"
UserWrite = "hermez"
PasswordWrite = "<POSTGRES_PASSWORD>"
NameWrite = "hermez"
[Web3]
URL = "<GETH_RPC_URL>"
The other values are already configured for the Rinkeby testnet. For the Mainnet usage, you must change the contract addresses for the Hermez Mainnet.
There is more information about the config file parameters into cli/node/README.md.
After setting the config, you can build and run the Hermez Node as a synchronizer:
$ bin/node run --mode sync --cfg cfg.buidler.toml
The description of the config parameters can be found here.