What are smart contracts?

A smart contract is a self-executing contract with the terms of the agreement between buyer and seller being directly written into lines of code. The code and the agreements contained therein exist across a distributed, decentralized blockchain network. The code controls the execution, and transactions are trackable and irreversible.

Smart contracts permit trusted transactions and agreements to be carried out among disparate, anonymous parties without the need for a central authority, legal system, or external enforcement mechanism.

While blockchain technology has come to be thought of primarily as the foundation for bitcoin, it has evolved far beyond underpinning the virtual currency.

History of smart contracts

Believe it or not, smart contracts long predate blockchain technology. While Ethereum, introduced in 2014, is the most popular implementation of the protocol, cryptographer Nick Szabo established the idea in the 1990s.

Back then, Szabo conceptualized a digital currency called Bit Gold. While the asset was never actually launched, this Bitcoin predecessor highlighted the smart contract use case — trustless transactions on the internet. If Web 1.0 was the internet itself and Web 2.0 the presence of centralized platforms, then Web 3.0 is the trustless, automated, user-powered version of the digital space.

Many, including the Ethereum website itself, compare smart contracts to a vending machine. Vending machines serve the purpose of a vendor providing the user with a product, without the need for an actual person to take the money and hand over the item. Smart contracts serve that same purpose but are much more versatile.

Smart contracts have advanced quite a bit over time. They started as simple if-then statements that a programmer can create and implement. However, those with programming knowledge are limited, centralizing these “trustless” contracts. Fortunately, those same developers are working to solve accessibility problems.

Since its inception, developers have made it so smart contracts can be made without coding knowledge. They’re increasing security with different programming languages, creating alternatives like secret contracts, and designing ways to automatically store smart contract history in a human-readable format — much easier than using the blockchain to read.

How do smart contracts work?

Smart contracts work by following simple “if/when…then…” statements that are written into code on a blockchain. A network of computers executes the actions when predetermined conditions have been met and verified. These actions could include releasing funds to the appropriate parties, registering a vehicle, sending notifications, or issuing a ticket. The blockchain is then updated when the transaction is completed. That means the transaction cannot be changed, and only parties who have been granted permission can see the results.

Within a smart contract, there can be as many stipulations as needed to satisfy the participants that the task will be completed satisfactorily. To establish the terms, participants must determine how transactions and their data are represented on the blockchain, agree on the “if/when…then…” rules that govern those transactions, explore all possible exceptions, and define a framework for resolving disputes.

Then the smart contract can be programmed by a developer — although increasingly, organizations that use blockchain for business provide templates, web interfaces, and other online tools to simplify structuring smart contracts.

Benefits of smart contracts

Speed, efficiency and accuracy

Once a condition is met, the contract is executed immediately. Because smart contracts are digital and automated, there’s no paperwork to process and no time spent reconciling errors that often result from manually filling in documents.

Trust and transparency

Because there’s no third party involved, and because encrypted records of transactions are shared across participants, there’s no need to question whether information has been altered for personal benefit.

Security

Blockchain transaction records are encrypted, which makes them very hard to hack. Moreover, because each record is connected to the previous and subsequent records on a distributed ledger, hackers would have to alter the entire chain to change a single record.

Savings

Smart contracts remove the need for intermediaries to handle transactions and, by extension, their associated time delays and fees.

Drawbacks of smart contracts

While smart contracts are great in concept, they’re certainly not perfect. For one, it’s worth remembering that smart contracts and blockchain networks are programmed by hand. Human error is always possible, and that error could lead to exploits. This is exactly what happened with the attack on Ethereum’s Decentralized Autonomous Organization (DAO) in 2016. Hackers exploited a vulnerability in the DAO’s fundraising smart contract and used it to secrete funds from the project.

That’s not to mention the lack of regulatory clarity when it comes to these autonomous agreements. While the idea of a secure, streamlined money transfer process sounds great on paper, there’s still taxation and other government involvement to consider. Users may want to have full control over their data, but how do governmental parties get what they need?

Also, smart contracts can’t pull information outside of the network in which they exist. At least not in their current state. In other words, you can’t upload data from an existing website to a smart contract on Ethereum. That said, there is a workaround in oracles — off-chain nodes that pull information from the internet and make it compatible with blockchain networks. Eventually, as databases move to the blockchain, oracles could potentially step in to play a role in making that happen.

Additionally, there is a long-standing scalability issue. Since inception, blockchain networks tend to struggle at the scale, meaning transactions could take minutes — if not hours — based on activity. While this could be a problem at first, it’s something that projects such as Ethereum 2.0 are looking to solve. Plus, a transaction taking a few hours is still much faster than the days it takes to move traditional funds.