• Stars
    star
    550
  • Rank 78,144 (Top 2 %)
  • Language
    Nim
  • License
    Apache License 2.0
  • Created over 6 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Nimbus: an Ethereum Execution Client for Resource-Restricted Devices

Nimbus: ultra-light Ethereum execution layer client

License: Apache License: MIT GH action-nimbus-eth1 GH action-fluffy

Discord: Nimbus Status: #nimbus-general

Introduction

This repository contains development work on an execution-layer client to pair with our consensus-layer client. This client focuses on efficiency and security and strives to be as light-weight as possible in terms of resources used.

This repository is also home to:

All consensus-layer client development is happening in parallel in the nimbus-eth2 repository.

Development Updates

Monthly development updates are shared here.

Some recent highlights include:

  • Renewed funding from the EF to accelerate development
  • Completed Berlin and London fork compatibility (EIP-1559). It now passes nearly all the EF Hive testsuite, and 100% of contract execution tests (47,951 tests)
  • New GraphQL and WebSocket APIs, complementing JSON-RPC
  • EVMC compatibility, supporting third-party optimised EVM plugins
  • Up to 100x memory saving during contract executions
  • Asynchronous EVM to execute many contracts in parallel, while they wait for data from the network
  • Proof-of-authority validation for the Goerli test network
  • Updated network protocols, to work with the latest eth/65-66 and snap/1 protocols
  • A prototype new mechanism for state sync which combines what have been called Fast sync, Snap sync and Beam sync in a self-tuning way, and allows the user to participate in the network (read accounts, run transactions etc.) while sync is still in progress
  • A significant redesign of the storage database to use less disk space and run faster.

For more detailed write-ups on the development progress, follow the Nimbus blog.

Building & Testing

Prerequisites

  • RocksDB
  • GNU Make, Bash and the usual POSIX utilities. Git 2.9.4 or newer.

On Windows, a precompiled DLL collection download is available through the fetch-dlls Makefile target: (Windows instructions).

# MacOS with Homebrew
brew install rocksdb

# Fedora
dnf install rocksdb-devel

# Debian and Ubuntu
sudo apt-get install librocksdb-dev

# Arch (AUR)
pakku -S rocksdb

rocksdb can also be installed by following their instructions.

Obtaining the prerequisites through the Nix package manager

Experimental

Users of the Nix package manager can install all prerequisites simply by running:

nix-shell default.nix

Build & Develop

POSIX-compatible OS

# The first `make` invocation will update all Git submodules.
# You'll run `make update` after each `git pull`, in the future, to keep those submodules up to date.
# Assuming you have 4 CPU cores available, you can ask Make to run 4 parallel jobs, with "-j4".

make -j4 nimbus

# See available command line options
build/nimbus --help

# Start syncing with mainnet
build/nimbus

# Update to latest version
git pull
make -j4 update

# Run tests
make test

To run a command that might use binaries from the Status Nim fork:

./env.sh bash # start a new interactive shell with the right env vars set
which nim
nim --version

# or without starting a new interactive shell:
./env.sh which nim
./env.sh nim --version

Our Wiki provides additional helpful information for debugging individual test cases and for pairing Nimbus with a locally running copy of Geth.

Windows

(Experimental support!)

Install Mingw-w64 for your architecture using the "MinGW-W64 Online Installer" (first link under the directory listing). Run it and select your architecture in the setup menu ("i686" on 32-bit, "x86_64" on 64-bit), set the threads to "win32" and the exceptions to "dwarf" on 32-bit and "seh" on 64-bit. Change the installation directory to "C:\mingw-w64" and add it to your system PATH in "My Computer"/"This PC" -> Properties -> Advanced system settings -> Environment Variables -> Path -> Edit -> New -> C:\mingw-w64\mingw64\bin (it's "C:\mingw-w64\mingw32\bin" on 32-bit)

Install Git for Windows and use a "Git Bash" shell to clone and build Nimbus.

Install cmake.

If you don't want to compile RocksDB and SQLite separately, you can fetch pre-compiled DLLs with:

mingw32-make fetch-dlls # this will place the right DLLs for your architecture in the "build/" directory

You can now follow those instructions in the previous section by replacing make with mingw32-make (regardless of your 32-bit or 64-bit architecture):

mingw32-make nimbus # build the Nimbus binary
mingw32-make test # run the test suite
# etc.

Raspberry PI

Experimental The code can be compiled on a Raspberry PI:

  • Raspberry PI 3b+
  • 64gb SD Card (less might work too, but the default recommended 4-8GB will probably be too small)
  • Rasbian Buster Lite - Lite version is enough to get going and will save some disk space!

Assuming you're working with a freshly written image:

# Start by increasing swap size to 2gb:
sudo vi /etc/dphys-swapfile
# Set CONF_SWAPSIZE=2048
# :wq
sudo reboot

# Install prerequisites
sudo apt-get install git libgflags-dev libsnappy-dev

mkdir status
cd status

# Install rocksdb
git clone https://github.com/facebook/rocksdb.git
cd rocksdb
make shared_lib
sudo make install
cd..

# Raspberry pi doesn't include /usr/local/lib in library search path - need to add
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH

git clone https://github.com/status-im/nimbus.git

cd nimbus

# Follow instructions above!

Android

Experimental Code can be compiled and run on Android devices

Environment setup
  • Install the Termux app from FDroid or the Google Play store
  • Install a PRoot of your choice following the instructions for your preferred distribution. Note, the Ubuntu PRoot is known to contain all Nimbus prerequisites compiled on Arm64 architecture (common architecture for Android devices). Depending on the distribution, it may require effort beyond the scope of this guide to get all prerequisites.

Assuming Ubuntu PRoot is used

# Install prerequisites
apt install librocksdb-dev

# Clone repo and build Nimbus just like above
git clone https://github.com/status-im/nimbus.git

cd nimbus

make

make nimbus

build/nimbus

Experimental make variables

Apart from standard Make flags (see link in the next chapter), the following Make variables can be set to control which version of a virtual engine is compiled. The variables are listed with decreasing priority (in case of doubt, the lower prioritised variable is ignored when the higher on is available.)

  • BOEHM_GC=1
    Change garbage collector to boehm. This might help debugging in certain cases when the gc is involved in a memory corruption or corruption camouflage.

  • ENABLE_CHUNKED_RLPX=0
    Disable legacy chunked RLPx messages which are enabled by default for synchronising against Nethermind nodes

  • ENABLE_EVMC=1
    Enable mostly EVMC compliant wrapper around the native Nim VM

  • ENABLE_VM2LOWMEM=1
    Enable new re-factored version of the native Nim VM. This version is not optimised and coded in a way so that low memory compilers can handle it (observed on 32 bit windows 7.)

  • ENABLE_VM2=1
    Enable new re-factored version of the native Nim VM.

For these variables, using <variable>=0 is ignored and <variable>=2 has the same effect as <variable>=1 (ditto for other numbers.)

Development tips

Interesting Make variables and targets are documented in the nimbus-build-system repo.

  • you can switch the DB backend with a Nim compiler define: -d:nimbus_db_backend=... where the (case-insensitive) value is one of "rocksdb" (the default), "sqlite", "lmdb"

  • the Premix debugging tools are documented separately

  • you can control the Makefile's verbosity with the V variable (defaults to 0):

make V=1 # verbose
make V=2 test # even more verbose
make LOG_LEVEL=DEBUG nimbus # this is the default
make LOG_LEVEL=TRACE nimbus # log everything
  • pass arbitrary parameters to the Nim compiler:
make NIMFLAGS="-d:release"
  • if you want to use SSH keys with GitHub (also handles submodules):
make github-ssh
  • force a Nim compiler rebuild:
rm vendor/Nim/bin/nim
make -j8 build-nim
  • some programs in the tests subdirectory do a replay of blockchain database dumps when compiled and run locally. The dumps are found in this module which need to be cloned as nimbus-eth1-blobs parellel to the nimbus-eth1 file system root.

Git submodule workflow

Working on a dependency:

cd vendor/nim-chronicles
git checkout -b mybranch
# make some changes
git status
git commit -a
git push origin mybranch
# create a GitHub PR and wait for it to be approved and merged
git checkout master
git pull
git branch -d mybranch
# realise that the merge was done without "--no-ff"
git branch -D mybranch
# update the submodule's commit in the superproject
cd ../..
git status
git add vendor/nim-chronicles
git commit

It's important that you only update the submodule commit after it's available upstream.

You might want to do this on a new branch of the superproject, so you can make a GitHub PR for it and see the CI test results.

Don't update all Git submodules at once, just because you found the relevant Git command or make target. You risk updating submodules to other people's latest commits when they are not ready to be used in the superproject.

Adding the submodule "https://github.com/status-im/foo" to "vendor/foo":

vendor/nimbus-build-system/scripts/add_submodule.sh status-im/foo
# or
./env.sh add_submodule status-im/foo
# want to place it in "vendor/bar" instead?
./env.sh add_submodule status-im/foo vendor/bar

Removing the submodule "vendor/bar":

git submodule deinit -f -- vendor/bar
git rm -f vendor/bar

Checking out older commits, either to bisect something or to reproduce an older build:

git checkout <commit hash here>
make clean
make -j8 update

Running a dependency's test suite using nim instead of nimble (which cannot be convinced not to run a dependency check, thus clashing with our jury-rigged "vendor/.nimble/pkgs"):

cd vendor/nim-rocksdb
../nimbus-build-system/scripts/nimble.sh test
# or
../../env.sh nimble test

Metric visualisation

Install Prometheus and Grafana. On Gentoo, it's emerge prometheus grafana-bin.

# build Nimbus
make nimbus
# the Prometheus daemon will create its data dir in the current dir, so give it its own directory
mkdir ../my_metrics
# copy the basic config file over there
cp -a examples/prometheus.yml ../my_metrics/
# start Prometheus in a separate terminal
cd ../my_metrics
prometheus --config.file=prometheus.yml # loads ./prometheus.yml, writes metric data to ./data
# start a fresh Nimbus sync and export metrics
rm -rf ~/.cache/nimbus/db; ./build/nimbus --prune:archive --metricsServer

Start the Grafana server. On Gentoo it's /etc/init.d/grafana start. Go to http://localhost:3000, log in with admin:admin and change the password.

Add Prometheus as a data source. The default address of http://localhost:9090 is OK, but Grafana 6.3.5 will not apply that semitransparent default you see in the form field, unless you click on it.

Create a new dashboard. Click on its default title in the upper left corner ("New Dashboard"). In the new page, click "Import dashboard" in the right column and upload "examples/Nimbus-Grafana-dashboard.json".

In the main panel, there's a hidden button used to assign metrics to the left or right Y-axis - it's the coloured line on the left of the metric name, in the graph legend.

To see a single metric, click on its name in the legend. Click it again to go back to the combined view. To edit a panel, click on its title and select "Edit".

Obligatory screenshot.

Troubleshooting

Report any errors you encounter, please, if not already documented!

  • Turn it off and on again:
make clean
make update

License

Licensed and distributed under either of

or

at your option. These files may not be copied, modified, or distributed except according to those terms.

More Repositories

1

status-mobile

a free (libre) open source, mobile OS for Ethereum
Clojure
3,822
star
2

react-native-desktop-qt

A Desktop port of React Native, driven by Qt, forked from Canonical
JavaScript
1,194
star
3

status-go

The Status module that consumes go-ethereum
Go
715
star
4

nimbus-eth2

Nim implementation of the Ethereum Beacon Chain
Nim
489
star
5

nim-chronos

Chronos - An efficient library for asynchronous programming
Nim
343
star
6

status-desktop

Status Desktop client made in Nim & QML
QML
259
star
7

status-keycard

Our Javacard Implementation for making secure transactions within Status and Ethereum
Java
195
star
8

status-network-token

Smart Contracts for the Status Contribution Period, along with Genesis and Network Tokens
JavaScript
148
star
9

nim-chronicles

A crafty implementation of structured logging for Nim.
Nim
138
star
10

open-bounty

Enable communities to distribute funds to push their cause forward.
JavaScript
119
star
11

nim-stew

stew is collection of utilities, std library extensions and budding libraries that are frequently used at Status, but are too small to deserve their own git repository.
Nim
119
star
12

doubleratchet

The Double Ratchet Algorithm implementation in Go
Go
108
star
13

nim-faststreams

Nearly zero-overhead input/output streams for Nim
Nim
107
star
14

nim-taskpools

Lightweight, energy-efficient, easily auditable threadpool
Nim
98
star
15

swarms

Swarm Home. New, completed and in-progress features for Status
HTML
92
star
16

contracts

Python
87
star
17

nim-json-rpc

Nim library for implementing JSON-RPC clients and servers
Nim
84
star
18

status-web

TypeScript
77
star
19

nim-websock

Websocket for Nim
Nim
74
star
20

questionable

Elegant optional types for Nim
Nim
73
star
21

nim-stint

Stack-based arbitrary-precision integers - Fast and portable with natural syntax for resource-restricted devices.
Nim
73
star
22

nim-eth

Common utilities for Ethereum
Nim
69
star
23

nim-graphql

Nim implementation of GraphQL with sugar and steroids
Nim
64
star
24

nim-drchaos

A powerful and easy-to-use fuzzing framework in Nim for C/C++/Obj-C targets
Nim
63
star
25

clj-rn

A utility for building ClojureScript-based React Native apps
Clojure
56
star
26

nim-confutils

Simplified handling of command line options and config files
Nim
56
star
27

nim-serialization

A modern and extensible serialization framework for Nim
Nim
54
star
28

nim-presto

REST API framework for Nim language
Nim
47
star
29

keycard-cli

A command line tool and shell to manage keycards
Go
45
star
30

nim-json-serialization

Flexible JSON serialization not relying on run-time type information
Nim
39
star
31

nim-quic

QUIC for Nim
Nim
39
star
32

keycard-go

Go pkg to interact with the Status Keycard
Go
39
star
33

nim-metrics

Nim metrics client library supporting the Prometheus monitoring toolkit, StatsD and Carbon
Nim
38
star
34

nim-web3

Nim
37
star
35

nim-bearssl

BearSSL wrapper in Nim
C
37
star
36

ETHPrize-interviews

A repository for the ETHPrize website.
HTML
36
star
37

nim-codex

Decentralized Durability Engine
Nim
36
star
38

nim-toml-serialization

Flexible TOML serialization [not] relying on run-time type information.
Nim
34
star
39

hackathon

Status API Hackathon
JavaScript
32
star
40

nim-rocksdb

Nim wrapper for RocksDB, a persistent key-value store for Flash and RAM Storage.
Nim
29
star
41

nim-daemon

Cross-platform process daemonization library for Nim language
Nim
28
star
42

status-electron

[OUTDATED NOT SUPPORTED] Status Electron (React Native Web and Electron)
Clojure
27
star
43

nim-style-guide

Status style guid for the Nim language
Nim
26
star
44

StatusQ

Reusable Status QML components
QML
26
star
45

status-teller-network

DApp which provides a platform for borderless, peer-to-peer, fiat-to-crypto echanges that allows Stakeholders to find nearby users to exchange their cash for digital assets and currency.
JavaScript
26
star
46

nim-decimal

A correctly-rounded arbitrary precision decimal floating point arithmetic library
C
26
star
47

codex-research

Codex durability engine research
Jupyter Notebook
25
star
48

nim-http-utils

Nim language HTTP helper procedures
Nim
25
star
49

vyper-debug

Easy to use Vyper debugger | vdb (https://github.com/ethereum/vyper)
Python
24
star
50

react-native-status-keycard

React Native library to interact with Status Keycard using NFC connection
Java
24
star
51

nim-unittest2

Beautiful and efficient unit testing for Nim evolved from the standard library `unittest` module
Nim
24
star
52

mingw-windows10-uwp

Minimal Windows 10 Store ready sample of MinGW dll PInvoked from Windows 10 UWP application
C#
24
star
53

wiki.status.im

It's the wiki... for Status
HTML
24
star
54

nim-snappy

Nim implementation of Snappy compression algorithm
Nim
24
star
55

CryptoLife

A repo for all the #CryptoLife Hackathon submissions, The National House Smichov, Prague, 26-28th October 2018.
23
star
56

status-chat-widget

Easily embed a status chatroom in your website - outdated, please use https://github.com/status-im/js-waku
JavaScript
22
star
57

nim-blscurve

Nim implementation of BLS signature scheme (Boneh-Lynn-Shacham) over Barreto-Lynn-Scott (BLS) curve BLS12-381
C
22
star
58

keycard-connect

Keycard + WalletConnect
Kotlin
21
star
59

nimplay

Nim Ethereum Contract DSL. Targeting eWASM.
Nim
20
star
60

whisper-tutorial

Whisper Tutorial using web3js
JavaScript
20
star
61

nim-cookbook

Nim
20
star
62

ens-usernames

DApp to register usernames for Status Network
JavaScript
19
star
63

status-keycard-java

Java SDK for the Status Keycard
Java
19
star
64

Keycard.swift

Swift
19
star
65

account-contracts

Key managers, recovery, gas abstraction and self-sovereign identity for web3 universal login.
Solidity
19
star
66

ethereumj-personal

EthereumJ for Personal Devices DEPRECATED
Java
19
star
67

liquid-funding

Dapp for delegating donations to projects
JavaScript
19
star
68

nim-protobuf-serialization

Nim
17
star
69

nim-testutils

testrunner et al
Nim
17
star
70

general-market-framework

A Generalised Market Framework for Ethereum
Python
16
star
71

nim-libbacktrace

Nim wrapper for libbacktrace
C
16
star
72

wallet

CSS
16
star
73

react-native-transparent-video

React Native video player with alpha channel (alpha-packing) support.
Java
16
star
74

go-maven-resolver

Tool for resolving Java Maven dependencies
Go
15
star
75

murmur

WIP - Whisper node / client implementation built in javascript
JavaScript
15
star
76

bigbrother-specs

Research and specification for Big Brother protocol
14
star
77

status-dev-cli

Status command-line tools
JavaScript
14
star
78

nim-evmc

Nim EVMC - Ethereum VM binary compatible interface
Nim
14
star
79

keycard-installer-android

discontinued, use https://github.com/status-im/keycard-cli - Keycard applet installer over NFC
Java
14
star
80

specs

Specifications for Status clients.
HTML
14
star
81

nescience

A Zero-Knowledge Toolkit
Nim
13
star
82

move

MOVΞ - A Decentralised Ride Sharing DApp
JavaScript
13
star
83

geth_exporter

geth metrics exporter for Prometheus
Go
13
star
84

autobounty

Github bot that automatically funds https://openbounty.status.im bounties
JavaScript
13
star
85

status-security

Repository for all Status Network related security information
JavaScript
13
star
86

snt-gas-relay

SNT Gas Relay
JavaScript
13
star
87

nim-ttmath

C++
12
star
88

nim-eth-p2p

Nim Ethereum P2P protocol implementation
Nim
11
star
89

keycard-redeem

TypeScript
11
star
90

status-github-bot

A bot for github
JavaScript
11
star
91

syng-client

The Mobile Client for the Ethereum Network DEPRECATED
Java
11
star
92

dreddit-devcon

JavaScript
11
star
93

keycard-pro

WIP
C
11
star
94

embark-status

Provides an ability to debug Embark DApps in Status
JavaScript
11
star
95

pluto

Clojure
11
star
96

snt-voting

JavaScript
11
star
97

nimbus-launch

Jumpstart your Nim project at Status
Nim
11
star
98

nim-eth-contracts

Ethereum smart contracts in Nim
Nim
10
star
99

translate.status.im

Help translate Status into your language!
JavaScript
10
star
100

nim-ssz-serialization

Nim implementation of Simple Serialize (SSZ) serialization and merkleization
Nim
10
star