An Introduction to Smart Contracts (Installment 1)

Aaron Diamond-Reivich
Published in
4 min readDec 6, 2017

If you have heard about Ethereum, then you have probably also heard about “smart contracts.” Without getting too much into the technical details, let’s look at why they are interesting.

Let’s start with a simple example. Suppose three friends, Alice, Bob, and Mike, are starting a business. They create a bank account for their business and each deposit their own money into the business’ account. Because they are all founders of the business, they all have access over that account. Suppose, after creative differences, Bob wants to start his own company. So, knowing that he has access to the business’ bank account, Bob secretly withdrawals all of the funds and uses it for the down payment on his new company office.

To prevent this from occurring without a smart contract, Alice, Bob, and Mike would need to use a “trusted” third party — probably a bank. They would give the bank control of the funds and create some sort of protocol for withdrawals. Perhaps they need to present the bank with a form signed by all of the co-founders in order to withdrawal the business’ money. The bank would then decide whether the requirements for a withdraw have been met and would distribute (or not distribute) the money accordingly.

What if the bank gets hacked? What if there is a bank run and they don’t have enough money for Alice, Bob, and Mike to withdraw their funds? What if a corrupt banker removes their account from the bank records? Although these are all unlikely to happen, Alice, Bob, and Mike do assume these risks when using a bank as a trusted third party.

So, what if they don’t want to relinquish so much control over to the bank? Alice, Bob and Mike could instead use a smart contract! At a high level, the smart contract would safely hold the money and control when it can be withdrawn. The smart contract would always and only allow withdrawals when the requirements for withdrawals are met. Perhaps Alice, Bob and Mike decide that money can only be withdrawn when at least two of the three founders have given explicit permission to do so.

You might be saying to yourself, the process to hold money in a bank or with the smart contract seems almost identical. In both cases Alice, Bob, and Mike deposit the money and decide on a protocol for withdrawals. When everything goes as expected, both processes have the same result. The difference is that smart contracts cut out the corruptible middleman, who, by the way, is probably charging Alice, Bob and Mike a service fee.

Smart contracts do not enable an entirely new type of transaction; they enable trustless transactions. Instead of trusting other people or organizations (the bank) to behave the expected way, Alice, Bob and Mike only need to trust the code of the smart contract. Once the code has been executed, it is irreversible and uneditable. Therefore, as long as they have done their due diligence and audited the code before they interact with it (a non trivial task), Alice, Bob and Mike can rest assured it will always act the way they expect it to. No matter how sinister the intentions of other parties, they can only take actions that are granted to them by the code of the smart contract. Therefore, as long as Alice, Bob and Mike understand what the code allows, they can trust anyone they do business with to behave in the prescribed manner. They don’t have to worry about Bob paying off the bank, the bank taking the money for themselves, or Alice adding code to the contract that lets her send the money to her personal wallet. The code is impartial.

What we have just discussed is an example of a multiple signature (multisig) wallet, which you can find more information about here. However, there are countless uses for smart contracts. Smart contracts can be used for supply chain management, decentralized governance, identity management, payments, voting, prediction markets, the list goes on.

As more and more transactions occur on the blockchain, the need to be able to understand smart contracts will only increase. It is never to early or late to start learning. If you want to learn how to write your own smart contracts, you can check out the documentation here!