Skip to content
This repository has been archived by the owner on Apr 21, 2021. It is now read-only.

A sample for IBM Blockchain platform that uses a Smart Legal Contract from clause.io

License

Notifications You must be signed in to change notification settings

clauseHQ/demo-clause-ibm-perishable-goods

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Clause Sample for IBM Blockchain Platform

Legal Contracts are the foundation of the exchange of value between humans. As most things become digitized, so are contracts. Blockchain is transforming the exchange of assets to a model based on a business network using a distributed ledger. This model requires that we 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 open-source specifications for smart legal contracts

This 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.

The developer creates a blockchain-based business network on the IBM Blockchain Platform that invoke Clause to execute Smart Legal Contracts. When the reader has completed this code pattern, they will understand how to:

  • Deploy a network to 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

Architecture Flow

  1. Application receives a shipment request
  2. A transaction is submitted to IBM Blockchain Platform
  3. A call is issued to Clause to trigger execution of a smart legal contract
  4. The smart legal contract is executed and assuming verifications pass; then a payment is subsequently calculated
  5. Assets on the blockchain are updated: blocks are written to the network and the world state is updated

Included Components

  • Hyperledger Composer v0.20.x Hyperledger Composer is an extensive, open development toolset and framework to make developing blockchain applications easier
  • Hyperledger Fabric v1.2.1 Hyperledger Fabric is a platform for distributed ledger solutions, underpinned by a modular architecture delivering high degrees of confidentiality, resiliency, flexibility and scalability.
  • IBM Blockchain Starter Plan The IBM Blockchain Platform Starter Plan allows to build and try out blockchain network in an environment designed for development and testing
  • Clause Clause edits and executes smart legal contracts, connecting them to existing event sources and systems

Featured Technologies

Prerequisites

  1. If you do not have an IBM Cloud account yet, you will need to create one here.

Steps

  1. Provision IBM Blockchain Starter Plan
  2. Deploy to IBM Cloud
  3. Setup Smart Legal Contract
  4. Running the Client Application

Step 1. Provision IBM Blockchain Starter Plan

Step 2. Deploy to IBM Cloud

A. Click the link below to automate the provision of a service on IBM Cloud and to deploy the contract and app contained in this repository.

Deploy to IBM Cloud

B. Authorize IBM Cloud to access your GitHub account. This sample will be forked into your account so you can modify it.

C. In the Delivery Pipeline tab under Tool Integrations. Enter your IBM Cloud API Key. If you don't have a key you can create one. Enter the service name of your Blockchain instance from your IBM Cloud dashboard, it will be something like Blockchain-xy.

D. Click Create to trigger the deployment, then click Delivery Pipeline to monitor to progress. Wait for both the Build and Deploy stages to pass, this should take about 10 minutes.

Note that if deploy fails you should check the logs. If you have an existing Cloudant Lite plan instance the deploy will fail, as each IBM Cloud account is limited to a single Cloudant Lite plan database instance. You must upgrade your existing Cloudant instance to a paid plan or remove it.

Step 3. Setup Smart Legal Contract

While you are waiting you can get started with setting up your Smart Legal Contract on Clause. In that link, begin with Step 3.

Step 4. Running the Client Application

You can read more about the Client Application here.

Click the Client App link under LAST EXECUTION RESULT to view your demonstration app, it should look like the screenshot at the top of this page. Note that Hyperledger Composer is used to store the state of shipments, importers, growers, shippers on the blockchain, while the contract logic is invoked out-of-process using the Cicero Server. Follow the instructions

Links

Learn more

  • Blockchain Code Patterns: Enjoyed this Code Pattern? Check out our other Blockchain Code Patterns

  • Blockchain 101: Learn why IBM believes that blockchain can transform businesses, industries – and even the world. Blockchain 101

  • How to integrate Clause with Blockchain: Learn about the 4 ways you can integrate Smart Legal Contracts from Clause with Blockchain. Integrate Clause with Blockchain

License

This code pattern is licensed under the Apache Software License, Version 2. Separate third party code objects invoked within this code pattern are licensed by their respective providers pursuant to their own separate licenses. Contributions are subject to the Developer Certificate of Origin, Version 1.1 (“DCO”) and the Apache Software License, Version 2.

ASL FAQ link: http://www.apache.org/foundation/license-faq.html#WhatDoesItMEAN

© Copyright 2018, Clause Inc.

About

A sample for IBM Blockchain platform that uses a Smart Legal Contract from clause.io

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published