This tutorial deploys a Hyperledger Composer blockchain-based business network that invokes Clause to execute Smart Legal Contracts.

This tutorial does not require writing any code, but familiarity with the terminal and installing tools like Docker, nvm, Node, npm is required. Mac OS X, or a Linux VM is required. It should take about 1 hour.

The state of a set of assets and participants are stored on the blockchain, whilst smart legal contracts are externalized for execution on the Clause platform.

Rather than hardcoding legal business logic in Hyperledger Composer JavaScript transaction processor functions the logic is externalized into a Cicero Smart Clause® template and invoked out of process using the centralized SaaS platform.

1. Install Hyperledger Fabric, Composer, Cicero and the Business Network

First complete the Cicero Perishable Network tutorial. You should now have a functional Hyperledger Composer business network running on your local Hyperledger Fabric.

2. Create the Perishable Good Contract in Clause

Before we can modify the logic of the Hyperleger Composer business network archive we need to create an instance of the Perishable Goods template and add it to a contract.

  1. Press the Templates button in the top menu
  2. Click the Perishable Goods template
  3. Press the Create Contract button
  4. Review the parameters of the contract (temperature/humidity ranges and the penalties)
  5. Press the Finalize Contract button
  6. Switch to the Connections tab of the contract editor
  7. Copy the Execution URL (including the access token)

3. Update the Hyperledger Composer Business Network

Open the Playground web application and edit the file logic.js to invoke the Clause server, replacing clauseId and with the URL you copied in step 9, above.

You also need to modify how the totalPrice attribute is being read from the result. Your code in logic.js should look similar to the code below.

var json = getSerializer().toJSON(shipmentReceived, {permitResourcesForRelationships: true});    
    var token = shipment.smartClauseKey;
    // The Clause template doesn't include these fields
    delete json.shipment.smartClauseKey;
    delete json.shipment.grower;
    delete json.shipment.importer;

        uri: shipment.smartClause, 
        json: json,
        headers: {
            Authorization: 'Bearer ' + token,

var server = '<clauseId>/trigger';

        uri: shipment.smartClause, 
        json: json,
        headers: {
            Authorization: 'Bearer ' + token,
   .then(function (result) {
      var totalPrice = result.body.totalPrice;


4. Test your Modifications

If you resubmit the ShipmentReceived transaction it will now invoke Clause, calculating the penalties using your Smart Legal Contract.

Shipment asset SHIP_001, showing 2 associated sensor readings

You can check that the correct total price was calculated by checking the accountBalance property of the Grower and Importer participants. The Grower should have received a credit, while the Importer should have receivd a debit.

A Grower participant, showing an account balance of 300