What is a smart contract? - The Chainsaw

What Is a Smart Contract? A Beginner’s Guide

7 min read
Disclaimer

This article is for general information purposes only and isn’t intended to be financial product advice. You should always obtain your own independent advice before making any financial decisions. The Chainsaw and its contributors aren’t liable for any decisions based on this content.

Share

Follow

At the heart of the blockchain and Web3 ecosystem is the idea of the smart contract. Cryptocurrencies like Bitcoin might have kicked off interest in what the blockchain could do for money, but smart contracts represent the next phase in thinking: what else can the blockchain do?

Ever since Ethereum popularised the idea of turning a blockchain network into a distributed computer that can run software in a decentralised way, more effort has been put into developing the idea of a smart contract and imagining how their use can support a wide range of industries.

This post will define what a smart contract is, and explain what they do and what they can be used for. It will describe the benefits to smart contracts, as well as potential drawbacks.

What is a smart contract?

A smart contract is computer code that lives on the blockchain and automatically runs when certain predetermined conditions are met. 

A smart contract on the blockchain can do any number of things. It might track property ownership in real estate, facilitate cryptocurrency lending or create digital assets and tokens like NFTs. Any transaction you can imagine could likely be executed via a smart contract, and much of the work in the crypto and Web3 space right now is figuring out which would actually benefit from being put on the blockchain.

The general purpose of smart contracts is much in line with the rest of the crypto ecosystem: establishing trustless systems that can operate without the need for a central authority or intermediary. It’s helpful to think of them less as either ‘smart’ or ‘contracts’, and more like business rules translated into software. But thanks to the decentralised ledger of the blockchain, they can execute across organisations.

Keeping that in mind, it’s important to remember smart contracts are not necessarily legally enforceable like a regular legal contract. The legal enforceability of smart contracts will vary depending on your jurisdiction and will become a more relevant question if smart contracts are more widely used in sectors like real estate and law.

Many blockchains support smart contracts, but the majority of all current smart contract activity occurs on Ethereum.

How do smart contracts work?

A smart contract works in the form of a very simple instruction: if x happens, do y

Often, that simple formulation won’t be enough for the more sophisticated applications currently being imagined and built on the blockchain. As such, many decentralised app (dApp) developers will bundle smart contracts together to serve much more sophisticated applications.

The majority of smart contracts operating today tend to be in service of digital asset trading and DeFi (decentralised finance) protocols. A platform like Uniswap, which enables decentralised trading of various cryptocurrencies and digital assets, is powered by smart contracts that help connect buyers and sellers without the need for an intermediary market maker or guys making deals on the floor of Wall Street.

Smart contracts also facilitated the rise of NFTs (non-fungible tokens). Every NFT takes the form of a smart contract on the blockchain, and other smart contracts work to facilitate their trade, sale and interaction.

Here’s a theoretical example of how a smart contract could work in a ‘real world’ sense: let’s say an insurance company puts a life insurance policy on the blockchain. The terms of the policy could be encoded on the blockchain. If the person the insurance policy applies to passes away, the beneficiary could provide a notarised death certificate and the smart contract would automatically release the funds.

Benefits of smart contracts

Fans and developers of smart contracts tout a series of benefits they can bring, improving efficiency, trust and transparency in a whole range of use cases. Here are a few of those benefits — and some caveats to be aware of in each case.

Speed, efficiency and accuracy

The primary benefit advocates of smart contracts claim is in the reduction of friction in transactions. By ditching the middleman and intermediaries that usually facilitate transactions, smart contracts can be faster and more efficient than traditional methods. 

By leveraging automation and excluding redundant layers, a smart contract can accelerate transactions and make deals go through faster — provided they can neatly fit into pre-existing configurations laid out in the smart contract code. Applied to the right situations, a smart contract can unlock efficiency and speed gains relative to a usual business or contract process.

When it comes to the benefits of smart contracts for accuracy, you’ll often hear the phrase ‘code is law’ — suggesting everything is laid out in code and there is no room for misinterpretations. The smart contract does exactly what it is programmed to do — for better or worse.

Trust and transparency

Because smart contracts are on the blockchain, their operation is generally quite transparent. Using various tools — like Etherscan for Ethereum — anyone can have a peek at smart contracts and even (in many cases) the source code.

Advocates also argue that replacing human intermediaries and non-transparent systems with smart contracts will increase trust, by ensuring that essential functions are replaced with objective, auditable code.

However, it’s important to remember that, while transparency might sound great in the abstract, it’s often more complicated in practice. Just because you can see the code of a smart contract doesn’t guarantee you will be able to understand it and catch any thorny problems — and plenty of crypto scams and thefts have been driven by poorly constructed or deliberately malicious smart contracts. Do your research and always be careful.

Security

The transparency and decentralised nature of smart contracts is often offered as evidence that they are more secure than traditional processes. This can definitely be the case — and it is also true that having a rich community of developers and enthusiasts constantly auditing the behaviour of smart contracts means security problems can be identified rapidly.

Again, the real story can be more complicated. A smart contract has the potential to be very secure, but that is entirely contingent on both the developer and the user who is accessing it. Even the Ethereum developers admit that the world of smart contracts is “the perfect ecosystem to attract attackers looking to profit by exploiting vulnerabilities” and “unexpected behaviour”. Because of the irreversible nature of transactions on the blockchain, and the fact users are obliged to take responsibility for their own assets and wallets, it leaves the door wide open for sneaky behaviour from bad actors.

Savings

One of the benefits of bypassing the traditional intermediaries and middlemen is potential cost savings. Any point of a transaction which can be managed through a well-executed smart contract could end up being more cost-efficient for those on both ends of the transaction.

For example, in the case of Uniswap and other decentralised exchanges, a thriving marketplace for digital assets has emerged without the tremendous overhead in staff, equipment and technology that is usually required to operate a stock and equities exchange. 

Limitations of smart contracts

Some of the biggest proposed benefits of smart contracts can also be some of their biggest limitations.

While smart contracts can be of excellent service in situations where the details of the process or transaction are very clear and objective, they will not work in any situation which requires some degree of interpretation. For example, many areas of law which require complex decision-making by a human being are not very well served by a smart contract.

A smart contract is only ever as good as its developer. The proposed benefits will not materialise if the code is poorly written or lacking in proper security provisions. ‘Code is law’ is not beneficial if the code isn’t up to scratch, or if the law itself exists in an ethically or legally delicate situation. As a result, the present smart contract environment generally requires participants to have a good grasp of what it is they are signing up for, lest they be burned.

One of the primary barriers to more widespread use of smart contracts is regulation. Put simply, very few jurisdictions have made moves to integrate smart contracts into existing legal or regulatory frameworks. That means you won’t have your house’s title deed as an NFT any time soon, as property ownership generally means interfacing in some way with local governments.

blockchain interoperability smart contract

What industries use smart contracts?

At present, the widespread use of smart contracts is mostly utilised in the industries related to crypto and DeFi. This isn’t overly surprising — it’s where smart contracts were first executed, after all. Digital assets and NFTs operate smart contracts on blockchains like Ethereum and Solana, and DeFi protocols use smart contracts to drive new financial ecosystems.

However, there have been plenty of proposals to bring smart contract technology into industries like tech, law, logistics and agriculture, and a number of developers and projects are actively exploring these opportunities.

Real-world examples of smart contracts

The most prominent real-world examples of smart contracts are primarily in the world of DeFi and digital assets.

But many developers are exploring new ways to use smart contracts to bring efficiency gains and flexibility to a range of real-world applications. By pushing data and processes onto the blockchain, advocates hope to revolutionise everything from insurance and real estate to medicine. 

The proposed benefits for transaction transparency has led to proposals that smart contracts could simplify supply chains and international delivery infrastructure.

Conclusion

Smart contract technology is still ultimately in its nascency. Many of the fundamentals of how they can operate, and the systems and markets they can create have been proven in the digital asset space, but experiments in pushing their use into real-world applications and industries remain at a very early stage.

As various sectors and industries continue to experiment, and governments now consider regulatory frameworks for how smart contracts can interface with existing legal regimes, we can expect to see plenty more movement in the space in the coming years.