What is Hyperledger Fabric?

Hyperledger
What is Hyperledger Fabric

In this blog post, we’ll discuss Hyperledger Fabric. Hyperledger is a project that encompasses various frameworks and tools for blockchain development. One of the standout frameworks within this project is Hyperledger Fabric.

The Need for Another Blockchain Framework

When we talk about the Bitcoin blockchain, it only saves the transactions. It only stores data, but you can’t do programming there. Ethereum, on the other hand, allows the programming of decentralized applications known as dApps.

That’s where Ethereum says, “Hey, not only can you write data, but you can also write software that will run on the blockchain.” That’s awesome, right? And that’s where Ethereum got famous.

However, there is one thing about Ethereum and Bitcoin: they both are public blockchains. A public blockchain means everything is visible to everyone.

Transparency and Security in Public Blockchains

This transparency is a feature of blockchain, right? So whatever data you have on those blockchains, anyone can see it. When I say anyone, I mean the nodes in that network can see that data.

When you say public blockchain, it simply means you have different nodes in the network. Any new node can join the network by installing software and downloading the entire ledger.

However, whenever you add a new node, that node can be malicious. How can you ensure that the malicious node does not corrupt the data? That’s where we have consensus algorithms like proof of work and proof of stake.

Challenges of Blockchain Adoption in the Enterprise Market

When discussing the enterprise market, many companies are excited about the potential of blockchain technology and want to develop their own blockchain-based solutions. However, they face two main issues: the high cost of the mining process and the need to keep their data private.

Consider two companies that are competitors. They develop new schemes and strategies and do not want their rivals to have access to this sensitive information.

In a network with five nodes, each node shares the same ledger. This ledger functions as a database, and any changes made are reflected across all nodes. For instance, a transaction between A and B will be stored on the ledger and visible to all nodes in the network. This is achieved through consensus.

The problem arises when competitors, such as D and A, are part of the same network. While A and B might not want D to see their transactions, being part of the same network means D will have access to this information, which A and B prefer to keep private.

Addressing Privacy with Subnets and Channels

To address the need for privacy, we can create subnets within the network. In networking terms, subnets allow for segmentation. For example, we might have a network called ABCD and E, and a separate subnet for A and B. Another node, X, could join AB and X in a distinct subnet. This feature is not available in Ethereum, which is why a new blockchain framework was developed.

Hyperledger Fabric addresses this need with its support for private blockchains. Fabric offers two types of blockchain: public and private. It includes the feature of subnets, referred to as channels. Channels are a standout feature of Hyperledger Fabric.

Joining this network is not as simple as just logging in and claiming a spot. Because it is a private blockchain, only authorized node entities can join. To become a member, you must request or enroll through a Membership Service Provider (MSP). The MSP handles the enrollment into the network.

Managing Multiple Nodes and Peers

In a blockchain network, multiple nodes, often referred to as peers, share the same ledger. Each peer has its own copy of the ledger. If a peer is part of two networks, it will maintain two separate ledgers, one for each network.

Consider a scenario where A has an asset and wants to transfer it to B. Once the transfer is complete, the asset will belong to B. But who updates this information?

All the transaction data is stored on the ledger. An external application might request the transfer of the asset from A to B, but applications themselves cannot directly modify the ledger. This is where the need for programming and smart contracts comes in.

Chaincode: Smart Contracts in Hyperledger Fabric

In Ethereum, smart contracts are written in Solidity. Hyperledger Fabric also supports smart contracts, referred to as chaincode.

Chaincode is essentially code that runs on the blockchain. In Hyperledger Fabric, chaincode can be written in JavaScript, Java, or Go.

Although Hyperledger Fabric is built in Go, the preferred language for chaincode, developers can use Java or JavaScript if they are more comfortable with those languages.

Understanding the Ledger Structure in Hyperledger Fabric

Let’s delve into the details of the ledger. In Hyperledger Fabric, the ledger is composed of two primary components: the world state and the transaction log.

The world state functions as a database that captures the current state of data, while the transaction log preserves a record of all transactions. This bifurcated structure facilitates efficient data retrieval.

For instance, to determine the current owner of an asset, you would refer to the world state. However, to trace the asset’s ownership history, you would consult the transaction log. The world state can be housed in either CouchDB or LevelDB, and the transaction log is typically stored in a straightforward plain file.

Conclusion

In conclusion, Hyperledger Fabric offers a robust solution for enterprises seeking to leverage blockchain technology while maintaining privacy and control over their data. Its unique ledger structure, support for private channels, and versatile chaincode functionality make it a standout framework in the blockchain space.

By addressing the limitations of public blockchains like Ethereum and Bitcoin, Hyperledger Fabric provides a tailored approach for businesses looking to implement secure and efficient blockchain solutions.

Leave a Comment