Grandine: A fast & Lightweight Ethereum Consensus Client

What is Grandine?

Grandine is a project that places a premium on the authenticity of its core implementations, priding itself on its original consensus frameworks. However, it owes much of its robustness and functionality to the vibrant ecosystem of community-built crates. Take, for instance, its utilization of rust-libp2p networking libraries, initially crafted by the esteemed Lighthouse team.

From the project's inception, Grandine embraced Lighthouse's eth2_libp2p library, which, though initially generic, has been tailored to Grandine's needs through a dedicated fork. Moreover, Grandine owes a debt of gratitude to the libmdbx-rs bindings library, nurtured by the diligent Akula maintainer. While the project initially relied on this library, it now thrives on a fork maintained by the esteemed Reth team. This symbiotic relationship between Grandine and these external contributions is a testament to the collaborative spirit of the open-source community.

While Grandine's primary focus remains on nurturing its original consensus core, it is equally enthusiastic about integrating outstanding crates from other client teams and the broader community. In essence, Grandine recognizes that its strength lies not only in its unique offerings but also in its ability to leverage the collective expertise and efforts of fellow developers. Thus, it extends a heartfelt appreciation to all those who have contributed to its journey thus far, acknowledging that without their support, Grandine would not have achieved its current standing.

Performance

Grandine is a optimised and parallelised client. There aren't many published performance comparisions, but a previous research by MigaLabs may give some insight. You can read here:

Memory Usage

Grandine is a lightweight client and needs only ~2.5GB of memory on the mainnet. In order to measure the amount of memory that Grandine actually needs one should stress the operating system to release the shared memory.
stress-ng is an easy way to do it:

stress-ng --vm-bytes $(awk '/MemAvailable/{printf "%d\n", $2 * 0.9;}' < /proc/meminfo)k --vm-keep -m 1 

How to Build From Source


Rust is needed in order to build Grandine. We recommend to use rustup. Some system dependencies are needed, the command below should install it on Ubuntu:

sudo apt-get install ca-certificates libssl-dev clang cmake unzip protobuf-compiler libz-dev

Then the build may take a few minutes:

git clone https://github.com/grandinetech/grandine
cd grandine
git submodule update --init dedicated_executor eth2_libp2p
cargo build --profile compact --features default-networks

The compiled binary is available at ./target/compact/grandine. For faster building (larger binary size) use --release instead of --profile compact.

Cross-compilation

Cross can be used for Grandine cross-compilation.

Cross-compilation command for amd64 architecture:

cross build \
    --bin grandine \
    --target x86_64-unknown-linux-gnu \
    --features default-networks \
    --profile compact

Cross-compilation command for arm64 architecture:

cross build \
    --bin grandine \
    --target aarch64-unknown-linux-gnu \
    --features default-networks \
    --profile compact

Docker Cross builds

Cross-compilated binaries can be used for Docker images.

Docker build command for amd64 architecture:

docker buildx build \
    --file Dockerfile.cross \
    --platform linux/amd64 \
    target/x86_64-unknown-linux-gnu/compact/

Docker build command for arm64 architecture:

docker buildx build \
    --file Dockerfile.cross \
    --platform linux/arm64 \
    target/aarch64-unknown-linux-gnu/compact/

Audits

Grandine is used in production, however no audits are completed. Always secure your keys with the approach you trust (Web3Signer, Vouch, etc.). Use it at your risk.

Subscribe to Avenlabs
Receive the latest updates directly to your inbox.
Mint this entry as an NFT to add it to your collection.
Verification
This entry has been permanently stored onchain and signed by its creator.