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.pyreplacescounterpartyd.pyand uses its own configuration file (~/.config/counterparty-server/counterparty-server.conf). The configuration file must contain parameters to connect to the block explorer (addrindexbackend), and parameters to serve the RPC API.counterparty-client.pyreplacescounterparty-cli.pyand uses its own configuration file (~/.config/counterparty-client/counterparty-client.conf). The configuration file must contain parameters to connect to thecounterparty-serverand 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 andcounterparty-client.py. Here are the changes made:
counterparty-server.pycounterparty-serverhas only one dependency: a blockchain explorer (BACKEND_* in theconfig.py`)counteparty-server.pynow manages only these actions:server,reparse,rollbackandkickstart- backend parameters have been renamed: BACKENDRPC are replaced by BACKEND
support of parameters `bitcoind_rpc` in the configuration file has been removed BLOCKCHAIN_SERVICE_NAMEis replaced byBACKEND_NAMEjmcorganis replaced byaddrindex- support of Insight, Blockr and SoChain has been removed
counterparty-client.pycounterparty-clienthas two dependencies: acounterparty-serverand a wallet.- it is completely independent of the
libfolder. - 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/walletfolder. requestslibrary is always used to make RPC calls
Changes and Fixes Across our Repositories
counterpartyd
- Moved CLIs to
counterparty-clirepository - Added
counterparty-libpython package:- moved python file in subfolder
counterparty - removed
pip-requirement.txt - added
setup.py - moved
server.pyincounterpartyfolder - updated README.md
- moved python file in subfolder
- Included
apswandserpentinstallation insetup.py - Fixed the error with
counterpartydresetting 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.pyfunctions, updated docstring documentation inutil.pyandscript.py - Fixed the bug with
get_running_info - Fixed
executionsstatus when contract execution fails: In XCP holders calculation, includedgas_remainedandgas_costfor executions with status equal toout of gas - Removed forcing Non‐Callability for reissuances: Re‐issuances should use old
callability,call_date,call_pricevalues. - Fixed bug with bet transactions accepted from addresses with 0 XCP balance #612
- Fixed excessive logging problem #621 –
block_indexshould be passed tolog.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
counterpartyfolder tocounterpartylib
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.
