An Introduction to Hyperledger Fabric for Ethereum Developers
How to write your first Hyperledger Chaincode smart contract
Prerequisites: Understanding of Blockchain, Ethereum Smart Contracts, and Go or NodeJS

Introduction
In my opinion, Ethereum is the perfect entry point to begin learning about Blockchain Development and building Decentralised Applications. The ecosystem is growing, documentation is great and the developer community is large with respect to the rest of the Blockchain space.
Once you’ve grasped the basics of developing on Ethereum, you’ll naturally start to cast your net wider and begin to look at other Blockchain solutions and use cases.
This article explains the differences between writing Smart Contracts on Ethereum using Solidity, and writing Chaincode on the Hyperledger Fabric Blockchain.
Solidity Development vs Hyperledger Development
As a Smart Contract developer, you’re probably not as concerned about the underlying Blockchain (or at least not to the extent) as an Ethereum Core developer is. However, it helps to have a basic understanding to avoid certain pitfalls that you won’t stumble across developing “traditional stack” applications (see random number generation).
In contrast, Hyperledger Fabric development will likely require you to delve deeper into the Blockchain layer. This may seem a little daunting at first, especially if Smart Contracts and Solidity are still new to you. Fortunately, the structure of Fabric helps us out a little bit here. Because of its modular design, we can break each module down and focus on them in isolation.
Why Hyperledger?
At this point it’s unlikely you’ll have thought about spinning up your own Blockchain. Why would you? You can write DApps on Ethereum for the whole world to participate in.
For Blockchain to really grow, Big Business needs to get on board, and there are not many big businesses happy with making their data public. The public Ethereum network is not a great fit since all data on the Ethereum is, by definition, public. Hyperledger Fabric allows anyone to spin up their own Blockchain and fence it off from the outside world in minutes.
5 Core Functions Of Hyperledger Fabric
There are 5 core functional differences we need to understand about Fabric:
- Hyperledger Fabric is a permissioned network. This means that you cannot join the network unless you have been granted permission to do so. Ethereum is a permissionless network because anyone can join and interact with it.
- There’s no underlying currency like Ether on Hyperledger Fabric. Assets and the consensus protocol are defined by the participants.
- There are two types of node on the Fabric network: Peer nodes and Order nodes. Peer nodes verify and execute transactions submitted to the network, Order nodes order and propagate these throughout the network.
- The state of the Ethereum network is derived from the history of all transactions stored on the Blockchain. While this is also true with Hyperledger Fabric, an SQL database sits alongside the Blockchain which stores the latest state.
- Ethereum has Smart Contracts. Hyperledger Fabric has a similar concept called Chaincode, and a number of languages can be used to implement them.
Smart Contract vs Chaincode
The Hyperledger Fabric Samples (we’re using v1.2.0) project provides a sample called Fabcar. It contains Chaincode deployed to the Fabric Blockchain which stores an array of car information. It provides the ability to create new cars, and to query the list of cars. We’ll use the code from that project and compare it to an equivalent Solidity contract.
Since we’re coming from an Ethereum standpoint, let’s start there.
Solidity
Figure 1 shows the Fabcar Smart Contract.






