This is the first of a multi-part series exploring smart contracts. It will explore the concepts and history of smart contracts, and go into depth for several specific use cases of smart contracts. This series is aimed at beginners, and will go over all of the necessary foundational information required to understand smart contracts. Although several platforms exist to deploy smart contracts to, this series will focus on the Ethereum blockchain.

So, what is a smart contract? Simply put, a smart contract is a piece of software that stores the negotiated terms of a contract, and then automatically executes those terms. This is a very powerful innovation in peer-to-peer interaction, and has the potential to profoundly disrupt both law and business. The innovative power of the technology cannot be overstated, and this concept cannot be compared to legal contracts as we know them. A legal contract explains to an outside arbiter what the agreement was beforehand, so that if (when) that agreement is not met by one or more parties, that third party can intervene and award reparations based on the recorded terms of the agreement and their discretion. This is a messy and often expensive way for businesses or individuals to operate, and within this framework the explicit agreement is only referred to should their be a perceived deviation from it.

A smart contract, takes the terms that were agreed to beforehand by both parties, and ensures the execution of them. No one can intervene, no one can use asymmetrical power structures to abuse agreements made in good faith, and because smart contracts are deployed to a blockchain, there is a timestamped proof of the contract that is held in a decentralized way by thousands of nodes acting as impartial third parties around the world.

The term “smart contract”, and its underlying concept was first coined by Nick Szabo, cryptographer and expert in digital currencies in 1994. He envisioned smart contracts as “a set of promises, specified in digital form, including protocols within which the parties perform on the other promises". The contracts taking a digital form instead of the typical form, written on paper and enforced in courtrooms offer a very significant difference. Collapsing the terms of the agreement, and the execution of that agreement into a single operation is significantly more efficient than legacy alternatives. It most certainly will save money, because these agreements can be drawn up and deployed without expensive legal counsel, but it will also save the time of parties on the potential wrong end of a dispute. Ensuring from the outset that established rules cannot be broken ensures that all parties involved are negotiating in good faith, because it is enforced by code.

The largest platform that is presently available to build smart contracts for and deploy them to is the Ethereum blockchain. Ethereum was conceived and proposed in late 2013, by Vitalik Buterin. It was built in 2014, and released as a beta platform in mid 2015. Since then, developers have been building smart contracts and decentralized applications for the platform that address a variety of use cases. At present it is the most built out platform for smart contracts and decentralized apps, and has several high-level turing complete programming languages as well as JavaScript npm modules to facilitate implementation and access through the web.

The most common programming language used to develop Ethereum smart contracts and decentralized applications (dApps) is Solidity. Solidity bills itself as “...a contract-oriented, high-level language whose syntax is similar to that of JavaScript and it is designed to target the Ethereum Virtual Machine (EVM)”. As a programmer who came up on Object-Oriented Programming (OOP), the similarities between OOP Solidity and functional JavaScript start and end with how the start of a function is declared, but I suppose that is a discussion for another article. Solidity is statically typed and objectively OOP, so to take a glance at it, it looks like Java with some C++. Solidity comes with extensive documentation, complete with code examples and no shortage of community developer support if you know where to find it. It also has an online code editor that acts as a real time compiler, which is extremely helpful to new developers and allows anyone interested to get started writing smart contracts.

The ultimate purpose of Solidity, as previously mentioned, is to be a high-level programming language to build smart contracts. The Solidity code is put through a compiler, there are also several implementations of the compiler if you have any specific preferences. The compiler outputs opcodes, which are a low-level language, similar to assembly code, which is for the consumption of the Ethereum Virtual Machine (EVM). The EVM is a computer, built into the Ethereum blockchain that executes opcodes, thus performing the functions that are built into smart contracts. In order to prevent nefarious or poor code from disabling the network with an infinite loop and stalling all of the nodes running the code, which in the case of decentralized blockchain would be all of them, the concept of Gas and paying for the computation used was built into Ethereum. These are very complex topics, and entire article series’ could be written about each of them, so if I’ve stirred your curiosity I encourage you to do more research.

I’ve tried to cover the foundational topics of smart contracts as they relate to the Ethereum blockchain without adding unnecessary complication to avoid confusion. However, if you are like me and benefit from an experiential approach to learning the rest of the series will be of interest. Over the next several parts of the series I will go over building and deploying smart contracts from very basic “hello world” contracts, to escrow contracts, coins and more, so please check back often.