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:

counterparty-server.py replaces counterpartyd.py 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 ( ). The configuration file must contain parameters to connect to the block explorer ( backend), and parameters to serve the RPC API. counterparty-client.py replaces counterparty-cli.py 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 setup.py 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

counterpartyd.py has been split into two components: counterparty-server.py and counterparty-client.py . Here are the changes made:

counterparty-server.py counterparty-server has only one dependency: a blockchain explorer ( BACKEND_* in the config.py`) counteparty-server.py now manages only these actions: server , reparse , rollback and kickstart backend parameters have been renamed: BACKENDRPC are replaced by BACKEND

support of parameters `bitcoind_rpc` in the configuration file has been removed BLOCKCHAIN_SERVICE_NAME is replaced by BACKEND_NAME jmcorgan is replaced by addrindex support of Insight, Blockr and SoChain has been removed

counterparty-client.py 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

counterpartyd

Moved CLIs to counterparty-cli repository

repository Added counterparty-lib python package: moved python file in subfolder counterparty removed pip-requirement.txt added setup.py moved server.py in counterparty folder updated README.md

python package: Included apsw and serpent installation in setup.py

and installation in Fixed the error with counterpartyd resetting continuously on a data-overflow error (testnet) #615

resetting continuously on a data-overflow error (testnet) #615 Implemented dropping Contracts table after other related tables

Implemented more detailed exceptions in util.py

Added new unit tests

Added specific arguments for all unit.py functions, updated docstring documentation in util.py and script.py

functions, updated docstring documentation in and Fixed the bug with get_running_info

Fixed executions status when contract execution fails: In XCP holders calculation, included gas_remained and gas_cost for executions with status equal to out of gas

status when contract execution fails: In XCP holders calculation, included and for executions with status equal to Removed forcing Non‐Callability for reissuances: Re‐issuances should use old callability , call_date , call_price values.

, , values. Fixed bug with bet transactions accepted from addresses with 0 XCP balance #612

Fixed excessive logging problem #621 – block_index should be passed to log.message() to detect mempool transactions

should be passed to 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

error Renamed counterparty folder to counterpartylib

counterpartyd_build

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.