Erigon++

Erigon++

C++ is back

Share

In a previous post [link] dating more than one year and a half ago, the history and the status of the Silkworm project was described. As you may already know, Silkworm is a green-field implementation of an Ethereum Execution Layer client written in C++20 entirely from scratch and based on the amazing evmone [link], the fastest fully-compatible EVM implementation.

Since that old post, Silkworm has been in active development and is almost feature-complete: currently, it additionally covers both the Sentry and Downloader/Seeder components in the Erigon architecture [link] and also contains the new Sync component supporting Engine API v3. Silkworm standalone is not far from being able to synchronise our beloved testnets and mainnet, but this is a story for another post.

In fact, a major change in Silkworm mission happened in July 2023, during one of our periodic Erigon meetings: starting from a brilliant idea by Alexey, we realised that the best way to both exploit more effectively what we had got in Silkworm and keep a better alignment with Erigon in terms of our technological roadmap was indeed to use Silkworm as a native library within Erigon itself.

This idea was indeed not completely new, because the very initial objective for the Silkworm project back into 2020 was exactly providing fast block execution using native code.

The key benefits of this approach emerged during the discussion:

  • improve Erigon performance in some key areas by using the existing Silkworm modules.
  • increase EVM diversity in networks by leveraging Erigon powered by Silkworm block execution
  • have a chance to battle test such Silkworm modules directly in different networks
  • make the present and future goals of the Silkworm project more concrete

Such an approach is made possible by the fact that Silkworm and Erigon share not only the same technologies, but also the same architectural decomposition into pluggable components.

The name Erigon++ came later, but the very first seed had been planted.

The Past

This decision clearly changed the priorities in Silkworm roadmap and also required some specific work, namely designing the C API [link] to make Silkworm usable from Go code in embedded mode, refactoring some portions of Silkworm code (e.g. snapshots) to make them work both in standalone and embedded mode and doing a lot of plumbing and testing.

Moreover, we faced some issues specifically tied to the integration between Erigon and Silkworm during the development and testing phases. Initially, we used to build both Erigon and Silkworm separately on the target machine and then started Erigon by providing the path to the Silkworm library: this was clearly not the way to go for our users. In the end, we came up with a satisfying solution involving the creation of the Go bindings for Silkworm: the silkworm-go repository [link], which is now just another versioned Go module included into Erigon.

This means that in order to install and launch Erigon++ you do not need to do anything special: just download and install Erigon as usual and just provide some additional command-line options.

The Present

We are happy to announce that the first release of Erigon++ is now available starting from Erigon v2.59.0 for Ethereum networks (not yet for Gnosis chains or Polygon chains).

The three components where currently Erigon++ uses the Silkworm library are:

  • Block Execution: currently supported only for historical block execution, not yet at the tip of the chain (we’re actively working on it)
  • RPC (a.k.a. SilkRPC): available support for almost all the API namespaces of the Ethereum JSON-RPC end-point using either HTTP or WebSocket transport, see [link] for details (please be aware that the Engine JSON-RPC endpoint is still served by the usual Go RPC Daemon also in Erigon++)
  • Sentry: the peer-2-peer network daemon supporting RLPx and DiscV4 protocols

It’s important to highlight that Erigon++ i.e. Silkworm running inside Erigon in embedded mode is still an experimental feature and is disabled by default in Erigon.

You can selectively enable Erigon++ by adding one or more of the following options to your activation command line:

--silkworm.exec: enables historical block execution powered by Silkworm
--silkworm.rpc: enables Ethereum JSON-RPC API powered by Silkworm
--silkworm.sentry: enables Execution Layer p2p networking powered by Silkworm

Working towards this first yet intermediate Erigon++ milestone has been extremely fun and sometimes really challenging, so reaching such goal makes us proud at least for one moment.

The Future

Our roadmap for the Silkworm project involves both maintaining and expanding the scope of Silkworm within Erigon.

We are going to focus on completing some Erigon 2 features, namely: supporting the block execution at the tip of the chain, introducing also IPC transport in our RPC daemon and possibly enlarging the scope of Sentry to cover the Consensus Layer p2p networking.

Above all, we strive to fully supporting the astonishing brand new features introduced in Erigon 3.

Give Erigon++ a try!

The Silkworm Team

.

PS1: What about the numbers?

  • Erigon++ block execution is approximately 30% faster than Erigon2 one: e.g. full sync on mainnet from zero (empty database) to the chain tip takes about 68hrs on a 128GB RAM 4TB NVMe server (Erigon2 needs about 102hrs on the same machine)
  • Erigon++ RPC Daemon is approximately 2x-4x faster than Erigon2 RPC Daemon under high QPS performance workloads (results are obviously dependent on many factors, see [link] for more accurate information)

PS2: Talk is cheap. Show me the code:

[erigon]

[silkworm-go]

[silkworm]