A quick guide to understanding blockchain smart contracts

A quick guide to understanding blockchain smart contracts

Welcome to Hard Fork Basics, a collection of tips, tricks, guides, and advice to keep you up to date in the cryptocurrency and blockchain world.

‘Smart contracts’ is a term that gets thrown about quite often in the blockchain world, but there seems to be some confusion about what they are – and how they work.

Some context

The term was first coined by Nick Szabo, a prominent computer scientist, and cryptographer, who first proposed the idea in the 1990s.

Szabo realized that decentralized ledger technology could be leveraged for smart contracts, which could be converted into computer code, stored, and replicated on the system under the supervision of the computer network tasked with keeping the blockchain running.

Bitcoin was the first cryptocurrency to support basic smart contracts, in the sense that its network is able to transfer value from one participant to another. Its programming language enables the creation of smart contracts such as payment channels, escrows, multisig accounts, and time locks, but is somewhat limited.

Ethereum, on the other hand, was built with smart contracts in mind. It replaces Bitcoin‘s more restrictive script language with one that enables developers to build their own decentralized applications. It’s currently the most prominent smart contracts framework.

How do they work

Unlike a normal contract, which is drafted by a lawyer, signed by partaking parties, and enforced by law, a smart contract sets out a relationship with cryptographic code.

In simple terms, smarts contracts are self-executing, written into code, and built as complex if-then statements (meaning that they will only be fulfilled if the established conditions are met).

Ultimately, smart contracts remove the need for a third party, meaning participants entering into the agreement can transact directly with each other.

The best way to think about smart contracts is to imagine you’re trying to buy a can of soda, tagged as ‘A5,’ in a vending machine.

To make your purchase, you insert the amount, say $4, into the machine. Once you’ve inserted the funds, you need to select A5 in order to continue.

After you make your selection, the vending machine will set its lever in motion to push out your can of soda.

This highlights the need to fulfill each separate step in the contract between the individual buying the can of soda and the vending machine. In this case, the contract would stipulate that the correct amount of funds must be inserted, and the correct selection made, in order for the machine to push out the end goal (aka the soda).

You should also know that smart contracts can work independently – they can operate on a one off discrete instance – but they can also run alongside other smart contracts and the successful completion of one will trigger the beginning of another, and so on. So, if the soda inventory is low, another smart contract could order some more, and pay for them.

But, will they replace lawyers?

Smart contracts have been deemed potentially revolutionary across a range of industries with some observers going as far as saying that they will replace traditional contracts and lawyers.

Those who say smart contracts will render lawyers useless usually believe the entire legal agreement is expressed in its code. Essentially meaning that code is law and as such lawyers are unlikely to be required – unless they are also developers.

In general, smart contracts are perceived to be code (not law) used to automate the execution of an underlying legal agreement.

So, are they legally binding? I’m afraid not – at least for now.

Want to find out more about cryptocurrencies and blockchain technology? Check out our Hard Fork track at TNW 2019!

Read next: GitLab now automatically warns against merging API keys into your codebase