A Beginner’s Guide to Understanding the Blockchain (Part 3: Smart Contracts)
Tags: cryptocurrency, beginners, smartcontracts, blockchain
Published: 2021-06-23 14:19:44

---
title: A Beginner’s Guide to Understanding the Blockchain (Part 3: Smart Contracts)
published: true
date: 2021-06-22 16:26:58 UTC
tags: cryptocurrency,beginner,smartcontracts,blockchain
canonical_url: https://medium.com/coinmonks/a-beginners-guide-to-understanding-the-blockchain-part-3-smart-contracts-39166dbe7577
---

![](https://cdn-images-1.medium.com/max/1024/0*VhWH-Luw1NMF9LPT.png)<figcaption>A quick summary of Smart Contracts. Source: <a href="http://www.academy.shrimpy.io">www.academy.shrimpy.io</a></figcaption>

Now that you should have a better idea of blockchain’s key characteristics, and how blockchains work (_if you don’t, please read through_ [_Part 1_](https://derekklim.medium.com/a-beginners-guide-to-investing-in-crypto-74781455645) _and_ [_Part 2_](https://derekklim.medium.com/a-beginners-guide-to-understanding-the-blockchain-part-2-blockchain-consensus-mechanisms-f2900b967b69) _of my guide to blockchains_), I will go more in-depth into certain concepts that you will frequently encounter in your blockchain/crypto journey.

If you recall from my previous discussions of blockchain technology, I have mainly used Bitcoin as an analogy to elucidate certain properties and structures of a blockchain.

Because of this, you may have the idea that blockchains are solely used to keep a record of cryptocurrency transactions between individuals on a decentralized and distributed ledger that is immutable and fully transparent.

Whilst the decentralized, immutable and fully transparent features of blockchains might hold up in most instances, in some others (private or permissioned blockchains, of which I will discuss in Part 4) they do not.

Similarly, whilst the focus on transactions between individuals also stands true in many cases, in many others — they do not. There are many blockchains that allow for users to interact with another entity entirely: smart contracts.

**In other words, not only can blockchains verify transactions in a trustless environment, they can also execute smart contracts.**

**_What are Contracts?_**

In order to understand what smart contracts are, we first have to start from the very beginning — with traditional, conventional contracts.

I am very sure that all of you are very familiar with the term ‘contracts’, which comes to mean ‘written or spoken agreements that are intended to be enforced by legal means’.

In the real world, we deal with contracts all the time. When we want to buy a car, we have to sign a contract. When we want to rent or buy a house, a contract must be signed. When we sign up for employment, another contract must be signed.

The terms and conditions stipulated in these contracts are usually drawn up by one party, then read, verified and agreed upon by another. These terms and conditions are then expected to be adhered to for one or both parties. If anyone breaks a rule in the contract, the other party can seek to punish via a legal channel, and by engaging an intermediary to enforce the law on the offender.

In order to uphold these contracts, a large amount of resources (paperwork, money to hire a legal representative, human resource as intermediary) would be required. **It can end up being an extremely time and money-intensive process.**

![](https://cdn-images-1.medium.com/max/1024/0*7NzDspb01jxFMOGY.png)<figcaption>Visual representation of a traditional contract being executed. Source: <a href="https://dzone.com/">https://dzone.com/</a></figcaption>

Moreover, how can we be sure to know when the contract is broken? Sometimes there is no way of finding out until it is too late.

Here, we see two main issues with traditional contracts:

1. _Time and resource-intensive_
2. _Impossible for anyone to properly verify if contracts are upheld_

This is where smart contracts come in.

**_What are Smart Contracts?_**

In simple terms, smart contracts are programs stored on a blockchain that self-execute when certain pre-decided conditions are met.

If you recall, in the Bitcoin blockchain, _all_ the nodes on the network will verify incoming transactions before posting any updates to the ledger (only the node that is fastest to solve the computationally difficult proof-of-work problem will get to post that update).

Similarly, on a blockchain that supports smart contracts, _all_ the nodes in the network will execute the actions stipulated within a smart contract once the predetermined conditions are met. These actions could include releasing funds to the appropriate parties, registering a house, sending notifications, or purchasing a ticket etc. — all of which can be classified as _transactions_.

The blockchain is then updated when these transactions are completed (once again, only the node that is fastest to solve the computationally difficult proof-of-work problem will get to post this update). From this point on, the transactions can no longer be changed (_immutable_), and all relevant parties will also be able to see the transaction records for themselves (_fully transparent_).

![](https://cdn-images-1.medium.com/max/1024/0*qI3gKH0-RdV7BF8O.png)<figcaption>Summary of how Smart Contracts work. Source: <a href="https://101blockchains.com/">https://101blockchains.com/</a></figcaption>

**Smart contracts are typically used to automate the execution of an agreement so that all participants can be immediately certain of the outcome, without any intermediary’s involvement or time loss.** They can also automate a workflow, triggering the next action when conditions are met to ensure efficiency.

Let’s see how all these play out in a _real-world_ scenario.

Imagine that John wants to sell a house to Rachel, but is unsure if Rachel will pay him. He can set up a smart contract with Rachel on a blockchain that supports smart contracts (for example, Ethereum), laying out some terms and conditions that ensure he will always get paid.

For example, John can create a clause in the smart contract by writing some simple code, stipulating that the land deed of the house, that signifies ownership, will only be released to Rachel _after_ she has paid him through the blockchain.

This also benefits Rachel, who will feel safe to pay John the money too, because these actions stipulated in a smart contract cannot be changed or reversed once agreed upon (meaning once Rachel pays, the house deed will 100% be released to her).

**_Benefits of Smart Contracts_**

From this little scenario, we can see how Smart Contracts bring a lot more extra value over Traditional ones.

1. **Time:** It saves a lot of time for the parties involved because it cuts out the need for intermediaries (middle men/women) and paperwork. These usually will take up a lot of time to negotiate and coordinate with, and fill in, respectively.
2. **Costs:** In the same vein, costs are drastically reduced too due to these intermediaries and paperwork being cut out.
3. **Efficient:** Since they are written as code, these contracts execute almost instantaneously once conditions are met, without the kind of delays that are bound to take place in the case of a traditional contract, and when humans are involved instead.
4. **Accurate:** Because of how these contracts are executed by code and algorithms instead of humans (that can potentially make errors), this ensures that agreements will be carried out to a tee, and without errors.
5. **Binding:** It ensures that no one can default on the agreement, because once agreed upon, the code algorithm will execute no matter what the moment the pre-decided conditions are met.
6. **Transparent:** Because the record of the transaction (after the execution of a smart contract) will be posted to the blockchain ledger for all relevant parties to see, there is full transparency in the whole process.
7. **Secure:** As all transactions that occur on the blockchain are cryptographically encrypted, they are very difficult to hack or track. Moreover, the fact that the blockchain ledgers are distributed across so many different nodes render it almost impossible for records to be changed.

**_Smart Contract Use-cases_**

As should be obvious to you by now, smart contracts can be very useful in many different situations.

Here is a concise infographic (non-exhaustive) that lists out such situations:

![](https://cdn-images-1.medium.com/max/1024/0*FKGuX45afVYvp0x3.png)<figcaption>Source: <a href="https://101blockchains.com/">https://101blockchains.com/</a></figcaption>

If you can think of more use-cases, feel free to start a discussion down below!

Prev: [A Beginner’s Guide to Understanding the Blockchain (Part 2: Blockchain Consensus Mechanisms)](https://derekklim.medium.com/a-beginners-guide-to-understanding-the-blockchain-part-2-blockchain-consensus-mechanisms-f2900b967b69)

Next:

* * *