Written by Jon Roethke and Hunter Gebron

When discussing blockchain technology, the topic of smart contracts is at the top of the list. Smart contracts will forever change the way we conduct business transactions. Or so the story goes…but what are smart contracts? And why are forward thinking business minds so fascinated by their existence?

The goal of this blog post is to demystify the most overused buzz phrase surrounding blockchain today. We will dive into an actual smart contract to see what is going on underneath the hood. Don’t worry, we are going to make this a simple and easy exercise. You do not need to be a computer scientist or blockchain wizard to understand smart contracts. They are really quite straightforward.

First, a bit of historical context.

The term “smart contract” was created in 1996 by computer scientist (and lawyer) Nick Szabo, in a blog post titled, Formalizing and Securing Relationships on Public Networks. Nick Szabo is an important figure in the history of blockchains as the inventor of Bit Gold. Bit Gold has been described by legendary silicon investor Naval Ravikant as, “the giant on whose shoulders bitcoin sits”.

Let’s look at what Nick Szabo describes in this now famous blog post as, “the granddaddy of all smart contracts, the vending machine”.

The vending machine? Yes, candy bars and soda cans. The vending machine.

The vending machine shares the exact same properties that smart contracts on the blockchain do today. A vending machine has hard coded rules that define what happens when certain conditions are met and then executes certain actions when those conditions are fulfilled.

For example:

If Bob puts a quarter in the vending machine then he will receive one can of soda.

If Alice puts in one dollar bill, then she will receive one can of soda AND seventy-five cents change back.

Simple rules are defined and enforced in this case by a machine in the physical world. In very much the same way, smart contracts are simple rules defined and enforced by code on the blockchain.

Now let’s look at an example of an actual smart contract and written in the programming language Solidity on the Ethereum blockchain. We will walk you through the code with commentary to explain what is going on and how it works.