Create and execute a blockchain smart contract
Use Hyperledger Fabric and IBM Blockchain Platform Extension for VS Code
Organizations that use blockchain depend on trusted transactions to securely automate processes that were previously completed manually. In this developer code pattern, you’ll learn how to use the Hyperledger framework to create and execute smart contracts. Those contracts will run on a local version of the Hyperledger Fabric network running on IBM Blockchain Platform Extension for VS Code.
Note: This developer pattern is the second in a series of patterns designed to get you started with blockchain. For an overview of the series, see Build your first blockchain application.
Blockchain is designed for multi-party business transactions, and organizations that use blockchain depend on trusted automatic transactions to do business. A useful aspect 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 help prevent potential disagreement about transactions.
Blockchain’s 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 for 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 it’s an escrow agreement, a divorce decree, or any other official legal documentation. With the smart contract model, you simply drop a token into the vending machine (the ledger) and your candy bar (the document) is provided to you or deposited into your account. It’s a straightforward process requiring no additional intervention by anyone.
This developer code pattern shows you how to use IBM Blockchain Platform Extension for VS Code to create and execute a smart contract. Take your blockchain skills to the next level by embedding and executing smart contract business terms. When you have finished this pattern, you will understand how to:
- Create a smart contract
- Package the smart contract
- Install and instantiate a smart contract package
- Test the smart contracts
- Set up and launch the VS Code platform.
- Develop a smart contract using Node.js.
- Start a local instance of a Fabric network within the VS Code platform.
- Install and instantiate the smart contract.
- Test out the smart contract transactions.
Ready to get started? Check out the README for all the details.