Counterparty Client (testnet) on Raspbian

This will work only on Rasberry Pi Model B or better with external USB Drive and 1GB or larger swap file.

It is much better to use a public bitcoin server on testnet or an instance that is running someplace else on your home network (it can be a “shared” instance, but it must be patched to support addrindex). In case bitcoind doesn’t run on Raspberry, any model will do as counterparty-client doesn’t need much resources.

Install Bitcoin Core from btcdrak

This patched Bitcoin Core contains addrindex patch required by Counterparty. Get the latest source (currently 0.11.1):

wget https://github.com/btcdrak/bitcoin/releases/download/v0.11.1-addrindex/bitcoin-0.11.1-addrindex.tar.gz
tar xfvz bitcoin-0.11.1-addrindex.tar.gz

Now descend to this directory and build according to the official docs for Unix (or google for better how-to’s). Pay special attention to dependencies at the bottom of this page. There are no deterministically built binaries for Raspbian so Bitcoin Core with addrindex patch must be built from source.

Configure bitcoind to run on testnet. Details can be found here.

Install counterparty-client

sudo pip3 install counterparty-cli

Optionally install the server (counterparty-lib) as well. Here we’ll be using a public Counterparty server to save system resources so we’ll skip this step.

Configure counterparty-cli

Go to home directory of user who will run Counterparty client and edit client.conf:
nano .config/counterparty-client/client.conf

(Note: if you use counterparty-cli on mainnet and testnet you may have a client.conf and client.testnet.conf, but in our case we only have one config file which is named client.conf.)

We’ll be using a public Counterparty testnet server located at http://coindaddy.io and our configuration file looks like this:

[Default]
counterparty-rpc-connect = public.coindaddy.io
counterparty-rpc-port = 14000
counterparty-rpc-user = rpc
counterparty-rpc-password = 1234
testnet = 1
wallet-name = bitcoincore # Bitcoin Core (and not btcd, for example)
wallet-connect = localhost # assuming Bitcoin Core is installed on the same system
wallet-user = rpc # use value that matches rpcuser in bitcoin.conf for testnet
wallet-password = 1234 # same as rpcpassword in bitcoin.conf (testnet)

Note: remove all comments (# and what follows after it) from sample configuration file above and leave [Default] in.

Documentation for counterparty-cli can be found here.

Start bitcoin on testnet and test counterparty-client

  • Start bitcoind on testnet and let it catch up with the network (on Raspberry it may take days; before you start bitcoind you can copy blockchain’s *.dat files from another place, and then start bitcoind once with --reindex, which can save you a few hours)
  • Issue a test command using bitcoin-cli (refer to bitcoin documentation) to make sure bitcoin core is working properly and allowing RPC requests
  • Test counterparty-client with something like counterparty-client getinfo (this works independently of Bitcoin Core, but counterparty client’s wallet-related commands cannot)

Example

In this example we pass all settings to the client using the CLI (no need for config file; you could create a shell wrapper for this, or edit your client.conf as explained above). Remember that you need testnet=1 in the file or --testnet in your commands if you’re accessing a testnet instance.

counterparty-client --testnet --counterparty-rpc-connect public.coindaddy.io --counterparty-rpc-port 14000 --counterparty-rpc-user rpc --counterparty-rpc-password 1234 getinfo

[INFO] Running v1.1.1 of counterparty-client.←[0m
{
    "bitcoin_block_count": 487717,
    "db_caught_up": true,
    "last_block": {
        "block_hash": "00000000824499e7e47a1e61a42b186b99f425991812e058b53272caa1990608",
        "block_index": 487717,
        "block_time": 1436016167,
        "difficulty": 1,
        "ledger_hash": "98108db5c2fdd179669e2a85dde374b1934d8f0993279b7246efad25738b3a7a",
        "previous_block_hash": "000000007841a2ce4778e43d6393cdb0dcf6049e3d9aaf9521b0a70918d92d0e",
        "txlist_hash": "ba27fbe500612bbaad2a8a07a1469f1d55444647eed316e8fae84242301e2cae"
    },
    "last_message_index": 11922,
    "running_testcoin": false,
    "running_testnet": true,
    "version_major": 9,
    "version_minor": 51,
    "version_revision": 3
}

Notes

  • It is much more convenient to run counterparty-client on testnet using a public bitcoin server.
  • Developers who use Counterparty API do not need to install counterparty-cli. Coindaddy has several examples of how to use Python, PHP and curl to access their public development server.
  • For the lazy, a binary Bitcoin Core 0.11.1 with addrindex package for Raspbian can be found here, but you should build your own.

Changelog

  • Nov 3, 2015: updated with Bitcoin Core v0.11.1 information