Smart Contracts Are All Around You

By Michael Munger

I hear a lot of people say they don’t understand blockchain technology or that the idea of “smart” contracts doesn’t make much sense. I’ll admit that the technical aspects of blockchain apps can be bewildering, but the fact is that you have been around smart contracts all your life. The difference is that until now smart contracts have mostly been physical and analog. Today, more and more smart contracts are software and digital. But things aren’t really that different.

Contracts are lists or sets of contingencies, with an agreement between two or more parties to act in certain ways depending on which contingencies are true and which are false. Some are simple: I pay you $1 for half a liter of water, and that’s the end of our dealings. Some are complex: a firm is a complex set of contracts, extending over time and space, with a person (“owner”) or a legal entity (“corporation”) serving as the nexus of all contracts.

The contingencies can be binaries (if you do THING, you get X; if you do OTHER THING, you get Y) or variables (if you do X units of Y, you will receive Z×X in payment). The contingencies can include failure to act or breach of the contract, and can specify background or opt-out provisions that allow either party to end the contract. The contract can renew automatically, end deterministically, or allow periodic renegotiation of some or all of the terms.

These binary and variable contingencies can be chained, with logical operators such as “AND” or “OR.” It looks something like this, where the “…” means arbitrarily many other conditions can be included:

If(condition=true) AND … If(condition=true)
AND [If(condition=true) OR If(condition=true) OR … If(condition=true)]
AND [If(condition=false) AND If(condition=false) AND … If(condition=false)]
AND If(variable >= [some specific value]) AND….

Now, let’s add a wrinkle: you can also write labor contracts, which may contain contingencies about the things you want the worker to do. One of the great innovations of the Industrial Revolution was the creation of a variety of gadgets we simply call “labor-saving,” because they stand in for labor much more cheaply, more efficiently, or both, than a worker could do that same task.

Using a gadget, as the gadget becomes more complex, may begin to approximate the old idea of a “golem,” or a mechanical/biological creature with no will of its own. The golem just follows instructions, but of course the instructions have to completely describe the contingencies and the desired action in that context.

Interestingly, the Hebrew tradition gives us the concept of a “golem” (גָּלְמִי), or animated unformed substance. The origins of the concept, from Psalm 139, suggest that

my frame was not hidden from Thee, when I was made in secret, and curiously wrought in the lowest parts of the earth. Thine eyes did see mine unformed substance.

The golem concept is extremely adaptable, and can be good or evil, but it is always some base substance animated by magic or life force. This animation is a useful way of thinking of gadgets, or (if I’m not stretching the concept too far) analog golems.

The Golem: A Better Mousetrap

You have a mouse problem. You could hire someone to watch the inside of your cupboards and to kill any mouse that comes in there. But that would be expensive. All you really need is to find a way to get rid of the mouse if the mouse actually shows up. All the rest of the time is wasted, because the mouse is somewhere else.

Abstractly, condition X has two values: Mouse in the cupboard means X=1 (”true”). Otherwise the mouse is not in the cupboard, so X=0 (”false”). What you need is a golem that will kill the mouse if X=1 and will stand there passively (and inexpensively) all the many hours that X=0.

That golem already exists, of course. It’s a standard spring-operated mousetrap. You bait the trap, set it, and leave it there in plain sight. So long as X=0, nothing happens. But if X=1 the trap snaps shut and kills the mouse.

The system isn’t perfect, of course. If the mouse has a very light touch, it may be able to steal the bait without triggering the trap. Or it may just sniff the trap, and patter around, and leave without touching the bait. That is, sometimes when X=1 the trap does not snap.

Alternatively, you might forget the trap is there and reach into the cupboard. The trap snaps hard onto your finger, meaning that the trap snaps even though X=0. Still, it’s pretty great to have a golem that can perform simple instructions, or even not so simple instructions: SNAP at the exact moment when “Mouse is in the cupboard” is true is a complex problem when you think of it.

The mouse trap is an example of a smart contract, in analog golem form. In her remarkable book Gods and Robots: Machines, Myths, and Ancient Dreams of Technology, Stanford Professor Adrienne Mayor gives a literate and creative history of the notion of delegating power and giving orders to man-made entities.

The first famous Greek “bronze man” was Talos, creation of Hephaestus, god of the forge. Talos was not a “true” man, because he was not capable of virtue. But he was capable of compliance, and he was formidable, able to clutch his opponents into a macabre hug close to his chest while he roasted them by heating the metal of his body.

Talos was mythical, but there is an actual example of a smart contract that is nearly as old. Around 100 AD (or so), Heron of Alexandria invented a kind of “vending machine,” for dispensing holy water. Apparently, worshippers were just taking holy water, even though you were supposed to leave an offering. That is, you get water if, but only if, condition “Paid a coin”=1. If “Paid a coin”=0, no water for you.

But it was expensive to have an attendant standing there guarding the water, so expensive that essentially all the revenue from selling the water went to paying the guard, which was no help to the temple. Heron designed a smart contract, in analog golem form. It was an urn, with a slot in the top. If you dropped a coin through the slot, it would land on a flat plate, and the weight of the coin would tip a valve open. When the amount of water equal to the weight of the coin had run out the spout, the plate tipped up and the coin fell into the coin box.

Of course, you could put a flat, smooth rock into the slot, and you could get holy water even if “Paid a coin”=0. And sometimes the coin bounced off the plate, so that even if “Paid a coin”=1 you didn’t get your blessed liquid. But overall it solved the problem, as net revenues for the water in the temple were increased substantially.

By now, we take analog smart-contract golems for granted, because they are everywhere. Soda machine? Smart contract: you can’t fool it with a rock, or even an exact metal replica. You can use a credit card in many machines. And there are several conditions you can select for the product you are buying: the size of the coffee, with cream and sugar. You likely have a “bread machine,” or know someone who does, which takes ingredients and produces bread. The BreadBot can make 10 loaves at a time, a distributed bakery technology that reduces the need for trucks and delivery, because you can let the golem do it.

Digitization

The real next step for smart contracts, the one that we are just now able to begin to see, is the move from analog to digital golems. Blockchain technology is ideal for creating digital golems, made only out of software but capable of executing agreements with complex contingencies. Smart contracts use software intelligence to monitor and enforce the terms of the contract at much lower cost.

As I said recently, in my piece that argued perhaps the boss really can just wear bunny slippers, the reason there are firms is that the costs of executing all transactions through the market is expensive. But having someone watch for mice in your cupboard was expensive; having an employee wait around to dispense ice-cold sodas or fresh hot coffee prepared as the customer wants it is also expensive, and we used golems to solve that problem.

The digital golem, or smart contract, stored on a distributed ledger using blockchain technology, is the next step. There are three major advantages to smart digital contracts.

First, they are pseudonymous, rather than either anonymous — where trust is difficult — or fully transparent — where information not needed to achieve trust is shared, not just with trading partners but quite possibly with large companies that will resell the information or with other people who will use the information for fraud or other malign purposes. Blockchain technology allows several levels of identity that share only what is necessary to ensure honesty in this one transaction, possibly through an intermediary, and then the information is once again private.

Second, they are reliable and difficult to fool, because they are distributed and the records are transparent.

Finally, elaborate contingencies are possible, including contingent contingencies — meaning trees of contingencies, where you aren’t sure which contingencies will be triggered — in which the artificial intelligence embedded in the contract software learns what works and what doesn’t work, much like a human manager of a company might do.

If you are interested in learning more about the technical aspects of blockchain applications, a good place to start is the “double Tapscott” book, which explains things pretty clearly. If you only have 20 minutes, you might try this TED Talk.

But you don’t need to understand the technology in order to derive value from it. You often watch television without being able to make one. You should be able to take advantage of smart contracts in many ways, and in many situations, if you just understand smart contracts are a way of managing contingencies.

Sign up here to be notified of new articles from Michael Munger and AIER.

Michael Munger

Michael Munger is Professor of Economics at Duke University and Senior Fellow of the American Institute for Economic Research. His degrees are from Davidson College, Washingon University in St. Louis, and Washington University.