Behind the magic of the blockchain

This entry is part 2 of 2 in the series The magic of the blockchain

[Cross-posted at blog.chain.com.]

This is part two in a series. In part one, we learned that the big idea behind blockchains is this:

I don’t give you digital data as payment. I give the rest of the world a signed statement saying I paid you.

In this article we’ll take a closer look at just how this is done. That is, we’ll look at how:

  • I give the rest of the world
  • A signed statement
  • Saying I paid you

Let’s take these one at a time, in reverse order.

Step 3: …Saying I paid you

Suppose I want to pay you ten dollars on a blockchain. To “say” that I paid you, I have to construct a message called a transaction that combines information about what I’m paying with where I’m sending it.

what “ten dollars”
where “to you”

The ten dollars is called the input to the transaction. Where it’s going is called the output. Ultimately this message will be incorporated into a blockchain, which we learned last time is a ledger – a record of transactions – that is immutable, distributed, and cryptographically secure. More about this below.

Of course I have to have ten dollars before I can pay it to you. It has to come from somewhere. So the input needs to be some earlier transaction saying that someone paid me ten dollars.1 This means each transaction has to have some sort of unique name, or number, or other identifier, so later transactions can refer back to earlier ones.

transaction-id “unique identifier for this transaction”
input “unique identifier for some earlier ten-dollar transaction”
output “you”

What if the only earlier transaction I have is one where I received twelve dollars? Since I only want to send you ten, and since I have to use up all of the earlier transaction (for reasons that will become clear), my new transaction must send you your ten dollars and must also send me two dollars as change. This means that a transaction must be able to have multiple outputs.

transaction-id “unique identifier for this transaction”
input “unique identifier for some earlier $12 transaction”
output1 “$10 to you”
output2 “$2 to me”

Now that we’ve decided transactions can have multiple outputs, it’s necessary to say which output of an earlier transaction you’re using as the input.

transaction-id “unique identifier for this transaction”
input “unique identifier for output1 of some earlier $12 transaction”
output1 “$10 to you”
output2 “$2 to me”

And what if I don’t have a single $10 or $12 transaction to draw on, but I do have a $5 one and a $7 one? Let’s let transactions have multiple inputs as well as multiple outputs.

transaction-id “unique identifier for this transaction”
input1 “unique identifier for output1 of some earlier $5 transaction”
input2 “unique identifier for output1 of some earlier $7 transaction”
output1 “$10 to you”
output2 “$2 to me”

Let’s now focus on those unique transaction identifiers. How should they be chosen so that:

  • Distinct transactions have distinct identifiers, and
  • Anyone in the world can construct his or her own transaction, and
  • No one needs to coordinate with anyone else, or with any central authority, in order to construct a transaction?

The main problem is to prevent “collisions” – two different transactions having the same identifier. If you and I both construct a transaction at the same time, on opposite sides of the world, and don’t coordinate with each other or anyone else, what’s to stop us from accidentally choosing MYCOOLTRANSACTION17 as the identifier for both transactions?

Blockchains solve this problem using a technique called hashing. This is a process that transforms a message of any length, such as the transactions we’re constructing, into a single number of a predetermined size, called a hash. There are several different recipes for computing the hash of a message; they have names like MD5 and SHA1. But good hashing recipes all have the same goals:

  • Given a message, it must be easy to compute the hash (well, easy for a computer);
  • Given only the hash, it must be close to impossible to come up with a message that produces it (even for a computer!);
  • Two identical messages always produce the same hash;
  • Even a tiny difference between two messages must produce wildly different hashes.

The ease of going from message to hash, and the difficulty of going from hash to message, makes this a so-called one-way function, an idea that will be important a little later on.

Now, when squashing a long message down to a number of a predetermined size, it’s unavoidable that different messages will collide – i.e., produce the same hash. But if the predetermined size is big enough – 32 bytes, say – and if the recipe is very good at scattering hashes evenly throughout all 232×8 possible values (that’s 100 quadrillion-quadrillion-quadrillion-quadrillion-quadrillion, give or take a few quadrillion-quadrillion-quadrillion-quadrillion-quadrillions), then the odds of a collision are so low as to be effectively impossible.2

So when you and I construct our transactions, we don’t choose identifiers at all. Instead, we compute identifiers that are nothing more or less than a hash of each transaction’s contents.

input1
  • transaction hash of some earlier $5 transaction
  • output1
input2
  • transaction hash of some earlier $7 transaction
  • output1
output1 $10 to you
output2 $2 to me

When you are deciding whether to accept this transaction as payment for something, you can consult the complete history of transactions on the blockchain to make sure that the inputs of this transaction really do exist, and that they haven’t already been spent in some other transaction. Later on, when you want to spend this money you’re now receiving, someone else will look at this transaction to make sure you own it.

Using a transaction’s hash as its unique identifier also explains why one must consume all of a transaction’s output at the same time (as when, in an earlier example above, I had to consume a $12 transaction output and return $2 to myself as change). If I could consume only part of an old transaction, that would alter the amount available from that old transaction. Altering the transaction would change its hash, which cannot be allowed if hashes are permanent, unchanging unique identifiers for transactions. Once published on a blockchain, a transaction can never change, it can only be referenced by newer transactions.

Step 2: …A signed statement…

Remember that this transaction, like all others on a blockchain, is a message that’s going to everyone in the world. My earlier $5 and $7 transactions, the source of the funds I’m paying to you, are sitting out there on the blockchain for everyone to see, like all unspent transaction outputs, just waiting to be used. What prevents someone else from using them in a payment of their own?

This is where the “to you” and “to me” part of the transaction outputs come into play. I need to be able to write “to you” in such a way that no one but you can construct a new transaction claiming that $10.

This is done using so-called public-private keypairs. You choose a very (very, very) large random number and keep it secret. This is your “private key.” This number can be transformed with some fancy arithmetic into another number, the “public key,” that you publish for everyone to see. The fancy arithmetic is a one-way function akin to hashing, so no one with only your public key can figure out your private key.

Public-private keypairs have some amazing superpowers. One of them is that you can digitally sign a message so that everyone in the world can be sure it’s you signing it. You do this by combining your private key in a particular way with the message you’re signing (or, more typically, a hash of the message you’re signing). The resulting “signature” has some special properties:

  • It was created using another one-way function, so no one looking at just the signature can discover either your private key or the message you’ve signed;
  • There remains a mathematical relationship between the signature and your public key, so if someone has that and the message you signed, they can verify that the signature is genuine. Even without knowing your private key, they can be sure the signature was made from it, and from that particular message and no other. (So no one can take your valid signature from one transaction and stick it on another one in the hope that it’ll be valid there – it won’t.)

So to make sure that only you can access the $10 I’m paying you, I secure the output of my transaction by attaching your public key. I also secure the $2 in change that I’m paying to myself by attaching my public key.

input1
  • transaction hash of some earlier $5 transaction
  • output1
input2
  • transaction hash of some earlier $7 transaction
  • output1
output1
  • $10
  • to your public key
output2
  • $2
  • to my public key

In order to redeem one transaction’s output for use as the input to another transaction, the payee supplies a digital signature made from the new transaction’s hash and his or her private key. My transaction paying you $10 redeems $5 and $7 from two earlier transactions, which were paid to my public key, so I redeem them like so:

input1
  • transaction hash of some earlier $5 transaction
  • output1
  • signature made from this transaction’s hash and my private key
input2
  • transaction hash of some earlier $7 transaction
  • output1
  • signature made from this transaction’s hash and my private key
output1
  • $10
  • to your public key
output2
  • $2
  • to my public key

Anyone can look at this transaction and verify that my signature on the inputs matches the public key attached to the earlier transactions’ outputs. As long as I’ve kept my private key secret, no one else can produce a valid signature that matches both this transaction and my public key.

The balance of money that I own on the blockchain is simply the sum of all unspent transaction outputs that have my public key attached.

Step 1: I give the rest of the world…

These transactions must be distributed to be useful, meaning that everyone in the world has, or can get, the data they need to validate transactions.3 If I create a transaction sending you $10, in principle you’ll need the entire history of earlier transactions leading up to that one in order to validate it (i.e., to believe that you’re really receiving $10), including all the unrelated transactions in the system to ensure I haven’t spent that same $10 somewhere else. When you want to spend the $10 I send you, your payee will need the same thing.4

It’s easy to imagine a system in which each new transaction is broadcast to all blockchain participants that are somehow subscribed to new-transaction notices. But the reality of network delays means that different subscribers will receive these notices in different orders. (Transactions that originate closer on the network will arrive sooner, in general, than transactions that need more “hops” to get to you.) The system only works if everyone has a consistent view of the transaction history: if I see A, then B, and you see B, then A, we might disagree about the validity of C, and a distributed ledger (or any ledger, really) can’t work if there’s disagreement about a transaction’s validity. Here’s why: if I were dishonest,5 I might try to exploit network delays to spend the same $10 twice, to two different people, each of whom might believe (thanks to differences in ordering) that theirs is the valid $10 and the other is the invalid double-spend. No one would be willing to accept either person’s (purported) $10 as payment for anything, and confidence in the whole scheme goes out the window.

What’s needed is some authority that everyone can trust to put a stamp on the official correct ordering of transactions; and once the order is set, to publish the sequence for all to see. The published sequence could, in principle, consist of a list of individual, timestamped transactions, digitally signed by the timestamping authority; but if there are more than just a few transactions each second, the processing and communication overhead of this approach is prohibitive. For efficiency, it’s better to group transactions into blocks, certifying and publishing a block containing many transactions every so often, with each block linked to the block before it (by including the earlier block’s unchangeable hash, in the same way transactions refer to other transactions by their hashes) in an ever-lengthening blockchain.

Whom to trust for generating blocks in the chain? That depends on how a particular blockchain is going to be used. If it’s for managing an anti-authoritarian global cryptocurrency, the answer is “no one.” If it’s for managing the loyalty-reward points of a national coffee-shop chain, the answer is probably the corporate parent of the coffee shops. Other use cases require in-between levels of trust.

There are techniques for concentrating trust or spreading it around to match different use cases. The just-trust-headquarters case is easy, of course: everyone sends their proposed transactions there, and listens for the blocks that occasionally emerge, confirming their transactions. The trust-no-one case has everyone broadcasting their proposed transactions to as many others as they can, and everyone racing to collect them up and be the one that produces the next valid block in exchange for some small reward (a process called “mining,” designed so no one person or group can control the contents of the blockchain). The in-between case of trusting a group of independent authorities can require that, if one of that group proposes a block, all or a majority of the others must endorse it by adding their digital signatures.

In most cases, the simple existence of a transaction in a block of the blockchain is the transfer of money: final and authoritative, with no further steps required before the recipient can spend what they’ve just received – by adding a transaction of their own.

Sounds great but

Transferring money (or other kinds of value) on a blockchain is as fast and easy as handing someone cash – easier, since you don’t have to be in the same place to do it.

But cash isn’t the right answer for every type of transaction. Sometimes you need a delay, and sometimes you need to cancel or reclaim your payment. And what about this everyone-can-see-every-transaction business? Do you really want to give everyone in the world the ability to look at your whole purchase history?6

There are ways to preserve privacy on a blockchain, as well as ways to delay payment until a certain time elapses or other conditions are met, and even ways to eliminate “counterparty risk” (the risk that you pay for something and then don’t get what you paid for), but I’ve gone on long enough for now and discussion of those will have to wait until part three.

[My thanks to my Chain colleagues Adam Ludwin, Nadia Ali, and Zarya Faraj for their input on early drafts of this article.]
  1. And that transaction had to have a source too, and so on, and so on. Where do the dollars on a blockchain ultimately come from? It’s a good question with a complicated answer that we won’t get to in this article. The short version is that participants can “buy in” to a blockchain in the same way one converts dollars to chips in order to play at a casino (among other options). []
  2. Many newcomers to hashing worry about the difference between “effectively impossible” and “actually impossible” and waste a lot of energy in a vain attempt to eliminate even the tiny remaining possibility of a hash collision. But that’s only because our ape brains are bad at understanding really, really, really tiny possibilities. When it’s likelier that your blockchain system will be disrupted by simultaneous drunken-rhinoceros stampedes at multiple datacenters than by even one hash collision, your efforts are better directed elsewhere (like putting up rhino fencing). []
  3. Who is “everyone in the world”? It would be more accurate to say “everyone participating in a particular blockchain.” A blockchain managing consumer dollars, as in the examples in this article, would necessarily be global, and “everyone in the world” would literally mean everyone in the world. Other blockchains managing other kinds of asset might confine participants to particular companies’ customers, or particular traders, investors, or institutions. []
  4. If you’re thinking that’s a tremendous data requirement, you’re not wrong. In a future article we’ll discuss clever ways to mitigate this and even make it fast. []
  5. I’m not. But if I were, that’s just what I would say. []
  6. Millennials: this is a rhetorical question. The answer is “no.” []

These are the lessons of the starship Enterprise

I’m grateful to Wired for publishing the article about Star Trek on its fiftieth anniversary that I would have if I’d had the necessary time and insight. It argues that the incoherent spectacle presently being peddled under the “Star Trek” name takes merely the set dressing from the original and discards what made the original a classic: its point of view.

I’d only like to expand on that article’s point a bit, to say that the show’s point of view was not limited to politics. At its best, Star Trek was not merely a “blueprint for how to govern,” but a blueprint for how to live, teaching lessons about leadership, about balancing the head and the heart, about how to approach the unknown, and other evergreen questions about the human condition. These lessons were simplistic and moralistic, but to a young kid in Queens learning to make his way in the world during the golden age of nightly Star Trek reruns, they landed with all the more force for their simplicity.

The lesson of “A Taste of Armageddon,” in which Kirk forces a society to confront the true horrors of a centuries-old war that’s been mostly out of sight and out of mind? “War is hell.”

Of the time-travel story “The City on the Edge of Forever,” in which Kirk learns that to repair the broken timeline he must let the woman he loves die? “Leave well enough alone.”

Of “Amok Time,” in which Spock grieves, briefly believing he has killed Kirk in ritual combat while in the grip of the Vulcan mating fever? “Bros before hos.”

Of “The Ultimate Computer,” in which the advanced automation being tested to replace Kirk is revealed to be as deranged as its creator? “Garbage in, garbage out.”

Even after Star Trek graduated to the big screen, its best incarnation there, The Wrath of Khan, also embodied a simple lesson, suited to its maturing fan base: “You’re only as old as you feel.”

These are not merely glib captions. All the good episodes of classic Trek can be boiled down in this way, and taken together (and looking past the rubber alien costumes, the styrofoam rocks, the gauzy lenses used to shoot the occasional glamorous guest-actress, and the fair number of Trek episodes that were… less than classic), they amount to a viable, if patchy and now somewhat dated, handbook of manhood that shaped me and a whole generation of sci-fi nerds.

What can impressionable young fans take away from the current Star Trek films… other than how grumpy they make grandpa?

Close encounter of the Burtt kind

Back in 2013 I took my family to see a 30th-anniversary showing of Return of the Jedi (at “George Lucas’s favorite movie theater”). Before the show there was a costume contest: kids dressed as Jedi knights, stormtroopers, Yoda. Some women in gold Leia bikinis. After the show there was a panel with three of the Lucasfilm staff who’d worked on the movie in the 1980’s: two people I don’t remember, and Ben Burtt, the Oscar-winning genius sound designer.

Ben Burtt created the hum of lightsabers, the roar of the Millennium Falcon, the beeps and whistles of Artoo Detoo, the pew pew of blasters, and a hundred other sonic inventions besides. If you think about (or ever get to see) what the raw footage of Star Wars sounded like before his effects were added, you’ll quickly understand how much of that film’s wizardry was aural and not visual. Ben Burtt is my hero.

So after Ben Burtt told a bunch of terrific stories from back in the day at Lucasfilm (the other two panelists had little to say), and after the audience broke up, I just had to approach Burtt to shake his hand and tell him this:

“In 1977 I smuggled a tape recorder into the movie theater and recorded Star Wars. I listened to it over and over the way other kids listened to their favorite records. I have to tell you: the visual effects don’t hold up so well nowadays, but in all this time no one has ever surpassed the sound design.”

Burtt thanked me and, playfully immodest, agreed. He told me that, as a kid, he too smuggled a tape recorder into a movie theater once to capture the audio of his favorite film: Goldfinger! Great minds…

Batman vs. Superman: Home of the Brave

Much has been written about the many failings of Batman vs. Superman: Dawn of Justice, the joyless and senseless misuse of some of the world’s favorite characters, a film whose desperation to be the springboard for a procession of billion-dollar movies was palpable. I wouldn’t feel the need to pile on if it were merely a bad movie; that would be a simple shame and there wouldn’t be much more for me to say that others haven’t already said better. But it isn’t merely a bad movie: it’s nearly a great one. And that makes it worse, and worth writing about.

[spoilers follow]

This could and should have been a movie about fear and bravery. The thesis of this hypothetical better movie is right there in the ungodly mess of the actual movie: as Batman thrashes Superman, he growls, “You’re not brave. Men are brave.” Meaning, of course, that bravery requires fear. No deeds, even heroic ones, are brave if not performed in the face of fear. Batman cannot imagine Superman feeling fear, being (heretofore) invulnerable.

But fear is something Bruce Wayne understands all too well. His fear in that alley, watching his parents be murdered, was so profound it led him on a lifelong quest to master and overcome that fear, to never feel it again; to be so strong that fear could not touch him; to bend fear to his own purposes, reflect it back onto those who would dish it out.

He succeeded. Bruce Wayne has not felt debilitating fear his whole adult life… until the arrival of Superman, a potential threat he has no hope of defeating; something he cannot be stronger than. And now fear begins to work on Bruce Wayne the way it has worked on America these past many years: he prepares to betray his bedrock principles, to make a lethal preemptive strike in order to feel safe again. (Yes, I’m referring to Batman’s refusal to kill as a bedrock principle. Changing Batman into someone who doesn’t casually blow away bad guys like he’s James Bond is just one of the many changes this movie would need in order to improve.)

Less principled, but no less afraid, is Lex Luthor. He is the dark-mirror version of Bruce Wayne. He too has a deep-seated need to feel powerful. He too uses his vast wealth to create devices that enhance his own abilities. And he, too, doesn’t like the feeling that Superman gives him. It is telling (or in a better version of this movie, it would be) that Batman and Luthor are united in their goals and methods for much of the film. We all know that Luthor is evil. Now look at what fear has done to our beloved hero Batman: it is turning him into Lex Luthor.

Batman surprises Superman with a variety of Kryptonite-based weapons. With determination and a tremendous effort, Batman overpowers Superman. He is close to delivering the killing blow when, at the last moment, he redeems himself, turns away from the dark side, and spares Superman. Why does he? In the actual film, it’s because of a dumb coincidence: Bruce and Clark both have moms named Martha, and (in a highly contrived and out-of-character bit of dialog) Superman catches Batman off-guard by uttering that name out of context. That coincidence, the linchpin of this crucial turning point, is the reason audiences have to endure yet again the murder of the Waynes at the beginning of the movie—so that with his dying breath, Thomas Wayne can remind us of his wife’s name. In the better film that they didn’t make, Superman, facing his end, still begs Batman to save his mother, and this triggers the realization that Superman does feel fear after all—not fear for his own skin, but fear for the ones he loves. Far from posing a threat to humanity, Superman has that essential connection to humanity that Batman himself had nearly lost. Batman knows firsthand how love turns to fear—a much better reason to stage the Wayne murder again. For him, fear turned to power, which then turned to cruelty. It is an act of bravery for Batman to abandon cruelty in spite of his fear of Superman, and turn back in the direction of love.

Finding righteous common cause, together Batman and Superman overcome the real threats: those like Lex Luthor whose fear leads them to believe, and whose power allows them to convince others, that sacrificing the principles of justice will somehow make everyone safer. There but for the remaining spark of compassion in his heart nearly went Bruce Wayne.

This would have been a better movie. But even more than that, it’s a story that needs to be told to fearful, powerful America, which in its recent history has lurched towards cruelty and has not yet remembered: it’s supposed to be the home of the brave.

Update

My friend Bart thought this sounded like it would depend on interior monologue and asked (on Facebook) how I would stage it. My reply:

I would begin the film not with the Wayne murders but with a fantasy sequence where young Bruce Wayne disarms Joe Chill and saves his parents. When Martha scolds him for taking a dangerous chance, Bruce grins and tells her, “I had to save my mother.” Cut to the actual scene: Bruce terrified in the aftermath of the murders, his parents dead on the ground, a kindly cop telling him he has to be brave.

Later in the movie, adult Bruce has one of his usual nightmares. As Batman, he battles through a bunch of bad guys to rescue… his mother! Who again scolds him for taking dangerous chances. Batman grins (which is suitably weird under the cowl) and tells her, “I had to save my mother.” The dream image of Martha becomes bloody and Bruce wakes up with a start.

Finally, during the confrontation with Superman, it’s Superman’s turn to plead, “I have to save my mother!”

This might not mean much to the Batman we meet at the beginning of the film, who has turned cynical and cruel after twenty years of crimefighting in Gotham with little to show for his efforts. But beginning early in the story, Bruce Wayne has a series of tantalizingly brief meetings with an exotic, strikingly self-possessed woman named Diana, and for the first time in decades, his obsession with fighting crime begins to yield to an entirely different kind of fixation.

In fact, Diana Prince has Bruce Wayne’s number. He’s the reason she came to Gotham. He is an open book to her, as all men are to a certain kind of woman. She has watched as Batman has begun to lose himself in his dark mission and decided to take matters into her own hands. In her calculated short meetings with Bruce (during which she playfully teases him with phrases like “crusader” and “detective,” making him wonder what she knows) she probes, and deftly adjusts, his psyche. Her questioning leads Bruce to realize that he has dwelt on the same single memory of his mother for all these years: variations on the scene in the alley. Diana helps to unlock memories of earlier, happier times. Bruce remembers that before fear came love.

So when Superman tells him, “I have to save my mother!” it resonates in multiple ways. “There are other Kryptonians here?” Batman asks. “No… my human mother. She adopted me. She raised me. And she’s in trouble.” “What’s her name?” “Martha.”

Batman couldn’t ask for a clearer sign. Superman is not a threat to humanity. He’s a friend and a partner.

…It’s possible I’ve given this more thought than I really should. But at least in this version of the story, Wonder Woman uses her compassion (to “stop a war with love”!) and isn’t simply a “generic warrior woman” (c.f. What Film and TV Adaptations Don’t Get About Wonder Woman).

Otras palabras mías

Keeping you updated on every shareable thought that flits through my brain, since 2011.

  • Jonah did an authentic spit-take tonight. In a conversation about salt-water taffy, Andrea and I were remembering my one very failed attempt at making some, years ago. Jonah was drinking a glass of water just as I described my taffy as “a mouthful of vinegar cement.”

  • Fright Night. Total Recall. Miami Vice. Colin Farrell is the king of the unnecessary 80's remake.

  • Just received the settlement check in the malpractice case relating to the death of my mom in 2007. It isn't much, especially after lawyers' fees and other expenses, and it certainly does nothing to bring back my mom or make me miss her less.

    I'll tell you what has brought back my mom, in a way: my sister Suzanne's dogged handling of this long, slow, frustrating, bureaucratic process, driving it to completion in the face of delays and setbacks and screw-ups. The spirit of our mom, who loved to muscle her way through such hassles and proudly adopted the nickname Superpest, is alive and well in her.

  • I have only a vague notion of who Maria Conchita Alonso is, but that's not stopping her name from incessantly reverberating in my head this evening.

    It's not as bad as the Mandalit del Barco episode of 2013, thank goodness.

  • I have passed some sort of milestone in my inevitable progression to cranky old man.

    Encountering a group of 20-something coworkers having a collective smoking break outside the office just now, my reaction was not the usual nostalgic longing for a cigarette myself, it was anger. I wanted to say to them, “How dare you take your youth and health for granted like that.”

  • Elvis needs boats! Elvis needs boats! Elvis Elvis Elvis Elvis Elvis Elvis Elvis needs boats!

  • Oh Jupiter Ascending, why couldn't you be awesome?

  • Recognized a Luke Perry cameo in the end-tag of a Community episode. Andrea said, “Wow, he looks old.” Looked him up on IMDb. He's the exact same age as us. [http://www.sadtrombone.com/]

  • Grownups seemed a lot more grown up when I was a kid than they do now that I'm a grownup.

  • There once was a baby named Kade
    By Shane and by Erika made
    The news of his birth
    Encircled the Earth
    And people all over hoorayed

  • It doesn't seem like it should be much harder to eat a sandwich that hasn't been cut in half first, but it is.

  • As water cascades down onto my head
    I make a great effort of will
    And, snapping my thoughts to the moment, I think:
    Did I lather yet? Or must I still?

  • New episodes of Twin Peaks, The X-Files, and Coach are coming, as is a possible Clinton presidency. Looks like 90's nostalgia is on.

  • [On the ongoing saga of Radio Shack's imminent demise.] I seldom enter Radio Shack stores nowadays, so I suppose I'm part of the problem, but for sentimental reasons I'm still glad to see them cling to survival. I'm just old enough to remember bringing vacuum tubes to Radio Shack with my dad once in a while to plug them into the store's tube tester and replace the ones that didn't make the little light light up. Chuck and I supplied our electronics projects from there decades before anyone coined the term “maker.” My first computer came from Radio Shack, and I have as much fond nostalgia for it as any TRS-80 Model III owner; but I doubt many of them developed a crush on the recorded voice that answered the Tandy Corporation's main customer service line circa 1980. I dialed again and again just to hear some young woman thank me for calling Tandy and politely ask me to wait on hold in a perky Texas twang.

  • Today is “random holiday spirit” day at school. Kids are supposed to dress in the style of the holiday of their choosing. Archer said, “I'll wear a Santa hat. That will be my Halloween costume.”

  • Farewell, Candy Crush Soda Saga level 130. You were a worthy opponent.

  • How old does something have to be before it becomes “vintage”? How about “antique”? Or “ancient”?

  • There's a part of me that spends every waking moment tortured half to madness by two intractable puzzles: the true nature of reality; and how it's possible for any thinking person _not_ to spend every waking moment tortured half to madness by the true nature of reality.

  • In a conversation the other day with Jonah, I said something like, “You are in control of your emotions.” Jonah immediately recognized that I was unintentionally quoting a classic episode of Star Trek. So, so proud of my boy.

  • I am enjoying this interlude between the announcement of a working, reactionless spaceship drive and its inevitable refutation even more than I did the brief period we all believed in cold fusion in the 80's.

  • Jonah was playing a video game. Archer was watching. Archer jumped up from the couch and ran into the kitchen and back to the living room, saying “Good shot!” It was running commentary.

  • Just finished listening to Blueprint for Armageddon VI, the final installment in Dan Carlin – Hardcore History's magisterial podcast series about World War I. This installment was nearly four and a half hours long. The complete series adds up to over _twenty-three_ hours – and for this fan it's not enough. I would gladly listen to another six installments on the topics that host Dan Carlin admits he glossed over in the interest of time.

    I am amused that, in describing an incident near the end of the war, with just minutes left in this nearly day-long podcast series, Carlin tosses in the phrase, “Long story short…”

  • “On” purpose. “By” accident.

    Thanks,
    – Bob

  • Eight years now that the world has had to get along without Flori Glickstein. It's done its best, but it shows.

  • Final field trip of elementary school DONE.

  • By what black magic does Candy Crush Soda Saga keep me from getting sick of the tune that I've now heard over and over and over for 200 levels?

  • [On seeing the headline, “How Apple Hopes to Take A Bite Out Of The News Business.”] When I saw this headline, I got curious, and so: https://goo.gl/WIQzkC

  • Enjoyed Neal Stephenson's new novel Seveneves so much that the momentum has me now reading The Baroque Cycle for the third time.

  • [On the launch of kill-ralphie.com.] “When someone posted to Kill Ralphie, they were contributing a chapter to an ongoing story about a hapless lad who is alternately placed in immediate mortal danger, then rescued, both in the most creative and entertaining ways possible.”

  • If you're going to San Francisco
    Be sure to wear $491 dollars in your hair
    For when the City of San Francisco
    Tows your car to the impound they have there

  • Happy Canada Day
    Happy Canaday
    Happy Canad, eh?

  • The Plotkin sisters (Janet, Sherri, and Diane) are among my very favorite people to spend time with, and have been for literally my entire life. Not even an expensive tow can detract from the pleasure of an afternoon spent with one of my cousins.

  • Just realized that I was born closer in time to (the waning days of) the First World War than to today. Dang.

  • Dammit Bill Cosby. I Spy was one of my favorite things. Now I'll never be able to watch it again.

  • [On the announcement of a working Star Trek communicator.] Don't tell the makers of this item, but there is almost no price I wouldn't gladly pay.

  • Googler -> Xoogler

  • Batgirl, Batgirl!
    Batgirl, Batgirl!
    Where do you come from? Where do you go?
    What is your scene? Baby, we just gotta know
    Yeah, whose baby are you?
    Batgirl!

    (RIP Yvonne Craig)

  • Until very recently, having time to myself at home would have been a real treat, a chance to focus, catch up on correspondence, get some writing done, work on my side projects. Now I simply miss my family.

  • As a little kid, I used to watch my dad “make a left” each morning: walk down the long hallway outside our apartment as he left for work, then turn left around a corner and disappear from sight.

    Many years later, my kids would watch me from our front window as I turned left out of our driveway and disappeared on my way to work.

    Now I hand the kids their lunches and watch them disappear to the left on their way to school.

  • I wonder if I can sue Ashley Madison for _not_ containing my e-mail in their purloined account database, thereby revealing to the world what a boring faithful straight arrow I am.

  • A world with no Carl Sagan, no Jim Henson, AND no Oliver Sacks? What kind of cruel joke is this?

  • Every once in a while I'll spot a 19¢ packet of Kool-Aid at the store and buy it because childhood. Then I'll get home and remember all the other times that I bought packets of Kool-Aid on a whim, and I toss the new packet on the pile.

    Today it hit 103 in San Rafael and I made some Kool-Aid, dammit.

  • Have you ever visited a city that you've never lived in, but where you felt immediately at home? What place or places made you feel like that, and why?

    I don't mean getting to some vacation paradise, feeling your cares melt away, and declaring you could spend the rest of your life there. That's different from feeling _at home_.

    I've had this experience in Seattle and in Chicago, and conspicuously haven't in many other places, even places that are superficially similar. I'm at a loss to explain what it is about Seattle and Chicago that makes me feel that way (and what it is about other places that doesn't), but the sensation is undeniable, and Andrea has felt it too.

  • [On the publication of Wired's article “Your Body Is Surrounded By Clouds Of Skin And Fart Bacteria.”] Synchronicity:

    Last night this sentence popped into my head: We exist in a miasma of one another's exhalations.

    Why did that sentence pop into my head? I have no idea. It's not a typical thought for me to have, and nothing out of the ordinary relating to exhalations or other bodily functions took place to get me onto that topic. The thought sounded vaguely musical to me and I briefly entertained posting it to Facebook.

    Then this morning comes this interesting Wired article. The headline's a little more crudely put than my sentence, but it's the same idea, and interestingly, they're both seventeen syllables, like a haiku.

  • I thought I was old when they started rebooting movies and TV shows I watched as a kid. Now they're rebooting movies and TV shows I ignored as an adult.

  • Well, that was nice while it lasted, but it's time to go back to work. Gonna give the startup thing another go. Tomorrow I start at Chain.com.

  • Today I wrote code in Go and in Java and in Javascript and in Ruby and in Python and in SQL. Tomorrow, more of the same. Life is good.

  • San Francisco 49er

  • What's a screenwriting workshop doing in the middle of a Vegas casino?

  • It's my fault, sorry. I was just thinking Halloween needed an authentic scare, and then the Mets came within one game of losing the World Series.

  • “Fun Size” candies: what are we supposed to think about the other sizes? [Best response: “Regret size.”]

  • I've been a happy customer of dbrand's quality phone- and tablet skins for a few years. When I got my new Nexus 5X recently I promptly ordered a new set of skins from them. When they didn't arrive after a few weeks I contacted them and got back a remarkably contrite reply explaining that their shipping volume has begun to exceed the capacity of their present vendor and they're looking for new solutions; and in the meantime they shipped me a replacement set of skins AND refunded my money AND gave me a store credit AND included some extras in the replacement shipment they sent. I replied thanking them and telling them they went far beyond my expectations for good customer service, and that the only way for me to balance the scales was to worsen their shipping-volume problems by urging my friends and family to buy their fine products. So here we are: go buy dbrand's fine products!

  • What more natural, when hearing about a horrifying shooting rampage, than to imagine oneself as a potential victim?

    Having imagined that, what more natural than to imagine being able to defend oneself with one's own firearm, if it came to that?

    Somewhat less natural, apparently, is to imagine the other potential victims around you, having imagined the same things, terrified, confused, pulling out their own firearms, and looking for the threat they have to neutralize.

    You're standing there brandishing a gun. Imagine that.

  • For decades the fans have been saying we could do Star Wars better than George Lucas if only one of us got control of it.

    Well, one of us did, and WE WERE RIGHT.

  • Life tip: “hurry up!” makes people go slower; “please take your time” makes them go faster.

  • Discussing the mysterious bad smell in my car:

    Andrea: It smells like stinky cheese.
    Me: Cheese? Really?
    Andrea: Well, something's definitely… fromaging.

Santa Claus is painting the town

This one has been sitting in my “drafts” folder for a long time (unlike some others from the past).

You better shut up
You better not say
The press gets a hold of this
They’ll have a field day
Santa Claus is painting the town

He’s tossing back drinks
And taking in sights
Hitting on chicks
And getting in fights
Santa Claus is painting the town

He works so hard on Christmas
That a break we can’t begrudge
His behavior seems unsavory
But really, who are we to judge?

So if you should get
A call from the jail
Do the right thing
And post Santa’s bail
Santa Claus is painting the town

(Previously.)

The Aristocrats!

My sleeping brain has done it again.

Warning: crude humor ahead, which is surprising since my waking brain doesn’t “work blue.”

In this dream, we were visiting our friend and Archer’s sometime Shakespeare acting coach Scott at his cabin in Muir Woods.1 He told Archer this joke:

Q: What do the townspeople call the King’s fucking-cake?
A: A cake fit for a Queen!

In the dream it took both Archer and me a moment to get the joke. (I first thought it was a play on the gay-man meaning of queen, but it’s not.) But then we both did, and both laughed. I was at once appalled that Scott would tell that joke to my 11-year-old son and perversely proud that Archer got it.

My sleeping brain came up with a dirty joke that I didn’t get right away! How does that even work?!

  1. He does not have a cabin in Muir Woods. []

The magic of the blockchain

This entry is part 1 of 2 in the series The magic of the blockchain

[Cross-posted at blog.chain.com.]

You may have heard that the world of finance is getting excited about the potential of the blockchain (Economist, Financial Times, Forbes) and wondered:

What is the blockchain? What problem does it solve?

The blockchain is the technology behind the digital currency Bitcoin, but it has wider applicability. It is a collection of mathematical, recordkeeping, and communication procedures that makes it possible to trade digital assets securely.

Why is that a big deal?

Think of how useful it has been to digitize all kinds of information over the past generation or two.1 Digital information can be transmitted from place to place at lightning speed (literally), stored indefinitely, duplicated endlessly, and analyzed, processed, and transformed automatically, all without any loss of fidelity. This was all flatly impossible until quite recently. When it became possible, it didn’t just make things faster and more efficient. It enabled the creation of entirely new ways to produce and consume information that never existed before, and new industries built on top of them. Think Twitter, YouTube, Uber.

But money hasn’t been digitized – and has therefore been left out of all the dramatic innovation that has happened elsewhere in the economy – because digital information can be duplicated endlessly, which is at odds with the key feature of money: namely, that once you trade it away, you no longer have it. Think about it: without that feature, money would be useless.

If you have something valuable to sell, and I want to pay you with some digital data that I call “money,” what’s to stop me from keeping a copy of that data and then spending it again with someone else?

The blockchain, that’s what.

That’s impossible

You may now be thinking, “There’s no way to prevent the copying of digital data,” and you’d be right. Even so-called copy-protected data, such as a movie on DVD, doesn’t work on the principle of actually preventing copying. (It works by scrambling the data and refusing to descramble it unless the playback conditions are kosher. You can copy the scrambled data as many times as you like.)

And yet the blockchain does manage to prevent “double-spending.” You might now expect to hear an explanation of how it does so in terms of prime numbers, one-way functions, asymmetric encryption, and other arcana. But those are merely the implementation details, which we’ll save for another article. The main idea is this:

I don’t give you digital data as payment. I give the rest of the world a signed statement saying I paid you.

This is a fundamental and surprising insight into the nature of money: the token of exchange doesn’t matter as much as that everyone agrees an exchange took place. When everyone agrees on that, then I can’t double-spend that token, even if I’ve made a copy of it, because whoever I try to spend it with will know that token is no longer mine to spend. And they’ll know that you can spend it… and you’ll know that they know it.

The money at the bottom of the sea

Here it’s worth taking a little digression into the story of the Yapese and their Rai stones.

The Yapese live on Yap, an island in Micronesia in the South Pacific. You may have heard of the giant stone discs that they use as a traditional form of money. Hewn out of limestone rocks on Palau, some 200 miles away, and standing on edge, they tower over their owners, who sometimes have to stand on tiptoe just to peer through the holes drilled in their centers.

These coins weigh thousands of pounds each. They can’t be kept in a coin purse or even stored indoors, so they are propped up for display in public places. When it is time to spend one, the coin never moves – that would be too difficult, and might damage the coin (or the mover!). Instead, news of the transfer filters out to the Yapese, who maintain an oral history of the ownership of each coin. This shared “ledger” of trades ensures that only the current owner of a coin can spend it, no matter where it’s physically situated.

In fact, a rai stone being transported from Palau to Yap by outrigger canoe once famously sank to the bottom of the sea in a storm. When the sailors got home without their cargo, the Yapese did not doubt the fact of its existence, and since its location didn’t matter, they proceeded to trade it just like their other giant coins.

Imagine that an earthquake strikes the island of Yap. No one is hurt, fortunately, but all the stone discs are dislodged and they all roll downhill into the sea. No problem – the rai economy could still continue! Now imagine that, instead of an earthquake, collective amnesia strikes the Yapese. No one can remember who owns what! In that case the rai economy is destroyed and actual economic value is irretrievably lost. This illustrates that, in a very real sense, the record of trades is the money.

That kinda makes sense

Right?

Think about depositing money in the bank. You go to the bank and hand the teller some cash. Does the teller put the cash in a box with your name on it? No. Some of it goes into a vault, mixed with everyone else’s money. Some of it is put to work in the form of loans. In what sense is your money still in the bank? In the sense that the bank maintains a record of what it owes you if you ever come asking for it.

(To keep the bank honest, you also maintain your own records – deposit receipts, a checkbook register, etc. Occasionally your records and the bank’s may disagree. We’ll come back to this idea.)

Don’t we already have secure digital asset trading?

In a word, no.

The problem is that there are multiple recordkeeping systems that have to be reconciled with one another. When you swipe your debit card at a gas station (say), you initiate a series of steps in which you, your bank, the gas station, the gas station’s bank, and the card-processing network all have to make updates to their records. For efficiency, those updates are usually batched together with others, and they happen at different times for different participants in this transaction. The updates get transmitted between and among the participants, and those transmissions produce acknowledgements that also get transmitted. Each party has to incorporate the others’ details into its own recordkeeping, and if everything doesn’t agree, there may need to be some sort of dispute-resolution step, unless the cumulative error is small enough that it’s not worth it and someone just eats the loss.

All of this transaction clearing and settlement is comparatively slow and expensive and happens long after you drive away from the pump. The gas station has some “counterparty risk”: it has let you have its gasoline without being sure that it will get your money. (But that risk is small compared to the value of letting customers pay this way, which is why the gas station accepts it.)

This is all because no one involved – not you, not the banks, not the gas station or the card network – can be quite sure at any given moment where the money is,2 only that if they follow these procedures, it usually ends up in the right place. Each entity therefore does its own recordkeeping as a check and balance on the others – just the same way that you keep all your deposit receipts (you do, don’t you?) in case your bank ever shows the wrong balance on your account.

How does the blockchain help?

The blockchain is a ledger that is immutable, distributed, and cryptographically secure.

  • Ledger means that it’s a historical record of trades;
  • Immutable means that once a trade is added to the ledger, it is permanent and unchangeable;
  • Distributed means that everyone gets a copy of it (and keeps getting updates as they happen); and
  • Cryptographically secure means that that everyone can trust what’s in it.

If the parties in the gas-station example were all on the blockchain, what would be the steps by which the gas station gets paid?

  1. You add a transaction to the blockchain stating that some funds that you control (because in an earlier transaction, someone else transferred them to you) now belong to the gas station.

That’s all! When you commit to the idea that the record of trades is the money, there is no separate clearing or settlement step needed. The trade is its own settlement. As soon as you add that transaction to the blockchain, you lose control over those funds and the gas station gets control over them. The gas station can now add its own transaction to the blockchain transferring those funds to someone else – and you can’t.3

Would you like to know more?

In the original Bitcoin blockchain, there is one type of asset – bitcoin – and a predefined way in which new bitcoins can be “minted.” It is possible to generalize the idea of the blockchain, however, so that it can encompass many different kinds of asset (dollars, airline miles, corporate securities, loyalty reward points) with differing rules for issuing units of those assets onto the network. The next article in this series will take a closer look at the mechanisms behind the blockchain (including explaining why it’s called a “blockchain”) and describe some reasons and ways to alter the Bitcoin blockchain to make it suitable for other uses.

  1. I like to think of that scene in All The President’s Men when Woodward and Bernstein have to thumb through thousands of Library of Congress call slips one by one by one, hour after hour after hour. Today a few tap-tap-taps at a computer terminal are all that’s needed. []
  2. To say nothing of what the money is – which, as we’ve seen, is the record of who has paid what to whom. In this example (and in the economy at large) that record is a kaleidoscopic agglomeration of many differing and overlapping records, some of which lag behind others, some of which will never agree. It’s no wonder people are confused about money. []
  3. Of course it isn’t quite that simple. To achieve the cryptographic security that allows everyone to trust the contents of the blockchain, it takes a little time for the transaction to propagate across the network and for other participants on the network to certify it. []

The flip-around thing

After seeing the film The Martian, my sister Suzanne posed a science question about it to me, one that I can imagine many other moviegoers had as well. Here’s (an edited version of) her question and (an elaborated version of) my answer. Spoilers ahead!

Q: ?My very first thought when NASA finally realizes Watney’s still alive was, great! It’s only been 40-something days. Surely there’s a way for the Hermes crew to go back for him. And then I waited another hour before the movie caught up.

What I don’t understand is why that idea became such a big aha/eureka moment for that dude who thought of it, why the “top minds” at NASA rejected it, and why it took so long to get behind it as a plan. Why didn’t anyone think of it sooner? Why couldn’t they expedite the rescue by boosting thrusters or whatever? to do the flip-around thing earlier?

A: The movie was great (and very faithful to the book), but it could have done a better job of explaining why the Hermes-return solution was such a big deal.

Star Trek makes space navigation seem like steering sea vessels. Star Wars makes it seem like driving hot rods. Other movies, video games, etc. – and even Interstellar, which took pains to depict some exotic science accurately – give the impression that it’s just a matter of pointing your ship where you want to go, and going there. For better or worse, that’s the mental frame of reference that audiences bring to movies about space.

In fact space travel (given our present technology) is much more like firing a gun. The spaceship is the bullet. You get one main chance to aim correctly, and then BANG, off you go. After that there is no changing course. Tom Hanks puts it like this in Apollo 13: “We just put Sir Isaac Newton in the driver’s seat.” (Something no real astronaut would say, understanding that there is no time Sir Isaac Newton isn’t in the driver’s seat).

In fact it’s even harder than aiming a bullet because a bullet reaches its target, or misses, in fractions of a second. A spaceship bullet is aimed at something that’s months away, at a target that’s in motion, and it travels – or more precisely, falls – through a medium governed by gravity, where the sources of gravity – the Sun, the Earth, Mars, etc. – are all in motion relative to each other, creating ever-shifting “currents” tugging the spaceship this way and that.

Once the Hermes fired her engine for the return trip to Earth, that was pretty much that. It had almost no fuel left for other maneuvering. There was no “doing the flip-around thing.” It would have taken a fair bit of inspiration even to think of looking for a return-to-Mars trajectory (let alone a return-to-Mars-and-then-Earth-again one!) plus a lot of luck that one existed, plus a lot of work to actually find it, plus a lot of daring to attempt a critical resupply during the high-speed gravity-assist Earth flyby, all of which the movie depicts a little too simply.

Hopefully, the many cool science things that the movie does depict accurately will whet audiences’ appetites to learn more and thereby discover for themselves just how audacious and unlikely the rescue plan was. Meanwhile, go play with NASA’s interplanetary trajectory browser!

Remembering the past no guarantee of not repeating it

In February of 1992, Apple Computer flew me from Pittsburgh to California and put me up at the Cupertino Inn for a series of job interviews over a couple of days. I extended my stay in order to visit a few other companies too.

One of the companies on my list was a tiny e-mail startup in San Rafael called Z-Code. I was planning to visit them in the afternoon after spending the morning at a prominent computer magazine, interviewing for an editorial position. That visit went very well, and so had the interviews at Apple; and having driven from Cupertino to San Francisco for that interview, I now had a sense for how long the return drive would be, and how much farther out of the way a visit to Z-Code would take me.

If I hadn’t been such a Star Wars nerd I might have skipped it altogether. But I knew that Skywalker Ranch and Industrial Light and Magic were in San Rafael somewhere and I harbored a secret hope of spotting them as I navigated to my Z-Code visit. I visited Z-Code and, to my surprise, found that opportunity more compelling than the ones at Apple and at the magazine. Two months later I was living in California and working at Z-Code and the rest is history.

Now, almost a quarter century later, I’ve had a very similar experience. I interviewed successfully at a number of well-known medium-to-large-sized companies over the past several weeks but found a tiny startup – that I had almost dismissed, at first, as not worth my time – to be the most compelling. Tomorrow I begin at Chain.com.