Counterparty Development Update #11: Separating counterpartyd, Improved Dependency Management & More

January 16, 2015

This week we made significant progress in terms of code refactoring, testing and dependency management. We implemented changes in our code in order to separate the responsibilities and decrease dependencies of our components. The first change we made was to separate the server and client functions and move all commands to counterparty-cli, followed by separating blockchain explorer and wallet dependencies. Please note, however, that these changes are still in develop and are planned to be released in a non-mandatory upgrade v9.49.5.
Below we explain each change in detail.

Separating counterpartyd

counterpartyd repository has been divided into two parts: counterparty-lib and counterparty-cli.

The main characteristics of counterparty-lib are:

  • it is a “pure” Python library and doesn’t contain any command line scripts
  • it can be installed/upgraded with a simple pip install counterparty-lib
  • it doesn’t need or manage a wallet but only a block explorer, which is why, in the API, the pubkey parameter is now mandatory if not present in the blockchain
  • it doesn’t need or manage user configuration file

counterparty-cli contains 2 command line scripts:

  • replaces and uses its own configuration file (~/.config/counterparty-server/counterparty-server.conf). The configuration file must contain parameters to connect to the block explorer (addrindex backend), and parameters to serve the RPC API.
  • replaces and uses its own configuration file (~/.config/counterparty-client/counterparty-client.conf). The configuration file must contain parameters to connect to the counterparty-server and parameters to connect to the wallet (Bitcoin Core for now).

For an example of the two configuration files see the README in counterparty-cli repository.

counterparty-cli can also be installed via a simple pip install counterparty-cli. The install script installs counterparty-lib and all other dependencies, and adds the two command line scripts to the PATH.

counterparty-cli can be compiled as .exe for Windows with pyton py2exe. Binaries will be available for download on Github and in a near future as a msi installer.

More information about this change is available here: Important informations about version 9.49.4

Separating Blockchain Explorer and Wallet Dependencies has been split into two components: Here are the changes made:

    • counterparty-server has only one dependency: a blockchain explorer (BACKEND_* in`)
    • now manages only these actions: server, reparse, rollback andkickstart
    • backend parameters have been renamed: BACKENDRPC are replaced by BACKEND
      support of parameters `bitcoind_rpc
      ` in the configuration file has been removed
    • jmcorgan is replaced by addrindex
    • support of Insight, Blockr and SoChain has been removed
    • counterparty-client has two dependencies: a counterparty-server and a wallet.
    • it is completely independent of the lib folder.
    • It has its own configuration file (~/.config/counterparty-client/counterparty-client.conf) and doesn’t use a database
    • Only Bitcoin Core wallet is supported for now, but a wrapper for another wallet can easily be added in the client/wallet folder.
    • requests library is always used to make RPC calls

Changes and Fixes Across our Repositories


  • Moved CLIs to counterparty-cli repository
  • Added counterparty-lib python package:
    • moved python file in subfolder counterparty
    • removed pip-requirement.txt
    • added
    • moved in counterparty folder
    • updated
  • Included apsw and serpent installation in
  • Fixed the error with counterpartyd resetting continuously on a data-overflow error (testnet) #615
  • Implemented dropping Contracts table after other related tables
  • Implemented more detailed exceptions in
  • Added new unit tests
  • Added specific arguments for all functions, updated docstring documentation in util.pyand
  • Fixed the bug with get_running_info
  • Fixed executions status when contract execution fails: In XCP holders calculation, includedgas_remained and gas_cost for executions with status equal to out of gas
  • Removed forcing Non‐Callability for reissuances: Re‐issuances should use old callability,call_date, call_price values.
  • Fixed bug with bet transactions accepted from addresses with 0 XCP balance #612
  • Fixed excessive logging problem #621block_index should be passed to log.message() to detect mempool transactions
  • Fixed bug with Bitcoin Core 0.10.0 – wait on “Verifying blocks…”? #585
  • Fixed the bug with AttributeError: 'module' object has no attribute 'handlers' error
  • Renamed counterparty folder to counterpartylib


  • Prevented CPU maxing out if cpd/cbd have crashing issues
  • Implemented build using BTCdrac bitcoind 0.10

That covers our development updates for this week. If you have any questions regarding recent or upcoming changes you can contact us via our support channel, forum or github.

In order to stay up to date with our progress subscribe to our newsletter at the bottom of this page and receive weekly updates via email.