True Micropayments with Bitcoin

by Shayan Yassami (@syassami), Nigel Drego (@ndrego), Ivan Sergeev (@vsergeev), Tyler Julian (@tylerj), David Harding (@harding), and Balaji S. Srinivasan (@balajis)

Today we’re announcing the release of software and libraries to allow high frequency Bitcoin-based microtransactions between any pair of 21 Bitcoin Computers, without any change to the Bitcoin block size. And soon, you’ll be able to download a free client that makes this work between any pair of devices.

Getting started with Bitcoin micropayments immediately

If you own a 21 Bitcoin Computer, you can start using micropayments in your apps immediately without needing to know too much about the details of the implementation. Just do this at the command line:

# Get the latest version of the 21 client
$ 21 update
# Reboot and start mining
$ sudo reboot
$ 21 mine

Now go through this tutorial and then set up your first app: a grid computer that accepts bitcoin micropayments. If you don’t yet have a 21 Bitcoin Computer, you can get one at or sign up for the forthcoming free client at (bitcoin not included!).

Bitcoin micropayments: as easy as opening a bar tab

How does this technology work? A good analogy is the idea of a bar tab. When you go to a bar, you typically put down a credit card to open a tab, enjoy your food and drinks, and then close out the tab at the end of the night. This means just two “transactions” (opening and closing the tab) even if there were many rounds of food and drink for your party. Reducing the transaction overhead is more convenient for both you and the busy bartender, as you don’t need to pull out your card and they don’t need to pay credit card fees for every pour of every drink.

The same ideas apply to the technology we’ve implemented for Bitcoin micropayments, which is called micropayment channels or payment channels. The tech has a long history in Bitcoin — it was actually originally imagined by Satoshi Nakamoto when he designed two features called nSequence and Locktime, and a variant of it was later implemented by Matt Corallo and several other developers in BitcoinJ. However, the system we’ve created builds on those implementations in a few key ways.

  • Integrated setup of deposit transactions. Every user of the 21 client can quickly mine enough bitcoin for the initial so-called “deposit transaction” to open a micropayments channel, which is the equivalent of opening a tab.
  • One line integration. We’ve built an easy to use micropayments API that allows any Bitcoin Computer to instantly buy or sell digital goods using micropayments channels by adding one line of code.
  • Malleability resistance. As a technical point, we’re using the new CLTV opcode rather than so-called Spillman-style payment channels. This feature eliminates the vulnerability to transaction malleability-related problems.
  • Works on any device. Fourth, as noted above, we will be releasing a free version of the library that allows almost any device (not just a Bitcoin Computer!) to engage in device-to-device micropayments with any other device. You can sign up to download that free client here.

In short, we’ve tried to make micropayment channels even more usable by taking care of all the technical details and allowing you to just build apps. A sample use case is here, where we illustrate grid computing with bitcoin micropayments.

The benefits of Bitcoin micropayments

Why is Bitcoin very interesting for device-to-device micropayments? We have several reasons.

  • >1000X improvement in speed/cost for receiving payments. Any machine or human can create a new Bitcoin address (or set of addresses) for free, instantly, anywhere, to receive bitcoin from any other devices on the internet. By contrast, opening up a bank account requires humans and paperwork, and can take days or weeks. Going from costly to zero cost, or from days to seconds is not a 10X improvement — it’s much more than that! This alone argues for Bitcoin as being uniquely suited for machine-to-machine transactions.
As outlined in this tutorial (source code here), the 21 Bitcoin library makes sub-satoshi billing possible.
  • Extremely fine-grained realtime billing. Micropayment channels allow a merchant to bill a customer in sub-satoshi increments over the course of many transactions. To put that in context, at a price of $400/BTC, one satoshi is .0004 cents — and you can bill for machine time in increments even less than that. For example, as shown in the grid computing example, the merchant is billing .02 satoshis per byte read or written. That is .00008 cents per action! In practice, the final settlement (as opposed to billing) does require rounding up to 1 satoshi increments, but this is still an enormous improvement in billing granularity and potentially very useful for cloud and grid computing.
  • Reduces the need for trust. Neither the merchant nor the customer needs much trust in the other person or any third-party, as the same cryptography used to secure regular Bitcoin transactions is used to secure the micropayment channel. Losses in low-trust situations are bounded and quantifiable; the worst a merchant server can do to a client using micropayment channels is to abscond with an initial transaction of 3000 satoshis without delivering a digital good. If compared to the much larger losses that can be incurred by trusting an insecure merchant server with credit card details, this is a step forward. Put another way: while pre-existing trust reduces transaction costs, establishing trust costs time — which is itself a form of transaction cost. This is particularly important for machine-to-machine payments, as machines may not have the time or data to establish the trustworthiness of another machine.
  • Does not require signup. One of the implicit aspects of our design is that we have replaced the standard process of signing up for an API with a signup-less Bitcoin wallet. Specifically, for a given machine-to-machine transaction one can think of the public address as the login, the private key as the password, and the address balance as the credit card. The use of the payment.required decorator combines all three of these items in this fashion. As with low-trust transactions, this feature reduces the fixed costs of a machine-to-machine transaction by eliminating the signup cost.

In short: with our micropayments technology any pair of devices can now use the Bitcoin network to exchange things of value, in extremely fine-grained increments, with bounded losses due to trust, without any signup or registration process.

The limitations of Bitcoin micropayments

Now, there are of course limitations of Bitcoin micropayment channels! Let’s discuss these in turn.

  • The channel setup cost. Perhaps the key limit as of early 2016 is that the minimum cost to open or close a channel depends on both the mining transaction fees (call them T) and the minimum output size of 3000 satoshis (the so-called dust limit). The combined open/transaction/close cost minimum for a micropayments channel is thus 2T + 3000 satoshis, which is at least 1.2 cents at $400/BTC assuming T=0 and fast 0-fee confirmations which don’t currently exist. More realistically, if a channel needs to be opened or closed rapidly, T can be on the order of 10000 satoshis, which would mean a cost of more like 23000 satoshis or 9.2 cents at $400/BTC. For this to be useful between two machines the total commerce value exchanged over the lifetime of the channel would have to be on the order of 10X the channel setup cost — which means on the order of $1 given today’s transaction fees. This is not unreasonable for many applications, but reducing the channel setup cost by several orders of magnitude via various techniques (such as the long-running channels described in the Lightning Network spec) is an important next step for making machine-to-machine payments even easier.
  • The number of channels opened per day. An important aspect of micropayment channels is that they use the Bitcoin protocol but limit the amount of data written to the capacity-constrained Bitcoin Blockchain by using only two transactions per channel (open and close) rather than thousands for each individual customer/merchant interaction. With that said, as the number of devices using micropayments rises, more channels will be opened per day. At a certain point, complementary scaling solutions may need to be found — such as a hub-and-spoke model that would allow for each device to establish one channel to a hub and then exchange with all other devices connected to that hub or interoperable hubs, or the highly anticipated Lightning Network (for which payment channels are a building block and hubs aren’t needed). This is an important direction for longer term work.

On balance, we believe that micropayment channels solve an important piece of the bitcoin scalability puzzle and hope that you’ll find our implementation useful. Again, you can get started using micropayment channels now if you purchase a Bitcoin Computer at, or you can sign up for the free client (bitcoin not included!) at!