Smart contracts have come a long way since 1994, when computer programmer Nick Szabo first coined the term.
A smart contract is a self-executing programme which is automatically triggered when a set of conditions is met. It is built on a set of promises laid down in conditional code.
Think of this way: If This [happens] Then That [will happen].
Take for example a delivery of furniture from a manufacturer to the store where it will be sold.
We can work out the conditions in advance and automate the process. So that whenever a delivery is flagged as received by the store, (If This), a payment will be unlocked and sent to the manufacturer (Then That).
That’s exactly what has just happened in IKEA Iceland. According to The Next Web, in October the furniture giant settled an invoice with local clothing retailer Nordic Store using an Ethereum-based smart contract, accepting payment in a digital version of the Icelandic Krona.
To settle the invoice, IKEA used a platform made by supply chain firm Tradeshift, and using programmable digital cash from payments company Monerium.
Not everyone can pay for things in digital versions of a fiat currency. Monerium has a huge head start, because in June it was granted the world’s first license from a financial authority to issue e-money on blockchains. By the Financial Supervisory Authority of Iceland, to be exact.
E-money is a way of storing monetary value on hardware devices — like on pre-paid cards, or in the mobile wallets of smartphones, for example Google Pay or Apple Pay. The tech has been around for a long time, but as the article makes clear, using e-money to settle invoices in digital fiat with smart contracts is something entirely new.
Using smart contracts to pay invoices makes a lot of sense, because it automates away a huge point of friction for businesses.
Tradeshift co-founder Gert Sylvest explains: “Programmable money regulated by governments will become the foundation for e-commerce payments because they enable smart contracts. Smart contracts can be used to generate smart invoices, which are invoices which basically settle themselves.”
Anyone who has ever had to deal with either sending an invoice or getting it paid knows the hassle of having to wait for money to appear in their bank account or chasing up late payments.
In fact, late payment is so common that there is legislation in place in most countries so that contractors can be reimbursed for clients that don’t pay on time. In the UK, this is the Late Payment of Commercial Debts (Interest) Act 1998.
If you work with paper contracts, payment is usually arranged between a supplier and a business by the supplier sending an invoice, which could take 30 days to be processed by the business’s accounts department.
With a smart contract, once the delivery is recorded, a set of processes is set in motion that ends with the supplier receiving their payment immediately.
Any supplier would be much more likely to work with a client that pays them near-instantly for the work they have produced, rather than one that takes 30 days or even longer. So using smart contracts can offer businesses a serious competitive advantage.
Underpinning the smart contract is a blockchain ledger, which records all the transactions and keeps a record of what state the contract is in. This being blockchain, the ledger is tamper-proof, so a client can’t claim to have sent the payment if in fact they haven’t.
The If This part of the smart contract can be anything you like, from confirmation a business has received a tranche of goods into a shipping port, to a freelance designer delivering a completed website to a customer.
According to Deloitte, the two most promising uses for smart contracts are supply chain and trade finance, as we’ve seen with IKEA Iceland above, and securities trade clearing. The systems in place for both of these areas can be painfully slow, and anyone able to speed up the process could save industries hundreds of millions of dollars a year.
US research organisation the Committee on Capital Markets Regulation has said as much. In a paper published in April 2019 analysts found that: “While the current [securities] settlement system handles a large volume of activity – the two main actors, the Depository Trust Company and National Securities Clearing Corporation, process 300 million shares per second during peak trading – settlement times can be improved.”
Long settlement times come at a huge cost “forcing system participants to hold over $5 billion in risk margin to manage counterparty default risk”.
If a new clearing and settlement system using smart contracts could allow for real-time settlement it would massively free up capital and make the financial system much more resilient.
Ethereum is the blockchain of choice for deploying smart contracts: firstly, because it is open source and secondly, because it is the first blockchain to have a Turing Complete virtual machine built on top of it.
The first point means that any developer can build their own smart contract and deploy it on Ethereum for free; kind of like writing a document using an open source programme like OpenOffice, instead of having to pay to use a proprietary program like Microsoft Word.
The second point means that nearly any program can be successfully run on top of Ethereum.
The programming language used most frequently for smart contracts is called Solidity. It shares a lot of features with C and Python and so is easiest to learn for programmers with some history of those languages.
Unfortunately, smart contracts cannot automate away human errors. Smart contracts have to be built by programmers, so it’s inevitable that mistakes will creep in.
As researchers at management consultants Clairfield note: “Such software errors may not be immediately noticeable and can lead, for example, to an incorrect monthly sum being charged for a smart contract for a mobile phone contract.
“In addition, smart contracts are not yet clearly regulated in legal terms, so that the question of liability is unresolved in many cases. As a result, consumers are currently completely dependent on the reliability of programmers.”
A bug in a smart contract might allow an item seller to request and receive payment multiple times, for example.
And only a vanishingly small amount of code is ever technically perfect.
Developers at NASA managed to produce zero defects in 500,000 lines of code for the software that launched the Space Shuttle in 1981. However this level of Quality Assurance came at the cost of about $1,000 per line.
The industry average is between 15 and 50 errors or bugs per 1,000 lines of code, according to Steven McConnell’s seminal book Code Complete. McConnell observes that Microsoft, for example, manages about 10-20 bugs per 1,000 lines of code in software released to the public.