Skip to content

C++ implementation of the Ethereum protocol

License

Notifications You must be signed in to change notification settings

mriccobene/silkworm

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Silkworm - C++ Ethereum Client

C++ implementation of the Ethereum protocol based on the Erigon architecture.

CircleCI AppVeyor CodeCov

Table of Contents

About Silkworm

Silkworm is a greenfield C++ implementation of the Ethereum protocol based on the Erigon architecture. It aims to be the fastest Ethereum client while maintaining the high quality and readability of its source code. Silkworm uses libmdbx as the database engine.

Silkworm was conceived as an evolution of the Erigon project, as outlined in its release commentary.

Silkworm is under active development and hasn't reached the alpha phase yet. Hence there have been no releases so far.

Obtaining Source Code

To obtain Silkworm source code for the first time:

git clone --recurse-submodules https://github.com/torquem-ch/silkworm.git
cd silkworm

Silkworm uses a few git submodules (some of which have their own submodules). So after you've updated to the latest code with

git pull

update the submodules as well by running

git submodule update --init --recursive

Building on Linux & macOS

Building Silkworm requires:

Once the prerequisites are installed, bootstrap cmake by running

mkdir build
cd build
cmake ..

(In the future you don't have to run cmake .. again.)

Then run the build itself

make -j

Now you can run the unit tests

cmd/core_test

or Ethereum Consensus Tests

cmd/consensus

You can also execute Ethereum blocks with Silkworm. For that, you need an MDBX instance populated with Ethereum blocks, which can be produced by running the first 4 stages of Erigon sync, which are before the Execute Blocks Stage. Then run

cmd/execute -d <path-to-chaindata>

Building on Windows

Note! Windows builds are maintained for compatibility/portability reasons. However, due to the lack of 128-bit integers support by MSVC, execution performance is inferior when compared to Linux builds.

  • Install Visual Studio 2019. Community edition is fine.
  • Make sure your setup includes CMake support and Windows 10 SDK.
  • Install vcpkg.
  • .\vcpkg\vcpkg install mpir:x64-windows
  • Add <VCPKG_ROOT>\installed\x64-windows\include to your INCLUDE environment variable.
  • Add <VCPKG_ROOT>\installed\x64-windows\bin to your PATH environment variable.
  • Install Perl (needed for OpenSSL build process)
  • Open Visual Studio and select File -> CMake...
  • Browse the folder where you have cloned this repository and select the file CMakeLists.txt
  • Let CMake cache generation complete (it may take several minutes)
  • Solution explorer shows the project tree.
  • To build simply CTRL+Shift+B
  • Binaries are written to %USERPROFILE%\CMakeBuilds\silkworm\build If you want to change this path simply edit CMakeSettings.json file.

Codemap

Apart from the submodules and some auxiliary directories, Silkworm contains the following components:

  • core
    The core library contains the bulk of the Ethereum protocol logic as described by the Yellow Paper. Code within core is compatible with WebAssembly and may not use C++ exceptions.
  • node
    The node library contains database, staged sync, and other logic necessary for functioning as an Ethereum node. The node library depends on the core library.
  • cmd
    The source code of Silkworm executable binaries.

Style Guide

We use the standard C++17 programming language. We adhere to Google's C++ Style Guide with the following differences:

  • snake_case() for function names.
  • .cpp & .hpp file extensions for C++; .c & .h are reserved for C.
  • using namespace foo is allowed inside .cpp files, but not inside headers.
  • Exceptions are allowed outside of the core library.
  • User-defined literals are allowed.
  • Maximum line length is 120, indentation is 4 spaces – see .clang-format.

License

Silkworm is licensed under the terms of the Apache license. See LICENSE for more information.

About

C++ implementation of the Ethereum protocol

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 98.7%
  • Other 1.3%