Are you looking to learn about Hyperledger Besu? If you do, then you have come to the right place.
The world of blockchain is blooming with exciting projects. It is all about bringing the best solution for companies who want to make use of blockchain.
Hyperledger is one of the biggest DLT projects out there. It is an open-source collaboration to bring the best effort for advancing blockchain technology. With global effort, Linux Foundation wants to build a framework that companies can follow worldwide. Leaders from diverse verticals are taking part in the project, including banking, supply chains, manufacturing, finance, and technology.
Hyperledger consists of several projects including the most popular Hyperledger Fabric.
Meet Hyperledger Besu, a new open source project that is recently added to the Hyperledger list of projects.
Enroll Now: Getting Started with Hyperledger Fabric Course
What is Hyperledger Besu?
Hyperledger Besu is the first public blockchain project to join Hyperledger officially. Before taking over, it is known as ConsenSys’ Pantheon. The new member was first proposed for addition to the consortium member on Aug 8th.
That’s a big step considering we have great projects within the consortium including Hyperledger Fabric and Hyperledger Sawtooth, backed by both the IBM and Intel respectively.
On Aug 29th, 2019 the Hyperledger Besu was announced to be part of the consortium. It was a great addition considering it is the first public blockchain to join the ranks of Hyperledger where only permissioned blockchains are part of.
So, what is Hyperledger Besu?
It is an open-source Ethereum client that is developed with an Apache 2.0 license. It is also written in Java and makes use of the Ethereum public network. Other key technologies used to make Besu functional include Gorli, Rinkeby, and Ropsten.
When it comes to consensus method, it utilizes Proof of Authority(Clique and IBFT 2.0) and Proof of Work(Ethash).
All-in-all, it is a great solution that lets enterprises build scalable, high-performance applications on a private network. Moreover, it also comes with the support of permissioning and privacy.
What is an Ethereum Client?
If you have paid attention, you already know that we mentioned Besu as an Ethereum client. So, what it an Ethereum Client? Let’s explore.
Ethereum client is a software that is used to implement Ethereum protocol. In simple words, it can be used to do the following things:
- Create an execution environment in Ethereum blockchain for processing transactions
- Persistent data storage including storing transaction execution
- Enable peer-to-peer(P2P) network communication between nodes
- Offers APIs for secure development and blockchain interaction.
What things can you do with Hyperledger Besu? Hyperledger Besu Use Cases
To get a better idea of what Hyperledger Besu blockchain, let’s learn the things that can be done using Hyperledger Besu network.
The first thing that you will notice about Besu is its command-line interface. It also offers the JSON-RPC API. Both of these can be used to monitor, debug, maintain, and run nodes on the Ethereum network.
In short, it can be used for things that are very similar to what an Ethereum network is capable of:
- Decentralized app(dApp) development
- Smart contract development
- Ether mining
When it comes to tech support, it offers common tools for dApp and smart contract development. It supports tools like Remix, Truffle, and web3j. However, you may not find key management support within Besu. For that, you need to use EthSigner that works flawlessly with it, giving you the tool for proper key management. Hyperledger Besu network is ideal for enterprise needs which means that there are a lot of Hyperledger Besu use cases.
Besu Key Features: How Hyperledger Besu Works
Now that our understanding of Hyperledger Besu network has grown stronger, it is now time to discuss its features. By going through the features, you will also be able to understand what makes Besu such as an important member of the Hyperledger consortium.
EEA(Enterprise Ethereum Alliance) specification
→ It implements the EEA(Enterprise Ethereum Alliance) specification. The specification ensures that it can connect with other Ethereum projects that can be both closed and open source. The specification is very important as it ensures that projects don’t have to worry about vendor lock-in issues. Moreover, you also get the standard interface for seamless application building. Besu works great with EEA and succeeds in providing enterprise features.
EVM(Ethereum Virtual Machine)
The EVM is at the core of Hyperledger Besu blockchain. It is Turing complete. It helps in the smart contract execution via the Ethereum blockchain transactions.
Hyperledger Besu offers good options when it comes to consensus algorithm. Out of the box, you get support for both Proof of Work and Proof of Authority consensus algorithms. The algorithms are used to do transactions on the Ethereum network.
Proof of Work → With Proof of Work, miners, can do mining activity on the Ethereum mainnet. For the purpose, Ethash is used.
Proof of Authority → For Proof of Authority, you get multiple PoA protocols. If you do not know, PoA only works if there is an already established trust between the nodes participating in the network. That’s why PoA algorithms are ideal for permissioned networks, especially those which are implemented by enterprises.
- Out of the box, you can use IBFT 2.0. Approved accounts take care of the blocks and transaction validation. The approved accounts are known as validators. The group of validators then acts as an entity of power, where they can vote for adding/removing validators. One limitation is that IBFT 2.0 doesn’t allow forks, and there will always be a single main chain.
- Clique is a protection algorithm that ensures fault tolerance. It can tolerate up to half of failing validators. For IBFT 2.0, it is necessary to run at least 2/3rd of the validators to continue the block creation process.
Hyperledger Besu network is flexible when it comes to providing storage support. Just like other blockchain solution, it also utilizes the key-value approach. Out of the box, it uses the RocksDB key-value database. It helps to provide data persistence. The data, stored, however, can be divided into two sub-categories.
→ The block headers are used to form the chain. The information within the block headers is used to verify the blockchain state cryptographically.
→ The block bodies, on the other hand, contain the order transaction list for each block
→ The transaction execution metadata is stored in the transaction receipt.
→ The stateRoot hash is used by every block header to reference the world state.
→ It is the mapping of accounts to address
→ The ether balance is stored within externally owned accounts
→ Smart contracts contain the code and storage
When it comes to P2P networking, Besu implements the devp2p Ethereum network protocol. The protocol ensures inter-client communication. It also acts as an additional IBFT2 sub-protocol. The discovery is made using UDP-based protocol, similar to what an internet network does. For communication, it utilizes the RLPx — a TCP-based protocol. The RLPx, on the other hand, uses various sub-protocols including the ETH Wire Protocol(for transaction state synchronization) and IBF sub-protocol(for making consensus decisions)
Besu comes with excellent APIs. The APIs that it provides over HTTP and WebSocket protocol include EEA JSON-RPC APIs and mainnet Ethereum APIs. It also supports GraphQL API.
Hyperledger Besu blockchain supports monitoring features — including network and node performance monitor. Prometheus is used to monitor node performance. Also, the JSON-RPC API method can be used for debug_metrics.
When it comes to network performance, Alethi tools including the EthStats Network Monitor or Block Explorer are used.
For privacy, Besu offers a Private Transaction Manager. It ensures that the involved parties in a transaction don’t have to worry about their identity theft or any information leakage.
Lastly, it offers proper permission management that makes sure only nodes that are allowed to participate.
Hyperledger Besu Architecture
The Hyperledger Besu architecture is simple and effective. We have discussed all the key components in the features section.
The key three core components of the Besu include the following.
- Ethereum Core
Let’s discuss the Ethereum core first. The core consists of the Ethereum Virtual Machine(EVM). It is responsible for any executing any transaction. On top of the EVM, there is Tx Processor that helps EVM function efficiently and effectively.
Consensus methods are also a part of the Ethereum core. Here we have consensus methods including PoW, Clique, and IBFT2. The other two main components of the Ethereum core include
- Transaction Pool → The transaction pool stores transaction-related information
- Synchronizer → helps synchronize all the nodes and the network.
For strange, we have blockchain and world State. World State consists of Account State, Account Storage, and Code Storage.
Lastly, there is networking which is operated using the Ethereum devp2p protocol. The four main components include
- ETH sub-protocol
- IBF Sub-Protocol
System Requirement for Besu
Hyperledger Besu blockchain is very flexible when it comes to system requirements. As networks can be dynamic in nature, including the world state size, the number of transactions, block gas limit and queries complexity, the system requirement can vary a lot.
But, for the most part, you need the following.
- 4 GB of RAM. If you are deciding to run the Ethereum Mainnet, then you need 8 GB of RAM
- In terms of disk space, you need at least 3 TB for full sync while working with Ethereum mainnet
If you are still confused, then you need to use Prometheus to monitor the node for knowing the exact disk and CPU requirements. Also, the Grafana dashboard works with Besu, which you can use to monitor easily.
Hyperledger Besu Roadmap
The fact that it went open source since October 2018, it is now open for contribution by anyone. The roadmap of the Hyperledger Besu looks interesting. Below are the key roadmap milestones that they are aiming for.
→ Build privacy groups, account permissioning, permissioning UI, Istanbul network upgrade
: Hyperledger Besu 1.2, July 31, 2019
→ Stream Support, Custom Monitoring for IBFT, Permissioning Governance: Hyperledger Besu 1.3, October 07, 2019
→ Multi Ethereum network client, Cross-Privacy Group, Advanced Privacy Features, Enterprise Integration, Ethereum 2.0, Early 2020.
Installing Binary Distribution, Building from Source and Starting Besu
In this section, we will learn how to install Besu, build, and start it on MacOS and other operating systems.
Installing Binary Distribution
If you are using Mac OS, you need to have Homebrew and Java JDK to get started. You also need Java 11+ as earlier Java versions are not supported.
Now, run the following command to install using Homebrew.
brew tap hyperledger/besu
brew install besu
To check if Besu is installed successfully, check with the following command.
If you are using Unix/Linux/Windows, then you to download Besu packaged binaries. Once downloaded, unpack the files and go to the besu-<release> directory.
To confirm that Besu is installed correctly, use the besu –help command.
Build from Source
To build Besu from the source, you need to clone the Besu repository.
git clone –recursive https://github.com/hyperledger/besu.git
Once the cloning is done, we will eliminate tests using the following command:
./gradlew build -x test
Now, go to the distribution directory using the command:
From there, you need to expand the distribution archive using the following command.
tar -xzf besu-<version>.tar.gz
With the files expanded, now move to the new folder.
If the last command runs successfully, you have successfully build from source.
For Windows, the process is almost the same. You start by cloning repository, removing tests, going to distribution directory, expanding it, and then finally checking if the installation is successful or not.
Awesome, now that we have Besu pre-installed, we now have to run it. To get started, you need to do the following steps.
- Local Block Data
- Genesis Configuration
- Confirm Node is Running or Not
- Run Node for Testing
The first step is to set up local block data. If you connected to a previous network, then you need to get rid of the local block data. You can also configure the –data-path option to specify the new local block data.
You can delete the local block data from the besu/build/distribution/besu-<version> directory. There, delete the database directory, and you are good to go!
If you are using Mainnet, Goerli, Rinkeby, or Ropsten, then the genesis configuration is specified when you connect with them.
Also, you can specify the –network=dev attribute to start the genesis configuration with empty bootnodes. Also, it sets the genesis configuration with a fixed low difficulty.
To confirm if the node is running, then you need to use the –rpc–http-enabled option. Once done use cURL and then call JSON-RPC API methods. If there is a reply, then the node is running.
Lastly, to run node for testing, you need to use the following command
besu –network=dev –miner-enabled –miner-coinbase=0xfe3b557e8fb62b89f4916b721be55ceb828dbd73 –rpc-http-cors-origins=”all” –host-whitelist=”*” –rpc-ws-enabled –rpc-http-enabled –data-path=/tmp/tmpDatdir
Privacy in Hyperledger Besu
Permissioned networks are known for their privacy features. Besu is no different as it offers excellent privacy options out of the box. With Besu, you can use EEA-compliant Privacy or Besu-extended Privacy.
To create and manage Privacy groups, you can use the already available JSON-RPC API methods. These methods can be used to create and manage privacy groups
When it comes to transactions, Besu only implements restricted transactions only. This is done to ensure privacy and make transactions privacy.
The transactions are signed by a specific key or a random key. If you want to sign in with a specific key, then you need to use the –privacy-marker-transaction-signing-key-file, which is available with Hyperledger Besu.
If you are interested, you can check out a detailed tutorial on how to configure private transactions network here. In the tutorial, you can find Orion to be one of the prerequisites to get started.
Permissioning in Hyperledger Besu
Permissioning is a critical part of any enterprise blockchain framework. The same is true for Besu. Any permissioned network surrounds around the idea of allowing only specific nodes. They participate and enable the network by doing a transaction or allowing transactions.
In the case of a peer-to-peer network, it is required to enforce rules on nodes so that permissioning can be done. Clearly, a level of trust is already needed to be present before a permissioned network can go live. To ensure that bad actors have a minimal role here, precautions need to be taken. Single bad actors, for example, cannot impact the decision making of the network. Proper rules and regulations can also help identify bad actors and remove them when they are caught doing malicious actions.
Apart from node permissioning, there is also an option of account permissions that enforce more rules and regulations. Account permissioning can be used to enforce identity requirements and onboarding. It also helps to suspend accounts, blacklist broken contracts, and restrict accounts when performing actions.
Hyperledger Besu blockchain provides both local and onchain.
→ Local permission is done at the node level. To implement it, a permissions configuration file is used. As the permissions are local, they do not impact the network. This is useful on how the node functions — which are independent of the rest of the network. It is also required to protect nodes if something wrong happens.
→ Onchain permissioning, on the other hand, are coded within smart contracts. Onchain permissioning is network-wide, and all nodes can read and update it. Onchain permissioning can only be modified or updated with coordination. Also, once it is updated, it is applied across the network.
Caption: How Local and OnChain Permissioned Works
You can also follow this guide to know how to setup a permissioning network in Besu.
Other things worth mentioning
Hyperledger Besu GitHub: If you think you can contribute to Hyperledger Besu, you can check out the Hyperledger Besu GitHub repository here.
Currently, there is no best Hyperledger course on Besu, and that’s why you can also check out the user documentation here. They have complete tutorials on how to quickstart networks, or how to create a private network.
This leads us to the end of our Hyperledger Besu getting started guide. Here we covered a lot of things about Besu.
We will soon be covering Hyperledger Fabric vs Besu soon. So don’t forget to subscribe to our newsletter.
Also, what do you think about it? Comment below and let us know.