Weekly Bytes 3: Smart Contracts

Peter Michalopoulos
Blockchain at Fordham
6 min readSep 25, 2019

The hype and excitement around smart contracts, while sometimes blown out of proportion, is deserved in almost all respects. They inherit the trustless, decentralized, transparent, and immutable nature of blockchain but for contracts.

We form new contracts every day. When you buy a sandwich, make a new online account, or call an Uber, contracts are everywhere. But they are generally written in words, governed by third parties and executed by human inputs. These qualities create added cost, lost efficiency and are socially exclusive.

Smart contracts can not only create added efficiency and lower costs of traditional contracts but enable the creation of completely new markets, let’s get into it!

A little history

The term smart contract was coined by American legal scholar, computer scientist, and cryptographer Nick Szabo in 1994. Szabo implemented these new smart contracts for a virtual currency he invented in 1998 called Bit Gold, somewhat of a precursor to Bitcoin.

What makes a contract?

Before jumping into how smart contracts are used in blockchain, we need to look at what makes a contract, a contract. We know that a contract by definition is an agreement between parties. But there is a legal distinction between an agreement and a contract that is critical to understand. “States generally recognize that although two parties can enter into a variety of agreements, a contract means that the agreement is legally binding and enforceable in a court of law” (Harvard Law School).

For a contract to be deemed legally enforceable, the courts must look at whether offer, acceptance, and considerations are met. I’ll leave the details of these terms for Google to define, but just know that a smart contract is not always legally enforceable.

Why do we need smart contracts?

In a traditional online transaction between two parties, there is an intermediary who sits in the middle, think eBay. On eBay, the seller goes into a contract with eBay to sell on their platform and the buyer does the same. eBay allows two complete strangers to transact since both parties trust the intermediary. This is great, but eBay takes high fees, and you have to trust eBay will do good on their end of the deal.

But what if you could do this same transaction without trusting a third party at all, but a piece of software run by everyone?

That’s where smart contracts come in. Defined by Nick Szabo, a smart contract is, “a set of promises, specified in digital form, including protocols within which the parties perform on these promises.”

Essentially, a smart contract is code that lives on a network and is triggered by a set event to complete an action. This triggered event can be from another smart contract on the blockchain or an external data source, called an oracle.

How does it work?

The most popular implementation of smart contracts is on the Ethereum protocol. The reason Ethereum is commonly referred to as “the world’s computer” is because it’s a global network of computers running smart contracts that all produce the same final state. So how does this work?

Let’s give a simple scenario, Alice and Bob want to bet on the Knicks vs. Nets game tonight. A die-hard Knicks fan, Alice bets Bob $50 in Ether (the currency on Ethereum) that the Knicks will win. To do this, Alice sets up a smart contract with Bob to make an automatic payment based on the outcome of the game.

Broadly, a smart contract is just a bunch of if/then statements. So Alice codes in the details of the contract, “If the Knicks win, pay me $50 in Ether from the contract. If the Nets win, pay Bob $50 in Ether from the contract.” Alice will then connect the contract to an oracle that gets NBA stats. An oracle is just an external data source. Bob and Alice will then send money to the contract before it is sent to the Ethereum network and included in a block.

When the Knicks inevitably smoke the Nets, the oracle will trigger the contract to instantly send all the Ether in the contract to Alice’s account, and the contract is complete.

Note: you do not have to store Ether in a smart contract but for an example like betting you would want to have the funds secured before the specified event.

What are some real-life uses cases?

The beauty of smart contracts is their self-executing nature. If a farmer takes out an insurance policy to protect his crops against natural disasters, he is at the mercy of the insurance company to make timely payments on his policy. But if their relationship is based on a smart contract, an ecological event could trigger automatic payment. This is because smart contracts can connect with an oracle allowing the contract to access off-chain data.

I’m no expert on insurance policies but let’s say the farmer took out a policy to protect his wheat crops from tornados. The smart contract could be set up to take data from a national weather database and in the event of a tornado in the area of the farm, the smart contract would automatically execute to instantly pay the farmer.

This is a very basic smart contract example, but hopefully, you’re understanding the full potential of this new way of contracting. Smart contracts can not only save insurance users big money but insurance companies too. If a cargo ship on a journey goes through particularly dangerous waters, you could set up a smart contract to automatically adjust, in real-time, the insurance premium the shipper has to pay.

Click here to learn about how Daimler, the company behind Mercedes-Benz, is testing using smart contracts to create digital identities to pay autonomous vehicles and infrastructure.

Smart contract legality

Smart contracts are a pretty cool piece of tech, but the legal system doesn’t always agree. Smart contracts are not considered legally enforceable, in many cases, unless accompanied by a written contract. This is because certain types of contracts must be written. This includes land contracts, the sale of goods in excess of $500, contracts lasting more than a year and contracts to be responsible for someone else's debt.

Companies such as the Accord Project are working towards making smart legal contract templates to help solve this problem.

Drawbacks with Smart Contracts

We need to remember that smart contracts are a piece of software. With software, also comes bugs. If there’s a bug in the code for an app on your phone, the developer can simply send an update to your phone and the bug will be fixed. But smart contracts are immutable, once they’re sent to the network and put into a block they’re final. Any bugs in your code cannot be changed.

Second, as mentioned before, you can set up a smart contract to react to some data input from an oracle. This creates a significant reliance on the integrity that data, which is a key component of the smart contract. You can have a perfectly written smart contract but if the data it receives to execute is bad, so is the contract.

Third, a single smart contract is run on every computer which validates transactions, commonly called a full node. This means the more complicated a contract is, the more expensive it will be to run. Every smart contract on the Ethereum protocol must be accompanied by Ether to pay the network to store and run the contract. So lots of code in your smart contracts means more Ether that needs to be spent.

Finally, smart contracts are visible to everyone. Since every full node on the network needs to run the smart contract to make sure it’s valid, they inevitably see the details of the transaction. There are proposed workarounds to this problem, but this is still a drawback to the transparent and immutable qualities that are so key to public blockchains.

What’s next?

Smart contracts are a lot cooler than some boring insurance policy payments, they can give businesses access to increased liquidity creating new markets and completely new business opportunities. So be sure to read more about how they’re being used. Also, I am by no means a legal scholar so if you want to get into the weeds, I would highly recommend reading Jason Rozovsky’s posts about blockchain governance.

For the next Weekly Bytes, a club member will be writing a post on Zero-Knowledge Proofs and the Big Four’s participation in blockchain, it’s gonna be a good one!

Weekly Bytes are weekly meetings held at Fordham University’s Rose Hill campus breaking down a range of blockchain topics.

--

--