Bonsai from Hyperledger - The next generation storage layout for Ethereum Execution Client

Hyperledger Besu is an umbrella project of open-source blockchain protocols and tools that was started by the Linux Foundation in 2015.

Bonsai from Hyperledger - The next generation storage layout for Ethereum Execution Client

In this post we are going to talk about

What is Hyperledger Besu ?

Besu is a java-based Ethereum client that applies EEA (Enterprise Ethereum Alliance) and can be run on the public or private networks and many testnets such as Rinkeby, Ropsten, Goerli etc. EEA is a worldwide community of blockchain developers, innovators, adopters from around the globe to collaborate and bring solutions that benefit everyone.
PegaSys, the protocol engineering team at ConsenSys, has been the primary contributor and maintainer of the codebase at the core of Hyperledger Besu since its launch in November 2018 as Pantheon. They built this Ethereum client with the goal of lowering barriers to entry for enterprises and maintaining and scaling mainnet.

Besu's design and architecture have been made by aiming at clean interfaces and high modularity. This makes the components easier to upgrade and implement.
Besu , previously known as Pantheon, joined Hyperledger in 2019.

Want to become an Eth1 validator in Besu? Have a follow-up here.

Key Features of Besu Client

Client is a piece of software designed to implement the Ethereum protocol address for specific use cases.
Here are some of the features of Besu:

  • Ethereum Virtual Machine (EVM): the EVM is what enables the deployment and execution of Ethereum smart contracts.
  • Consensus algorithms: in addition to a proof-of-work algorithm, Besu also features several proof-of-authority protocols, which are well suited for use in blockchain consortia or other private networks where the participants know one another.
  • P2P networking: by leveraging Ethereum’s devp2p network protocols, Besu is able to facilitate inter-client communication.
  • Storage: Hyperledger Besu utilizes a RockDB key-value database to persist chain data locally. The data is divided into two sub-categories – blockchain data and world state data.
  • Permissioning: while Besu leverages the public Ethereum mainnet, it also provides businesses with the means to create permitioned networks by specifying which nodes and accounts can participate in those networks.
  • Privacy: Besu uses a Private Transaction Manager to ensure the privacy of transactions between counterparties.
  • User-facing API: the client provides mainnet Ethereum and EEA JSON-RPC APIs over HTTP and WebSocket protocols. It also supports a GraphQL API.
  • Monitoring: Hyperledger Besu utilizes tools such as Prometheus and Block Explorer to allow for users to monitor node and network performance, respectively.

Bonsai Trie

Previously Hyperledger Besu, or simply Besu, used "Forest of tries" to store Ethereum's complex and vital state.
"Trie" is a Data Structure when strung together as trees, looks like an Ethereum Blockchain at a point of time.

As the state gets larger, reading and writing on the network takes more time. It can even cause storage challenges among the nodes that run on Ethereum for day-to-day use. Over time, storage overhead accumulates and can make running nodes prohibitively expensive to those without specialized or expensive hardware. Here comes Bonsai Tries.

Bonsai Trie is an experimental storage format and marks a major change in the ecosystem. It is Hyperledger Besu's next-generation storage layout designed to address some of the concerns. It provides a minimal impact to full sync while allowing full historical transaction execution capabilities with large savings in space. This approach also limits the long term growth of a full node.

All of this culminates in faster read and better storage performance for Besu nodes everywhere

Working of Bonsai

Bonsai Tries uses flat account storage and a Trie Log Layer for instant read access to information, only traversing the tries as needed.
Bonsai stores leaf values in a trie log, separate from the branches of the trie. Bonsai stores nodes by the location of the node instead of the hash of the node. Bonsai can access the leaf from the underlying storage directly using the account key. This greatly reduces the disk space needed for storage and allows for less resource-demanding and faster read performance. Bonsai inherently prunes orphaned nodes and old branches.

Why use Bonsai Tries rather than Forest of Tries ?

Besu offers two formats for storing the world state, Forest of Tries and Bonsai Tries.

  • Storage Requirements
    • Bonsai uses 1100 GB of storage while the Forest mode uses around 2TB of storage. Bonsai uses significantly less storage than Forest.
    • Mainnet Full Sync: Block 12,387,125
      • Bonsai - 794 GiB
      • Forest - about 12,000 GiB

To know more about the storage requirements and how does Bonsai curb the storage, watch this video.

  • Accessing Data

    • Forest mode must go through all the branches by hash to read a leaf value. Bonsai can access the leaf from the underlying storage directly using the account key. If the blocks are new and recent, Bonsai will generally read faster than forest mode.
  • Fast syncing Nodes

    • With forest mode, your node can use fast synchronization as normal. Your node can fast sync from other nodes and other nodes can fast sync to your node.

    • You can fast sync from other nodes using Bonsai, but other nodes cannot fast sync to a Bonsai node. Bonsai stores data at a point-in-time.

Similar reads

Ethereum videos


Disclaimer: The information contained on this web page is for education purposes only. Readers are suggested to conduct their own research, review, analyze and verify the content before relying on them.

To publish press releases, project updates and guest posts with us, please email at contact@etherworld.co.

Subscribe to EtherWorld YouTube channel for ELI5 content.

Support us at Gitcoin

You've something to share with the blockchain community, join us on Discord!

Follow us at Twitter, Facebook, LinkedIn, and Instagram.


Share Tweet Send
0 Comments
Loading...
You've successfully subscribed to EtherWorld.co
Great! Next, complete checkout for full access to EtherWorld.co
Welcome back! You've successfully signed in
Success! Your account is fully activated, you now have access to all content.