1. 程式人生 > >Connected contracting: Using off-chain smart contracts to manage a supply chain

Connected contracting: Using off-chain smart contracts to manage a supply chain

Summary

Learn how to track perishable goods on a Hyperledger blockchain using a smart legal contract running on Clause to capture the contractual terms and penalty calculations between food producers, importers, and shippers.

Description

The food industry is the perfect place to apply blockchain technology. Our local grocery store hates having to waste food because of spoilage and would jump at the opportunity to track its food supply chain. Blockchain enables traceability and ensures the quality of food produce by tracking each product’s origin along with its current status. As most things become digitized, so are contracts. Blockchain is transforming the exchange of assets to a model based on a business network that uses a distributed ledger. This model requires that you establish governing rules for digital asset exchanges — hence, the idea of smart contracts was born. The

Accord Project is an open source software initiative that has established specifications, tooling, and code for smart legal contracts.

The Clause platform manages digital legal contracts that adhere to the Accord Project’s open source specifications for smart legal contracts.

This developer code pattern illustrates how a legal agreement, such as a shipping contract, can be automated with the use of trusted data from the IBM Blockchain Platform. In this scenario, the Hyperledger Composer business network (executing on Hyperledger Fabric v1) invokes the Clause platform. Hyperledger Fabric stores the state of assets on the blockchain, while the

Cicero engine from the Accord Project executes contract logic off-chain on the Clause platform.

When you have completed this code pattern, you will understand how to:

  • Deploy a network to the IBM Blockchain Starter Plan
  • Configure and use the Clause platform to build and execute a contract
  • Run an Angular application that utilizes the Clause smart contract

Flow

flow

  1. The application receives a shipment request.
  2. A transaction is submitted to the IBM Blockchain Platform.
  3. The Hyperledger Composer-based business network running on the IBM Blockchain Platform updates the state of assets.
  4. A call is issued to Clause to trigger execution of a smart legal contract.
  5. The smart legal contract is executed and, assuming verifications pass, a payment is subsequently calculated.
  6. Assets on the blockchain are updated: Blocks are written to the network and the world state is updated.

Instructions

Find the detailed instructions in the README. These steps explain how to:

  1. Deploy to the IBM Cloud.
  2. Set up a smart legal contract.
  3. Run the client application.