This page contains tips and tricks for developers, further resources, along with information on how to set up your build environment on your platform.
Before building Nimbus for the first time, make sure to install the prerequisites.
The code follows the Status Nim Style Guide.
The git repository has 3 main branches,
unstable as well as feature and bugfix branches.
unstable branch contains features and bugfixes that are actively being tested and worked on.
- Features and bugfixes are generally pushed to individual branches, each with their own pull request against the
- Once the branch has been reviewed and passed CI, the developer or reviewer merges the branch to
unstablebranch is regularly deployed to the Nimbus Prater fleet where additional testing happens.
testing branch contains features and bugfixes that have gone through CI and initial testing on the
unstable branch and are ready to be included in the next release.
- After testing a bugfix or feature on
unstable, the features and fixes that are planned for the next release get merged to the
testingbranch either by the release manager or team members.
testingbranch is regularly deployed to the Nimbus prater fleet as well as a smaller mainnet fleet.
- The branch should remain release-ready at most times.
stable branch tracks the latest released version of Nimbus and is suitable for mainnet staking.
You can now follow the instructions in this this book by replacing
mingw32-make (you should run
mingw32 regardless of whether you're running 32-bit or 64-bit architecture):
After cloning the repo:
Nimbus comes with a build environment similar to Python venv - this helps ensure that the correct version of Nim is used and that all dependencies can be found.
./env.sh bash # start a new interactive shell with the right env vars set which nim nim --version # Nimbus is tested and supported on 1.2.12 at the moment # or without starting a new interactive shell: ./env.sh which nim ./env.sh nim --version # Start Visual Studio code with environment ./env.sh code
Makefile tips and tricks for developers
- build all those tools known to the Makefile:
- build a specific tool:
- you can control the Makefile's verbosity with the V variable (defaults to 0):
- same for the Chronicles log level:
- pass arbitrary parameters to the Nim compiler:
- you can freely combine those variables on the
-march=nativebecause you want to run the binary on a different machine than the one you're building it on:
- disable link-time optimisation (LTO):
- show C compiler warnings:
- limit stack usage to 1 MiB per C function (static analysis - see the GCC docs; if LTO is enabled, it works without
- build a static binary:
- publish a book using mdBook from sources in "docs/" to GitHub pages:
- create a binary distribution:
Multi-client interop scripts
This repository contains a set of scripts used by the client implementation teams to test interop between the clients (in certain simplified scenarios). It mostly helps us find and debug issues.
Stress-testing the client by limiting the CPU power
The limiting is provided by the cpulimit utility, available on Linux and macOS. The specified value is a percentage of a single CPU core. Usually 1 - 100, but can be higher on multi-core CPUs.
Build and run the local beacon chain simulation
The beacon chain simulation runs several beacon nodes on the local machine, attaches several local validators to each, and builds a beacon chain between them.
To run the simulation:
To clean the previous run's data:
To change the number of validators and nodes:
You’ll get something like this (click for full size):
You can find out more about the beacon node simulation here.
Build and run the local state transition simulation
This simulation is primarily designed for researchers, but we'll cover it briefly here in case you're curious :)
The state transition simulation quickly runs the beacon chain state transition function in isolation and outputs JSON snapshots of the state (directly to the
nimbus-eth2 directory). It runs without networking and blocks are processed without slot time delays.
Use the output of the
help command to pass desired values to the simulator - experiment with changing the number of slots, validators, , etc. to get different results.
The most important options are:
slots: the number of slots to run the simulation for (default 192)
validators: the number of validators (default 6400)
attesterRatio: the expected fraction of attesters that actually do their work for every slot (default 0.73)
json_interval: how often JSON snapshots of the state are outputted (default every 32 slots -- or once per epoch)
For example, to run the state simulator for 384 slots, with 20,000 validators, and an average of 66% of attesters doing their work every slot, while outputting snapshots of the state twice per epoch, run: