ContractPen: Smart legal contracts on the Hyperledger Blockchain instantly! all at the push of a button

ContractPen now allows you to deploy smart legal contracts to a Hyperledger Blockchain instance where they can be executed immediately. All of this is done through the ContractPen website easily at the push of a button to deploy and to execute without any complicated coding or technical skills. It is the mission of ContractPen to educate, promote and simplify the use of smart legal contracts, this example helps to explain how Chaincode can be deployed to Hyperledger, so let’s get started with Accord Project smart legal contracts on ContractPen.

The contracts here have computer code and legal text, the computer code deployed to the Blockchain is known as Chaincode, when the code is executed then its data is written to the Blockchain as transactions and blocks. All of this is done at the push of a button within the ContractPen user interface and the Hyperledger Explorer browser shows the results as written into the chain. Although note - at this time you may not modify the computer code written and this is a current limitation with ContractPen, this aids in understanding how the computer code interacts with the Hyperledger Blockchain. In the short term near future then modification of code will be allowed.

Hyperledger is fast becoming a popular option for government and business Blockchains, as a project this is composed of over 150 organisations with practical adopting ongoing such as the Italian post office adopting Hyperledger and NASA’s proposal for Air Traffic management. The Accord Project is an open source project which allows smart legal contracts which contain legalese and computer code known as Chaincode to execute on the Blockchain. This is a unification effort between legal contracts and smart contracts. The Accord Project and Hyperledger work together to allow these Accord Project contracts to execute on the Hyperledger Fabric Blockchain.

Let’s get started immediately and try to deploy a Accord project smart legal contract to the Blockchain through ContractPen with an simple explanation of what is happening step-by-step.

First create an account at ContractPen or login with your Google Account, this will allow you to use a Hyperledger Fabric peer instance to write transactions to the Blockchain. It is required to be logged in with an account in order to use your own Hyperledger peer instance.

Once logged in, click on the Accord Project: Acceptance of Delivery contract.

The Acceptance of Delivery contract means that if a delivery occurs then the Chaincode will check to make sure if the delivery meets the acceptance criteria. The criteria is written both in legal text and in computer code. From reading the Ergo language code it can be understood that the delivery must be received at or before NOW and within the inspection period time, otherwise the delivery is not accepted.

You may view the contracts legal description by clicking on the “create contract” menu or view the Ergo Language Chaincode by clicking “Blockchain” then the top tab “Project Files” then the file logic.ergo.

Lets just go straight to deploying the Ergo Language Chaincode to the Hyperledger Blockchain, click on the contract then use the left menu to click on Blockchain. There is a button which says “Deploy Contract to Hyperledger”, press this button and wait for it to complete, it takes about 30 seconds.

You will notice you are provided with a link to a Hyperledger Explorer browser, you can open this browser to inspect the blockchain blocks and transactions after deployment. From here, click on the “Blockchain Execution” tab on this page to execute the contract.

If you press “Execute Contract” with the given data then the output will be shown to be status”:”OUTSIDE_INSPECTION_PERIOD”. To get the delivery date to be within the inspection period change the request JSON to have a delivery date which is just within a few days before today. In this case by entering February 1, 2019 … as show it is within the acceptance criteria.

 “deliverableReceivedAt” : “February 1, 2019 16:34:00”,
 “inspectionPassed” : “true”,
 “$class” : “org.accordproject.acceptanceofdelivery.InspectDeliverable”

Since this is within the past 10 days of TODAY (Today is 4th of February) now then the result is as follows with status as PASSED_TESTING.


After any deployment of a contract or execution of a contract you can verify the blocks have been written to Hyperledger Blockchain by viewing it through the Hyperledger Browser.

The Hyperledger Explorer browser can be used to inspect the actual blocks and see the data which has been written for example as shown:

The Hyperledger Explorer browser is also visible within ContractPen as shown, giving full visibility into the Hyperledger Blockchain.

The Ergo Smart legal Contract Chaincode can be viewed in the file browser as shown. This gives clear visibility of the computer code which executes on the Blockchain.

Smart Legal Contracts on the Blockchain are a innovative area of development for Blockchain and have practical applications for the common agreement of contracts between businesses and the automatic execution of contracts. It is hoped that ContractPen can help to provide visibility into this new and exciting area.