Digital Pets That Don’t Die

In case you were wondering what tech billionaires are up to these days, here’s a hint:

That’s right, they’re breeding digital cats on the blockchain! CryptoKitties are here, and they’re priming Ethereum enthusiasts for an assured future as cat ladies. After just five days, CryptoKitties is the most popular application on Ethereum, accounting for over 15% of all transactions on the network. What better use case for an unstoppable world computer?

Remember when digital kitties didn’t need to live on a blockchain? Back in the 90s we had Catz, and they roamed the background of a user’s desktop. Catz featured a primitive AI where the animals developed personalities depending on user interactions. If the cat was neglected or abused, it would run away. And yes, users could breed, adopt, and sell their Catz.

Catz for Windows 3.1

The Catz craze lasted maybe six months. Much like real-world pets, desktop animals get tiresome after the novelty wears off. The parent company followed up with digital Dogz, Hamsterz, Horsez, Pigz, Bunnyz, and Guppiez, but nothing really stuck; users invariably got bored and left their Petz to starve or run away.

Virtual goldfish not boring enough for you? Here are some digital Bunnyz!

To improve user retainment, the Petz brand came out with a new product: Babyz. It was the same basic game engine wrapped in the skin of a Cabbage Patch Kid. While Catz was mainly used as a desktop distraction, Babyz was designed for long-term emotional bonds. Users could talk to their digital baby through a microphone, and eventually the baby would learn to speak back.

Babyz couldn’t breed like the other animals, but they also couldn’t die. While most people have no qualms deleting a tired pet, the situation is different with a digital baby, especially one that has learned to talk. Compassionate users set up virtual orphanages where people could put their unwanted offspring up for adoption. Thousands of Babyz languished in online homeless shelters until the game was discontinued in 2000, at which point the children were digitally euthanized.

Send Baby to the digital Baby Farm.

CryptoKitties boasts that their cats can’t be destroyed, but the whole point of a digital creature is that it can be destroyed. Dogz and Catz run away, and digital Guppiez go belly-up — These are features, not flaws. They remind us that commitment is futile and that life is just a long process of being abandoned by everyone we ever cared about until we die alone. The advantage of a virtual pet is that we can delete the evidence and move on.

Just like its predecessors, CryptoKitties were made to be abandoned. This time it happens on the blockchain, where CryptoKitty remains are replicated across thousands of computers all around the world, persistently occupying real estate long after we’ve given up on them. This is probably what it’s like to have kids.

Contracts, Code, and Complexity

The right to be sued is the power to accept a commitment. -–Thomas Schelling [1]

No one’s gonna do business with you without knowing they have recourse for when you try to weasel out. Even 5000 years ago, people created contracts on clay tablets so that they had something to take to the king if the counterparty welched.

Humans are opportunistic. Over time, people learned to be weasels. Some people learned to be exceptionally good weasels. Beginning in ancient Athens, these people were called lawyers (actually they were called orators, but served the same purpose).

Orators were paid well. Athenians knew that having a good lawyer could be a huge competitive advantage. If your counterparty hires Demosthenes to plead his case, then you’d better put Cicero on retainer.

Since then, litigation has been an arms race. 40% of Oracle’s headcount is employed on the legal team, and only because its friends Google and Microsoft invest just as much. Google spends $17 million a year on federal lobbying. The top issue? Patent protection.

As Karl Marx astutely observed, Competition is wasteful.

But competition does have one redeeming quality: It enables evolution. Without competitive exclusion, there would be no reason for natural selection and we’d all still be protozoa swimming in a primordial soup.

Instead, we’re complex organisms who know how to be weasels.

And it’s because counterparties spent 5000 years being weasels that contracts, and the laws governing contracts, have become so complex.

You don’t know the rule until you know its exceptions. In practice, the exceptions to the rule are the rule.

Contractual complexity is good. Complexity allocates responsibility and risk for the possible complications that might arise. This increases predictability, which allows counterparties to put more at stake.

While complex, the contracts and legal codes we have today provide better risk management than clay tablets and the Code of Hammurabi.

As the stakes increase, so does the cost of litigation. At some point humans began to think, Securing a commitment through legal coercion is expensive! Can we can have predictable risk allocation without using the threat of litigation? Maybe we don’t need the right to be sued in order to accept a commitment. Maybe a commitment can be self-governing.

A smart contract enforces a commitment without resorting to the threat of external litigation [2].

Early smart contracts won’t be robust against weasels, just like early clay tablets weren’t robust against Demosthenes. That’s why people didn’t put a lot at stake on a clay tablet. It was certainly no reason to throw out clay tablets!

It took 1600 years to go from the publican business partnerships in Rome to the Honor del Bazacle [3], the first modern joint-stock corporation. Romans had the technology to draft a corporate charter on papyrus; what they lacked was centuries of cumulative knowledge on how to structure a corporation.

Complexity has to be earned. Otherwise, it’s obfuscation. The Honor del Bazacle charter was complex because it had evolved the ability to protect its beneficiaries [4]:

Most early financial documents were fairly succinct records. Why would it take eight feet of tiny script to create a corporation?

The corporation is an organization that is designed to operate autonomously, perhaps for several centuries. The Honor del Bazacle charter is like a complete set of rules for playing a game: These rules needed to ensure that no single player, either unintentionally or willfully, could ruin the game or cheat the other players.

As a result, the Bazacle is an enterprise that still stands today.

bazacle

Last week, TheDAO put a corporation into a smart contract, and a weasel took a bunch of its money. Now its participants are pleading for an Ethereum fork that erases an unpredicted, but not unpredictable, outcome.

I have DAO tokens. I prefer that the “hacker” keep whatever ether I lost. The great thing about smart contracts is the predictable risk allocation. I signed up for the risk of losing my ether. I did not sign up for third-party adjudication.

The transaction-erasing fork will ultimately be decided by Ethereum miners, who can choose whether to adopt it in a software update. In a way, they serve as a decentralized parliament. But as someone who operates a mining node, I don’t want to be a parliamentarian. I didn’t sign up for that and I’m not qualified.

Blockchain contracts are not about adjudication by vote; we already have a very good solution for that in the modern court system. They’re about giving two parties the ability to trust a commitment. I want the rights and responsibilities that I signed up for.

References:
1. Thomas Schelling, The Strategy of Conflict. 1981.
2. Nick Szabo, Formalizing and Securing Relationships on Public Networks. 1997.
3. Germain Sicard, The Origins of Corporations: The Mills of Toulouse in the Middle Ages. 2015.
4. William Goetzmann, Money Changes Everything: How Finance Made Civilization Possible. 2016.

This one gets a picture. I was going to write a post summarizing the book, but I can't. There's too much good stuff inside.
This one gets a picture. I was going to write a post summarizing the book, but I can’t. There’s too much good stuff inside.

Contracts and Trust

Two nights ago, I was convinced to watch 50 Shades of Grey. Not the whole movie, thank god, just the contract negotiation scene.

I don’t get it, I said. Two adults are about to engage in sexual relations. Why do they need a contract? Don’t they trust each other? And if they don’t trust each other, why don’t they walk away?

The same question applies to pre-nups. Or even the institution of marriage! Unless one party poses a significant flight risk, why would willing participants need a legal contract to compel each other to stay?

To better understand this, let’s start with a simpler contract.

Loan contracts.

Suppose you apply for a mortgage with the best of intentions. The loan is approved thanks to your impeccable credit score and 10% down. It’s a large mortgage, but your salary is five times the monthly payment so you should pay it off no problem.

Fast-forward half a decade. The housing market has collapsed, your dog needs kidney dialysis, and to top it all off, a robot just took your job.

How motivated are you to continue paying that mortgage?

While you may be a trustworthy individual at time of loan application, it’s future-you that can’t be trusted. As long as the cost of defaulting on the contract (loss of home equity) is greater than the opportunity cost of mortgage payments, repayment can be coerced.

funny-wedding-cake-topper-remarkable-and-no-running-again-funny-wedding-cake-toppers-rwdreview-com

Much like a consumer loan agreement, marriage is an institution founded on mistrust. Sure, things are going great right now, but it is a cruel fact of nature that most humans do not age well.

What will compel you to stick around after she doubles in size and succumbs to the effects of gravity? And what happens after you become a balding couch ornament with the gut of a ruminant?

This is why marriage contracts were invented. Conjugal bliss can exist when both parties follow similar rates of decay, but this symmetry is rare. Discord arises when one party decays more rapidly than the other. Or, worse, when one party’s income substantially increases.

If the cost of terminating the marriage is less than the opportunity cost of remaining in the contract, it is inevitable that the contract will be breached. The key to a successful marriage is to ensure a sufficiently high cost of termination for both parties. Like, always keep a few thermonuclear warheads up your sleeve.

Back to 50 Shades.

If I understand correctly, the entire movie is about the process of contract negotiation. Christian Grey needs to protect himself from legal recourse if Ana decides to sue him for excessive shenanigans.

As a result, they arrive at an overly complex agreement detailing every possible activity or instrument that could possibly be employed. There’s an easier way.

Christian and Ana’s many pages of complexity can be reduced to a simple smart contract. Here’s how it works:

Each participant puts a valuable consideration (say, 10 ether) into escrow. The participants wear GPS tracking devices that continuously relay their location coordinates to the contract.

Just like in the movie, Ana has two safe words, yellow and red. After the first safe word is invoked, Christian has 10 minutes to move at least 1000 feet away from Ana. If the second safe word is invoked, and the contract detects that Christian is still within the stay-away radius, Ana gets all the money. If Christian is outside the radius and the red safe word is invoked, then Ana is being dishonest about her safety and Christian gets all the money.

Here’s a template, now all they have to do is put it on the blockchain.

import "math.sol";

contract FiftyShades {
    address dominant;     // contract participants
    address submissive;

    uint public value;    // deposit value
    uint public distance; // distance between dom and submissive

    int subCoordX;  // cartesian coordinates 
    int subCoordY;  // of participants
    int domCoordX;
    int domCoordY;

    // contract state. 
    // Green = no safe words yet.
    // Yellow = first safe word, Red = second safe word
    enum State { Dormant, Green, Yellow, Red }
    State public state;

    // when was first safe word used?
    uint public yellowStartTime;

    // submissive creates the contract
    function FiftyShades(int subCoordX_, int subCoordY_) {
        submissive = msg.sender;
        value = msg.value;      // submit deposit
        subCoordX = subCoordX_; // initialize location
        subCoordY = subCoordY_;
        state = State.Dormant;
    }

    // contract becomes active when dominant submits deposit
    function addDeposit(int domCoordX_, int domCoordY_) {
        // require an equal contribution
        if (msg.value < value) throw;

        dominant = msg.sender;
        domCoordX = domCoordX_; // init location
        domCoordY = domCoordY_;
        // deposits received, ready to go
        state = State.Green;
    }

    modifier onlySubmissive() {
        if (msg.sender != submissive) throw;
        _
    }

    modifier onlyDominant() {
        if (msg.sender != dominant) throw;
        _
    }

    modifier inState(State _state) {
        if (state != _state) throw;
        _
    }

    event aborted();  // cancel contract
    event yellowState();  // first safe word used
    event redState();     // second safe word used
    event falseAlarm();

    /// First Safe word used by submissive
    /// After first safe word, the dominant has 10 minutes
    /// to move at least 1000 feet away from the submissive
    function safeWordYellow(int subCoordX_, int subCoordY_)
        onlySubmissive
        inState(State.Green)
    {
        yellowState();
        subCoordX = subCoordX_;  // record location
        subCoordY = subCoordY_;
        yellowStartTime = now;   // record start time
        state = State.Yellow;
    }

    /// Second safe word used by submissive
    function safeWordRed(int subCoordX_, int subCoordY_)
        onlySubmissive
        inState(State.Yellow)
    {
        // has enough time elapsed?
        if (now >= yellowStart + 10 minutes) {
            state = State.Red;
            // TODO: check submissive's movement since last safe word
            // Ensure that submissive is not chasing after dominant
            subCoordX = subCoordX_;
            subCoordY = subCoordY_;

            // calculate distance beteen dominant and submissive
            distance = calcDistance();
            // is the dominant outside of the stay-away distance?
            if (distance < 1000) {
                paySubmissive();  // no: pay submissive 
            } else {
                payDominant();    // yes: submissive misused the safe word
            }
        }
    }

    function paySubmissive()
        inState(State.Red)
    {
        redState();
        suicide(submissive); // kill contract, everything goes to submissive
    }
    function payDominant()
        inState(State.Red)
    {
        falseAlarm();
        suicide(dominant); // kill contract, everything goes to dominant
    }
    /// Can only be called by the submissive
    /// before dominant deposit
    function abort()
        onlySubmissive
        inState(State.Dormant)
    {
        aborted();
        suicide(submissive); // kill contract, return initial deposit to submissive
    }

    function updateDomLocation(int domCoordX_, int domCoordY_)
        onlyDominant
    {
        domCoordX = domCoordX_;
        domCoordY = domCoordY_;
    }

    function updateSubLocation(int subCoordX_, int subCoordY_)
        onlySubmissive
    {
        subCoordX = subCoordX_;
        subCoordY = subCoordY_;
    }

    //pythagorean distance
    function calcDistance() returns (uint d) {
        int x = subCoordX - domCoordX;
        int y = subCoordY - domCoordY;
        int dist = Math.sqrt(x*x - y*y)
        return dist;
    }

    /// TODO: use Haversine distance, add trig fxns to Math lib

    function() {
        throw;
    }
}

For comparison, here is the 10-page entanglement the characters used in the movie.

Stalkers in a Decentralized Autonomous Organization

get_off_my_cloud

Several weeks ago, I made the silly assumption that DAO tokens were a safe place to park some ether.

Quick recap for the uninitiated: Ether is digital money, and the DAO is a Decentralized Autonomous Organization. The DAO acts like an investment fund, but is actually software on a blockchain. The investments are made using ether, and the fund was raised through the crowdsale of “tokens”, which would be like corporate shares except that the corporation is a piece of software. Tokenholders get voting rights when it comes to deciding how the software should operate (voting on proposals), and proportional rewards if the DAO ever manages to generate a profit.

So I put some ether into the DAO, got some tokens, and now the DAO tokens are trading at a discount to intrinsic value on crypto exchanges.

The DAO has 12.07 million ether, and there are a total of 1172.78 M outstanding tokens.
The DAO has 12.07 million ether, and there are a total of 1172.78 M outstanding tokens.

The intrinsic value is what you would get if you picked the DAO up by its ankles and shook out all the ether that investors put in. And for some reason, the market doesn’t think it’ll be easy for tokenholders to take that ether back out.

I decided to try. The DAO has a function that allows tokenholders to split, a secession where the splitting tokenholders create a separate organization and take their share of the ether with them. Here’s my split, E’s Castle Rock.

Screen Shot 2016-06-02 at 2.30.44 PM

The plan was to split, then have Castle Rock pass a proposal that sends all the ether back to myself. Annoyingly, splits sit as an open proposal for at least 7 days. During this time, any other DAO tokenholder may join the split, no invitation needed.

Already, a tokenholder with nearly twice my tokens has joined Castle Rock. If we complete the split, this person can outvote me on any proposal, forever locking my ether into Castle Rock. This sets him up nicely for an extortion scheme where I have to create a proposal that sends most of the ether to him if I want anything back at all*.

The DAO wiki proposes two solutions to this problem:

The first is to create a large number of decoy splits, and then wait until the last second to complete the split. There’s a single 10-second window between blocks during which I could safely do this.

Or, I could salt the earth and refuse to do anything at all, leaving both our funds locked up forever.

With all due respect, both responses kinda suck. But there might exist a third possibility. Stay tuned…

*As the creator of Castle Rock, I also serve as curator, which means that only I may whitelist proposals for voting. Curators exist to prevent a tyranny of the majority.

See Also:
How to Split the DAO

Why I am Participating in The DAO’s Crowdsale

Screen Shot 2016-05-16 at 12.36.41 PM

Ether is the currency of Ethereum, a distributed computer that runs smart contracts on a public blockchain.

Here is a list of things you can do with ether right now:
1. sell it
2. hold it
3. play betting games
4. buy DAO tokens

For everything else, there’s Mastercard. Or Bitcoin.

This won’t always be the case, but it’s been the case since last summer, when Ethereum launched. People have accumulated a lot of ether with few uses beyond speculation. So! Maybe no surprise that 13% of the total supply of ether has now been invested in The DAO, a Decentralized Autonomous Organization. This represents $117 million at current market rates, and rising!

The DAO’s purpose in life is to disburse crowdsourced funds to projects it deems worthy. CoinDesk does a good job of explaining it here.

More specifically, the organization attempts to achieve a return on investment by backing proposals chosen by token holders. Any token holder may submit a proposal, for example, this one making a smart lock device for the goal of creating a decentralized sharing economy. A Proposal comes attached to a Contractor, who receives payments for building the described Proposal.

The DAO can vote to remove the Contractor at any time and bring in a replacement. This protects DAO investors from things like Kickstarter vaporware. Of course, this doesn’t make The DAO seem like a very attractive place for project founders, but around here we serve the people.

The DAO pays contractors to build products, reaps profits or intangible benefits from the products.
The DAO pays contractors to build products, reaps profits or intangible benefits from the products.

I bought some DAO tokens in the crowdsale, which means I have the ability to submit proposals and vote on future proposals. I have no idea who the other investors are, what their investment objectives might be, or the extent of their understanding of how The DAO works. Come to think of it, this is a terrible way to form an investment partnership.

Fortunately, we share common goals, as defined by The DAO:

The goal of The DAO is to diligently use the ETH it controls to support projects that will:

  • Provide a return on investment or benefit to the DAO and its members.
  • Benefit the decentralized ecosystem as a whole.

Those are two different goals, equal only in their ambiguity. Hm, I’m generally not a fan of mixing profitability and utility. When proposals arise to “benefit the decentralized ecosystem as a whole,” no two parties will see the same utility from a given expenditure.

That’s okay, because token holders can leave at any time and take their ether with them. There’s a process where anyone can propose to “split”, which creates a second DAO with assets proportional to the number of tokens splitting off.

The price of DAO tokens, as denominated in ether. We are on Day 16.
The price of DAO tokens, as denominated in ether. We are on Day 16.

Early entrants to the crowdsale benefit from the fact that DAO token prices monotonically increase throughout the month, ending at 1.5x the starting price. Thus, anyone who purchased DAO tokens prior to yesterday effectively controls an amount of ether that will be greater than what they put in.

It looks a bit pyramid-shaped, but that helps to lower the risk-aversion hurdles for early investors. I suspect that many will split as quickly as they got in. As for my own participation in The DAO’s crowdsale, I don’t know. I have a lot of ether and I don’t know what to do with it. Someone please build something.