Towards a Smart Contracts Ecosystem

I see smart contracts as one of the most promising features of Bitcoin. Satoshi gave us programmable money, and it’s time to start exploring its possibilities. My friend & cofounder Manuel Aráoz recently wrote a really good introduction to smart contracts on Bitcoin.

In this post I’ll give an overview of projects that are doing some very exciting things in this area. I’ll also share an idea I think could move us faster towards a more dynamic and safe future of money based on smart contracts.

Payment Channels in the Wild

Payment channels allow instantaneous and secure transfer of bitcoins off-chain. A payment channel can also aggregate multiple transactions in just two, saving miner fees. They allow for really small payments, and are particularly suited for metered services.

Streamium was the first live webapp using payment channels. It’s a peer-to-peer video streaming application where you pay for each second of video streamed. There are some other private beta applications out there: the ones that I’d love to see launch are JoyStream (pay for torrent bandwidth), BitMesh (pay for wi-fi access), and StrawPay (a simple way to make micropayments).

If you’re a developer, let me point out at two libraries that I know of for building payment channel systems. The first is the bitcoinj library, that has implemented payment channels back in 2013, and has a very comprehensive tutorial on how to use it. The other one is the bitcore-channel JavaScript library, that allows browsers to participate in payment channels.

More than Payment Channels

There are two projects based on smart contracts that have me extremely excited. Both are relatively new and in early stage of development, but they have a lot of potential.

A group of researchers from MIT recently published a breakthrough in secure computation: Enigma. They created a platform that allows a network of computers to execute a program that takes encrypted data and outputs encrypted results. Their system makes use of the bitcoin blockchain for security deposits, another smart contract. It’s solving a fundamental issue with cloud computing: you can’t trust it with highly sensitive data. Systems get hacked all the time: this past few months alone Snapchat, iCloud, and AshleyMadison (to name a few) have been compromised with sensitive information leaked.

Another project, called Lightning Network, looks very promising. It’s a system to send payments in a secure way that doesn’t spam the blockchain, through a network of peers connected with an advanced variation of payment channels. They solved a big problem of the Blockchain: it’s a highly inefficient payment network that can’t process multiple transactions per second. VISA has processed a peak of 45 thousand payments per second a couple of years ago, while Bitcoin can only process ~3 per second. The Lightning Network can handle an extremely large number of transactions, and it does so while keeping the security of the blockchain.

Incremental Steps

I think there’s room for a few small applications that can create and grow smart contracts ecosystem: a series of bots, agents, and web services that provide reliable and secure services. These systems should follow the Unix philosophy: be composable and just do one thing, but do it right. Being open source so anyone is able to run one of these systems at a low cost is another desirable property.

Examples (not necessarily open source) of this already exist, sometimes as part of something larger: JoinMarket, an open protocol to establish CoinJoin transactions; WebHooks when you receive a transaction (like BlockCypher’s or’s); shared key solutions (like BitGo, or Third Party Solutions), and PayPub, the proof of concept behind DarkLeaks.

I’ve been playing around in my head with the idea of implementing a service that stores time-locked transactions and broadcasts them when they become valid. This frees up browsers, applications, and wallets from having to store transactions and needing to be online at some point in the future to send them (this is needed by payment channels and security deposits). It would be useful for both the Lightning Network and Enigma; and of course, Streamium and any app that uses payment channels today.

I actually designed and coded most of it, and named it RelayStore. As an experiment, I’m starting my first crowd-sourcing campaign on Lighthouse (a decentralised version of KickStarter, based on smart contracts). It’s designed to be very robust and require low maintenance, and earn you some bucks. If I reach the 10 BTC goal, I’ll release it as open source so everyone is free to run an instance. You can pledge here!

Liked this post? Let’s talk on twitter.