Create and execute blockchain smart contracts  

Create and execute smart contracts within a blockchain application using Hyperledger Composer

Last updated | By Ishan Gulhane


Organizations that use blockchain depend on trusted transactions to securely automate processes that were previously completed manually. In this developer journey, you’ll learn how to use the Hyperledger Composer framework to create and execute smart contracts. Those contracts will run within a blockchain application built on Hyperledger Fabric.


Note: This developer journey is the second in a series of journeys designed to get you started with blockchain. For an overview of the series, see Build your first blockchain application.

In the first journey of the series, you learned how to build a blockchain network. Now you’re ready to learn how to create and execute a smart contract within your blockchain application.

Blockchain is designed for multi-party business transactions, and organizations that use blockchain depend on trusted automatic transactions to do business. One of the most useful aspects of blockchain is its decentralization. Because it’s a decentralized system that exists between all permitted parties, there’s no need to employ intermediaries. In effect, you “cut out the middleman,” save time, and prevent potential disagreement about transactions.

Blockchain creators realized that the decentralized blockchain ledger could be used for self-executing or smart contracts. Smart contracts are used to exchange money, property, shares, or anything of value in a transparent, conflict-free way. Smart contracts not only define the rules and penalties around an agreement in the same way that a traditional contract does, but they also automatically enforce those obligations. No intermediary is required for a smart contract to be completed.

A good way to understand smart contracts is to compare the technology to a vending machine. Ordinarily, to complete a contract you’d go to an attorney, pay that attorney a fee, and wait to receive the document in question, whether a house closing agreement, a divorce decree, or any other “official” documentation. With the smart contract model, you simply drop a token into the vending machine–that is, the ledger–and your document (or candy bar) is provided to you, or deposited into your account. It’s a straightforward process requiring no additional intervention from anyone.

This developer journey will show you how to use Hyperledger Composer to create a smart contract. You’ll execute the contracts on the blockchain app that you built in the first journey of this series. If you’ve already completed the previous journey, you know how useful Hyperledger Composer is for developing blockchain apps. Now you’ll take your blockchain skills to the next level by embedding and executing smart contract business terms.


  1. Install and instantiate the chaincode.
  2. Query and invoke the chaincode.
  3. View the transactions and the chaincode logs.

Related Blogs

Blockchain Disruption

The classical journey from production to distribution of a commodity involves many intermediaries along the way - from government officials to lawyers, accountants, dealers, and banks. This complex crisscrossing network of transactions is subject to accounting, finance, transfer pricing, and other regulations. As a result, existing systems for recording transactions are complex, slow, and vulnerable...

Continue reading Blockchain Disruption

Related Links