Bitcoin as a Smart Contract Platform

Just got back on the red eye from Lima, having survived the Inca Trail and Amazonian rainforest. I’m back in action for the Bit tomorrow, but for today, one last guest post (really, syndication) from IBM’s Richard Brown on Bitcoin as a smart contract platform. As usual, it’s great stuff, and I hope I haven’t spoiled you all with this excellent guest content from the past couple of weeks. Back to more humble idiocy starting tomorrow.

Hasta mañana, amigos.

BITCOIN AS A SMART CONTRACT PLATFORM
by Richard Gendel Brown @gendal

Distributed Ledger Platforms may be Getting All the Hype but the architecture of Bitcoin is more sophisticated than many people realise

I was a guest of the Financial Services Club Scotland last week. I presented an update on the world of cryptocurrencies to an engaged and well-informed audience in the library of the Royal College of Physicians.

I reprised my current theme that the world of “blockchains” is really two distinct worlds — the world of Ripple-like ledgers and the world of Bitcoin-like systems — that happen to be united by a common architecture, the Replicated, Shared Ledger. This unifying concept is based on the idea that each participant has their own copy of the entire ledger — and they trust the “system” — whatever system that is — to ensure their copy is kept in sync with everybody else’s. The differences are about what the ledger records and how it is secured.

Bitcoin-like and Ripple-like systems

Broadly speaking, Ripple-like systems are focused on the representation of “off-system” assets and are secured by identifiable entities. Systems like Ripple, Hyperledger and Eris are broadly in this world, I think. The security model of these systems is based on knowing who the actors are: if somebody misbehaves, we can punish them because we know who they are!

Bitcoin-like systems are more focused on “on-system” assets and are secured by an anonymous pool of actors. Bitcoin and Ethereum are broadly in this space, I think. The security model here is based more on game-theoretic analyses of incentive structures: the goal is to make it overwhelmingly in the actors’ financial interests to do the “right” thing.

There is, of course, some ambiguity since all platforms have some notion of “smart contracts” — or otherwise recording real-world agreements, as well as asset ownership. But this makes intuitive sense. If your platform is concerned with real-world assets and agreements then you necessarily need some concept of identity (who are the issuers?). And if you’re reliant on the performance of real-world actors, why not also rely on them for the overall system security? Likewise, if the whole purpose of your platform is to create and manage a new asset that can be controlled/subverted by nobody, then giving identifiable entities the power to control your security would seem to defeat the point!

Different design goals, different implementations. And the value of such systems to banks, corporations or individuals is, ultimately, an empirical question. I imagine 2015 will be the year where we discover many of the answers.

Incrementalism versus “Disruption”

But I went further in my talk. I observed that these two worlds also differ in one other respect: the Bitcoin-like systems could be disruptive to existing institutions if they gained widespread adoption, whereas Ripple-like systems seem, to me, to be far more closely aligned to how things work today and are, perhaps, a source of incremental innovation.

If this observation is correct, then firms looking at this space probably need to assess the technologies through different lenses. The question for banks for Ripple-like systems is: “how could we use this to reduce cost or improve our operations” whereas the question for Bitcoin-like systems is: “how would we respond if this technology gained widespread adoption?”

And to answer the last question, one must be sure to really understand what the system under analysis really is!

Bitcoin as a currency might be to miss the point

For me, it is a mistake to think about Bitcoin solely as a currency. Because the Bitcoin currency system is a masterclass in mirage: underneath the hood, it’s a fascinating smart contract platform.

Or, as I said at the Financial Services Club, every time you make a Bitcoin payment, you’re actually asking over 6000 computers around the world to run a small computer program for you… and your only task is to make sure that the computer program returns “TRUE”. Within the Bitcoin community, this is well-known, of course. Indeed, the work done by Mike Hearn and others to document the platform’s capabilities has been around for years. But I find most people in the broader debate are unaware that the platform is pretty much built on this capability — it’s not an add-on.

Bitcoin is a smart contract platform

I wrote a piece last year offering an intuition for how Bitcoin works, in terms of land. My point was that the fundamental building block of the system is the “unspent transaction output”, or UTXO. The UTXO is what you get when somebody “pays” you some Bitcoin. The “output” of their transaction is the money they paid to you. And whilst it sits in your “wallet”, it is, obviously, unspent. Hence “unspent transaction output”.

So you can think of the current state of the Bitcoin system as being a huge pool of UTXOs: all the payments that have been received by Bitcoin users that they have not yet spent:

Every payment that has not itself been spent is modeled in the Bitcoin system as an “unspent transaction output”. In general, each UTXO can only be spent by the owner of the “address” to which it was sent (not always, and this is the point; see later). And each UTXO has an identifier (the transaction it appeared in and its position in the list of outputs of that transaction) and a value: how many Bitcoins are represented by that UTXO.

But what people often miss is that these UTXOs are actually tiny little computer programs that live on the ledger, control access to bitcoins and run in response to specific incoming events. Smart Contracts, if you will. And the only way you get to spend the money controlled by that contract is if you can provide some input data that allows every node on the system to execute the program and check that it returns “TRUE”

If you can make the program return “TRUE”, you get to say what happens to the funds. If you can’t, then you don’t.

So, when you want to spend your money, here’s what you do:

Your wallet software writes a little computer program for you and then sends it into the bitcoin network. It effectively says to the network: “Please run this little program I’ve just given you. Then please find a program (“smart contract”?) on the platform with this ID for me. When you’ve done that, feed the output from my program into program you just located”. So this is a two step process: you provide your own little program… and the output of that is fed to the UTXO program that you want to spend.

The way you spend money in Bitcoin is to ask the platform to run a small computer program that you provide and feed the output of that program to the “smart contract” that is storing the funds you want to spend. If you can make this second program run successfully, you get to spend the money. In Bitcoin terminology, the program you provide is “scriptSig” and the UTXO program is “scriptPubKey”. Your goal is to provide a “scriptSig” whose output can be fed into “scriptPubKey” to make it return “TRUE”

So what are these little programs? In the common case, they’re really simple. The “UTXO program” simply says: “provide me with a digital signature that proves you own the key associated with the following Bitcoin address (and please also prove that you know the public key that corresponds to the bitcoin address)”. That’s why it’s called the “scriptPubKey”.

And the program you provide is just a way to ensure the bitcoin system sends this proof into the scriptPubKey program in the right way. It’s a way of providing a digital signature. Hence it’s called the “scriptSig”

If you don’t know the private key then you can’t generate the right signature and so you can’t create the input necessary to get the smart contract (scriptPubKey) to run successfully and you don’t get to spend the funds. So this, seemingly complex model, is just a way to ensure that the only person who can spend money at address 1abcde… is the person who knows the private key… exactly as we would want.

Why is it this complex?

But notice how powerful this is… because the other thing you do is tell the system to replace the existing scriptPubKey program with one or more new programs. And this is how your payment is modelled in the system. You pay somebody by creating a new program (a new scriptPubKey) that only they will be able to execute successfully. In this way, you can pay different people or send change back to yourself. The program that only you can run is replaced with ones that only the payees can run. And, in this way, the value has been passed from you to them.

So the result is that the original program living on the ledger is replaced by one or more new programs. In the usual case, one or more of these new ones will be associated with somebody else’s bitcoin address so only they will be able to control it. You have, in effect, paid them that money since the funds are now under their control

Paying somebody in Bitcoin is the same as replacing the program you control with ones they control. In this diagram, the funds you controlled have now been split between two new recipients. Only they can spend those funds.

Smart Contracts?

So what does this have to do with smart contracts? The key is that the model I outlined above is quite generic. The programming language is (just about) powerful enough to implement some interesting business logic that goes beyond “Richard paying money to Bob”. For example, you can write a program that will only return “TRUE” if you provide proof that you know the private key to multiple bitcoin addresses. This is a way to model “a majority of Board Directors must jointly sign before these funds can be spent”, perhaps. The Bitcoin “contracts” wiki page goes into far more depth.

However, the reality is that the capabilities of the platform are actually quite constrained — and I think this explains a lot of the interest in other platforms, such as Ethereum. However, it should be noted that Gavin Andresen has argued that Bitcoin’s limitations need not be a constraint.

So what?

Some might argue that it’s not necessary to think about Bitcoin in this way. But I think that would be a mistake. Because, while lots of people are getting excited about the potential of smart contracts for business, we’ve had a sophisticated smart contract platform running quite successfully for over half a decade, in the form of the Bitcoin network.

Sure — it’s very limited (that’s why systems like Ethereum are getting built). But it might be a mistake to bet that it won’t evolve.

Ultimately, my point is this: even if there’s a low probability of success for a potentially disruptive system, it surely makes sense to understand everything possible about what that system can actually do…

[Disclosure — I provide advice to Hyperledger in a personal capacity.]

Events: “Bitcoin 2015” is happening this fall. Stay tuned.

Jobs, Jobs, Jobs

Abra, San Francisco (VC-Backed)

The 2.0 remittance app that just won the Launch Festival last week is looking for two senior engineering hires. (goabra.com)

-iOS Dev Lead — Min 5 years development experience with at least 3 years on iPhone. Must understand location services, UI programming, and other core iOS servIces.

-If you think you’re a good match or know someone who is, email contact@goabra.com.

Grayscale Investments, New York (a DCG Company)
The manager of the Bitcoin Investment trust, the first publicly traded bitcoin investment vehicle, is making two non-engineering hires. (grayscale.co)

-Account Manager — Min 3 years of demonstrated sales-driven success within the financial industry, preferably in an investor development or capital raising role; Series 7 and 63 licenses certifications. More info here.

-Marketing Manager — Min 4 years of demonstrated success in product marketing, preferably in the financial space; looking for candidates with experience marketing either public or private investment products and/or marketing for asset management businesses. More info here.

Bolt, San Francisco (VC-backed)
The stealth startup focused on consumer applications of Bitcoin is making a number of engineering hires including Security Engineer, Ruby Engineer, and UI/UX Designer.
-Check out Bolt (bolt.com) and email jobs@bolt.com.

Elliptic, London (VC-backed)
-The full-service bitcoin custodian is also making a number of key hires including data scientists and front-end developers.
-Learn more and apply at elliptic.workable.com

Today’s Tid Bits

Interest in Bitcoin Grows on Wall Street
http://blogs.wsj.com/moneybeat/2015/03/29/interest-in-bitcoin-grows-on-wall-street/
Corporate America has begun to make tentative bets on the blockchain-ledger technology behind Bitcoin, as it continues to explore innovative new enterprise uses for digital currencies. The idea is the the blockchain will cut out the intermediating middlemen allowing Wall Street to streamline some of its outdated services. Citigroup Inc., Nadsaq’s OMX Group, USAA Bank, and the New York Stock Exchange have all recently been involved with Bitcoin. Not to mention, leadingfigures from Wall Street and Washington have been taking job offers in the digital-currency sector. Trading instruments are also now becoming more available, most notably, Barry Silbert’sBitcoin Investment Trust, which opened for public trading this week.

Bitcoin’s ‘First Felon’ Charlie Shrem Begins 2-Year Sentence
http://www.coindesk.com/bitcoins-first-felon-charlie-shrem-begins-2-year-sentence/
Charlie Shrem, the 25-year-old bitcoin entrepreneur, begins his stint in prison today, having been sentenced in December to two years for aiding and abetting the operation of an unlicensed money transmitting business. Shrem hopes to only have to serve nine or ten months at the minimum-security facility. Shrem admitted violating anti-money laundering duties by dealing with Robert Faiella, who suppled $1m in bitcoin to people buying drugs on Silk Road. Shrem and Faiella both also agreed to forfeit $950,000 in plea bargains with the US government.

Bitcoin Still Chugging Along in China
http://www.pcworld.com/article/2903632/bitcoin-in-china-still-chugging-along-a-year-after-clampdown.html
A year after China began to tighten regulations around Bitcoin, the digital currency is still being traded in high volumes, despite the declined price. Financial institutions in China are banned from dealing in bitcoins; however, the digital currency is still legal. Giving trading exchanges like BTC China enough room to operate, which leads the bitcoin market in trading volume. Bobby Lee, CEO of BTC China, believes, “Bitcoin is real and it’s here to stay,” although how the digital currency will evolve in China remains uncertain.

Secret Service Agent: Digital Currencies Fueling Cybercrime
http://www.coindesk.com/secret-service-digital-currencies-cybercrime/
US Secret Service (USSS) agent Tate Jarrow suggested that without digital currencies, “cybercrime would be much more difficult.” At the OpRisk North American conference, Jarrow spoke out against bitcoin on the grounds that criminal activity it its most compelling use. In 2014, Jarrow was awarded the Secretary’s Exceptional Service Award, which honors exceptional leadership that improves US homeland security.

Caribbean Bitcoin Exchange Launches Following $1.5 Million Raise
http://www.coindesk.com/caribbean-bitcoin-exchange-launches-following-1-5-million-raise/
Bitt, a Caribbean digital currency exchange, has launched today having secured $1.5m in seed funding from local VC group Avatar Capital. The exchange is based in Barbados and is powered by AlphaPoint, an exchange technology platform provider thats also used by Bitfinex and Cointrader. Bitt also claims to have “military grade security,” with a multi-signature HD wallet system keeping 95% of customers’ bitcoin offline. The exchange will be able to trade in 11 major fiat currencies, including the US dollar, the pound and the euro.

Bitcoin Embassy Amsterdam Founder Booted From Organization, Starts Second Embassy
http://cointelegraph.com/news/113811/bitcoin-embassy-amsterdam-founder-booted-from-organization-starts-second-embassy
Marek Skonieczny, one of the founders of the Bitcoin Embassy Amsterdam, has been suspended from the organization by his two former associates Martijn Wismeijer and Arthur Rommes for lack of financial accountability, his promotion of nonexistent events and undemocratic method of decision-making. After being banned from Amsterdam’s original Bitcoin Embassy, Skonieczny began to plan to establish a new Bitcoin embassy right across the street.

Have a tip or feedback? Email me! (2bitidiot@gmail.com)

Like what you read? Give TwoBitIdiot a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.