What is a Smart Contract?

Robinhood Learn
Democratize finance for all. Our writers’ work has appeared in The Wall Street Journal, Forbes, the Chicago Tribune, Quartz, the San Francisco Chronicle, and more.

A smart contract is a digitally enforced agreement whose terms are written in code and are performed without relying on a third party.

🤔 Understanding a smart contract

In a smart contract, the agreed terms are written in code and stored inside a distributed ledger. The contract gets enforced if the agreed conditions are triggered. It's also designed to be immutable, meaning that changes made are irreversible. Since these contracts are decentralized, the outcome has to be validated by every computer in the network. This way, it's possible to verify transactions without involving any third party. Think of it as an encrypted box that only gives you access when certain conditions are met.


Suppose you run an insurance firm offering travel insurance. You need to plan for unforeseen incidents, such as flight delays. In this case, you’d link your smart contract to the global air traffic database. This database gives your smart-contract access to real-time air traffic data, making it possible to flag any flight delays that might affect your customers.If there's a delay for more than the agreed period, say two hours, the smart contract will wire money into a customer’s account without them having to make a claim. There'd also be no need to involve a third party for claim verification.


A smart contract is like a vending machine...

You put in a dollar, then press the button that matches your favorite chocolate bar. The rules of a transaction are pre-programmed into the vending machine. If the amount is right, then your product is ejected. Smart contracts work like that, too. They are enforced only if specific actions meet the programmed conditions. Similarly, you’d only get your chocolate bar or soft drink if you put in the right amount and press the right button.

Ready to start investing?
Sign up for Robinhood and get your first stock on us.
Sign up for Robinhood
Certain limitations apply

The free stock offer is available to new users only, subject to the terms and conditions at rbnhd.co/freestock. Free stock chosen randomly from the program’s inventory. Securities trading is offered through Robinhood Financial LLC.

Tell me more…

What is a smart contract?

The term ‘smart contract’ was first coined in 1994 by Nick Szabo, a cryptographer, and legal scholar. Szabo’s studies of cryptocurrency helped him realize that decentralized networks could support self-executing contracts.

How do smart contracts work?

The terms of the cryptographic contract would be written into lines of code, then stored and replicated across the network on multiple computers (or nodes). Blockchain, the transparent shared ledger where the contract is stored, protects it from deletion or tampering. The agreement would, therefore, remain unchanged over time, making it immutable.The individuals involved in this process would remain anonymous, thus guaranteeing privacy. For a transaction to go through, you'd only need to input data that triggers the conditions in the contract.

Are there smart contracts without blockchain?

Here's the catch — Smart contracts can't work without blockchain, since it’s the catalyst for implementing them.

Can bitcoin do smart contracts?

Bitcoin implemented the first smart contracts. It supported simple transactions by allowing the transfer of value (or tokens) from one person to another. The nodes on the bitcoin blockchain only let transactions to go through if certain conditions were met.

What are ethereum smart contracts?

Ethereum, has a lot in common with Bitcoin. It’s also distributed blockchain network. Only that it’s custom-made for creating smart contracts. Developers can write code for their smart contracts, and then store it in the distributed ledger (Ethereum blockchain). This way, an asset or currency is transferred into a program, which then runs the code. Once it receives the appropriate input value, it validates a condition and allocates the asset to any of the involved parties.

Ethereum smart contracts are fully independent but can be invoked from other smart contracts as well. This allowance creates a kind of domino effect where one contract triggers another until the entire transaction is executed.

For instance, if a vending machine ran out of chocolate bars, it’d invoke another smart contract by sending a signal to the supplier, who’ll then bring more chocolate bars. There'd be no need for an intermediary to monitor the machine.

What are the benefits of using smart contracts?

When you think of it, most businesses act as a bridge for customers to get something they need. Agreements that don’t need an intermediary could change this business model. Smart contracts could change the way we do business due to the following features:

  • They are autonomous: You don’t need to rely on a broker to confirm an agreement. It’s executed by the network only if the agreed conditions are met.
  • They can lower transaction costs: Getting rid of an intermediary means that you no longer have to incur additional fees so that your contracts can be formalized and enforced. Smart contracts can also reduce bureaucracy, thus saving time spent on each transaction.
  • Trust: The involved parties can also see the transaction history, and one can't claim they lost the contract since it’s replicated all over the network. When specific actions meet the agreed conditions, the smart contract is enforced, and the outcome is validated by every computer in the system.
  • Storage and backup: Every detail recorded in a smart contract is permanently stored in a distributed ledger. This list includes a record of every transaction that takes place.

How are smart contracts used in real-world scenarios?

Their use cases range from simple transactions like money transfers to complex ones like supply chain management. Here are some of the ways smart contracts are disrupting existing industries:

  • Supply chain management: In most supply chains, goods have to be approved and payments made at various checkpoints. This process generates plenty of paperwork, making supply chains hard to coordinate.Blockchain simplifies this by providing a secure digital platform where all the transactions can be carried out. Smart contracts can then be used to process payments along the way.Walmart makes a good case study for this. It uses blockchain to decentralize its food supply system. It tracks the origin of products from different suppliers using a system powered by IBM’s Hyperledger Fabric blockchain. Smart contracts are then used to upload certificates of authenticity at each checkpoint. This process makes it easier to trace the origin of products from the store to the source in case of foodborne disease outbreaks.
  • Healthcare: Blockchain technology makes it easier to encode and store personal health records. Since this information is valuable for research, access is only granted to specific individuals using a private key.
  • Derivative Processing: A derivative is a product that derives its value from something else. In financial markets, derivatives are used to transfer potential risks from one organization to another. Their value depends on the underlying asset (aka. instrument), which includes currencies, commodities, stocks, options, or bonds. The terms of a derivative can be implemented using smart contracts to create a platform for matching traders, holding funds, and settling contracts.
  • Replacement for Escrow: Escrow services help mitigate the risks involved when you’re transacting with a stranger. They act as a neutral third party to hold assets for buyers and sellers until the transaction is complete. This way, it reduces the risk of fraud. When the contract is fulfilled, everyone gets what is due to them. We can now replace escrow services with smart contracts. However, the terms of the agreement have to be well written with agreed scenarios to allow for funds transfer when the correct data is entered. For instance, they could be used to facilitate transactions between freelancers and their clients, where funds are only released if the task is completed as per the client's instruction. The freelancer won't have to keep following up on payments.

Can smart contracts be legally enforced?

Smart contracts are like instructions that are programmatically executed. They’re not agreements by themselves — just a new technology used to enforce processes. They only work if the parties stick to the agreed conditions. A legally enforceable contract should stipulate the actions one has to take if a party doesn’t follow the agreed terms, among other common contractual clauses. Smart contracts don’t cater to this since programmers can’t predict every contingency and convert it into code. Smart contracts currently have little impact in court when it comes to dispute resolution.

So, are smart contracts better than traditional contracts?

Remember, smart contracts are only as good as the developers who create them. They work based on the information availed during development. A few issues arise when you consider this.

Firstly, while it’s easy to create smart contracts for small transactions such as money transfers, some more complex transactions should be analyzed to ensure that details are not overlooked. Developers and lawyers have to collaborate and resolve any techno-legal issues.

Secondly, creating a completely secure smart contract is also challenging. Since this is a new technology, there’s no standard process or best practices for creating smart contracts, not to mention the shortage of expertise in the industry. This can lead to bugs that can potentially make the contracts vulnerable to cyber attacks if undetected.

Lastly, a traditional contract can be revised if the involved parties decide to do so. This practice does not apply to smart contracts; they are set in stone at the beginning.

Additional disclosure:

Purchasing digital assets (such cryptocurrencies and associated derivative products) comes with a number of risks, including volatile market price swings or flash crashes, market manipulation, and cybersecurity risks. In addition, digital asset markets and exchanges are generally not regulated with the same controls or customer protections available in equity, option, futures, or foreign exchange investing. These exchanges are also sometimes vulnerable to hacks in which digital assets are stolen.

Digital assets prices can change radically in a trading day and thus lead to significant and sudden financial losses. Under certain market conditions, you may find it difficult or impossible to liquidate a position quickly at a reasonable price.

Ready to start investing?
Sign up for Robinhood and get your first stock on us.Certain limitations apply

The free stock offer is available to new users only, subject to the terms and conditions at rbnhd.co/freestock. Free stock chosen randomly from the program’s inventory. Securities trading is offered through Robinhood Financial LLC.


Related Articles

What is a Cryptocurrency?
Updated March 08, 2021

You May Also Like

The 3-minute newsletter with fresh takes on the financial news you need to start your day.
The 3-minute newsletter with fresh takes on the financial news you need to start your day.

© 2021 Robinhood. All rights reserved.

This information is educational, and is not an offer to sell or a solicitation of an offer to buy any security. This information is not a recommendation to buy, hold, or sell an investment or financial product, or take any action. This information is neither individualized nor a research report, and must not serve as the basis for any investment decision. All investments involve risk, including the possible loss of capital. Past performance does not guarantee future results or returns. Before making decisions with legal, tax, or accounting effects, you should consult appropriate professionals. Information is from sources deemed reliable on the date of publication, but Robinhood does not guarantee its accuracy.

Robinhood Financial LLC provides brokerage services. Robinhood Securities, LLC, provides brokerage clearing services. Robinhood Crypto, LLC provides crypto currency trading. Robinhood U.K. Ltd (RHUK) provides brokerage services in the United Kingdom. All are subsidiaries of Robinhood Markets, Inc. ('Robinhood').