Smart contracts

Blockchain smart contracts enable a secure, online exchange of money between people who may not know or trust each other

Define contract terms

The process starts by defining the scope of a smart contract. A common example is Bill of Sale which at a minimum requires a buyer, seller, product/service and price.

The scope is described using data fields as shown above. Data fields are used to generate a form to use when creating new contracts. This is discussed further in this smart contract blog post.

 

Additional fields can be added to describe the product or service being sold, or other terms of the contract. In fact, the same Bill of Sale (or other) smart contract can be used for a wide variety of products and services in this way. More detail about how this works is in this Bill of Sale blog post.

Attach blockchain code

Once the data required for a contract is defined, a predefined blockchain program (e.g. written in Solidity or Java) is attached. This program dictates which data fields must be provided at creation time and which can be specified later. It also dictates what actions, or events, are supported by the contract after creation.

 

When a contract is created, the blockchain program is combined with initial data and uploaded to the blockchain network (e.g. Ethereum or Hyperledger). On the Ethereum network this is subject to a small fee to cover network processing.

Write contract language

Although not mandatory, it can be useful to create human-readable contract language to accompany a smart contract. This language is ignored by the blockchain network but can be made accessible via link or another similar means.

The Scribe app in Tag can display logic bubbles mixed freely with formatted text. This allows smart contract data values to merge with legal text as shown above. The same legal text can be combined with multiple data sets if the smart contract is reusable.

Generate contract document

If legal text is provided, a Word document (or similar) can be generated for data bound to a specific smart contract instance. This document presumably would serve as the official legal contract in the event of a legal dispute. 

This legal text can be permanently archived using IPFS, which is a blockchain inspired technology for storing documents. When this is done the text can be edited, but prior versions can never be deleted which makes tampering or fraud almost impossible - all edits made to the text are transparent and visible for all authorized users to see.

Create contract (mobile)

Regardless of whether or not legal text is created, a smart contract instance must be uploaded to a blockchain network to do anything useful. This can be done using Tag (a desktop program) or a planned mobile app.

If the Bill of Sale is kept relatively simple, it can easily be displayed on a smart phone screen. All that's needed is the ability to enter data using a form, confirm a few settings and upload to a blockchain network.

Note that the service fee shown in the screenshot is an example only. Similarly the gas charge is only approximate and only applies to Ethereum blockchains. On Hyperledger networks a custom token/mechanism for payment must be used.

Complete contract (mobile)

A mobile app can also be used to sign smart contract instances and perform other actions (e.g. cancel before payment is transferred).

There are many ways to design a smart contract. Additional checks can be added in several places. A simple example for Bill of Sale is as follows:

  • Seller creates and uploads a contract instance

  • Buyer provides payment and waits for delivery

  • The smart contract now holds funds in escrow

  • Product or service is then provided

  • If buyer is not happy funds are refunded

  • If buyer is happy he/she signs contract

  • After seller signs, payment is transferred and contract closes

© 2020 by nSymbol Technology Inc.