Skip to content

Instantly share code, notes, and snippets.

Last active February 28, 2018 16:02
Show Gist options
  • Save F483/4dcce77814bdee40c121fdeffe1a7664 to your computer and use it in GitHub Desktop.
Save F483/4dcce77814bdee40c121fdeffe1a7664 to your computer and use it in GitHub Desktop.
Counterparty picopayments overwiew

Counterparty picopayments overwiew

Stack overview

| picopayments-hub     | picopayments-cli     |
| counterparty-lib                            |
| micropayment-core                           |
| Documentation / Spec                        |

Documentation / Spec

The Protocol documentation as well as the documentation for the added API Calls have been added to the counterparty documentation project, see Pull Request. All micropayment channel api calls start with mpc_*.


This project mostly contains the code for signing and parsing P2SH scripts/transactions, as well as some utility functions. It is mainly isolated here so that clients can do all required signing/validation without needing all the counterparty-lib dependencies.

The code is very well tested/documented and stable. I do not expect to have to make many changes. It relies heavily on pycoin internals and it may be worth moving this code upstream into pycoin if they agree.

Known Issues

  • Pycoin is a bit noisy during signing, so it captures std/err output duing signing.
  • When signing it requires loading the input transactions, can this be avoided?

These are all non critical / shippable and should all be relsoved upstream in pycoin?


All protocol code and api calls for creating, transferring, closing and recovering micropayment channels funds resides here. It is NOT responsible for signing (which happens by the channel users) or messaging commits/revokes between users (this happens out of band). At no point does the user give keys to the counterparty-lib api or loose control of funds in any way.

Currently only counterparty assets may be sent in the payment channel. Using btc will be possible in the future, but is currently not implemented to reduce complexity as it would require special casing and more complex fee management.


The hub is the main liquidity provider and transfers funds between clients. It provides all services via JSON-RPC and all interactions are single atomic calls. See the picopayments-hub project.


A reference client implementation, with command line interface. See the picopayments-cli project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment