Counterparty Core is the reference implementation of the Counterparty Protocol.
The simplest way to get your Counterparty node up and running is to use Docker Compose.
sudo apt install docker-compose
Then, for mainnet
, run:
docker-compose -f simplenode/compose.yml up
For testnet
, modify the Docker Compose file in simplenode/
and then run:
docker-compose -f simplenode/compose.yml -p simplenode-testnet up
Then wait for your node to catch up with the network. Note: this process currently takes a long time, beause it does not make use of the bootstrap
or kickstart
functionality. (See below.)
Counterparty Core can be installed on most platforms but, for now, manual installation is being tested and is only officially supported on Ubuntu 22.04 and MacOS.
Dependencies:
- Bitcoin Core
- AddrIndexRS
- Python >= 3.10
- Rust
- Maturin
- LevelDB
Download the latest Bitcoin Core and create
a bitcoin.conf
file (by default located in ~.bitcoin/
) with the following options:
rpcuser=rpc
rpcpassword=rpc
server=1
addresstype=legacy
txindex=1
prune=0
mempoolfullrbf=1
rpcworkqueue=100
Adding the following lines, and opening up port 8333
to incoming traffic, may improve your sync speed:
listen=1
dbcache=4000
The recommended way to install Rust is to use rustup
:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source "$HOME/.cargo/env"
See https://www.rust-lang.org/tools/install for more information.
Download and install the latest AddrIndexRS:
git clone https://github.com/CounterpartyXCP/addrindexrs.git
cd addrindexrs
cargo install --path=.
Start addrindexrs
with:
addrindexrs --cookie=rpc:rpc -vvv
When working with a remote full node or low-memory system, you can tell addrindexrs
to use JSON-RPC to communicate with bitcoind
using the flag --jsonrpc-import
.
You can also limit the resources available for addrindexrs
with:
ulimit -n 8192
Use addrindexrs -h
for more options.
On Ubuntu 22.04 and similar:
apt-get install -y python3 python3-dev python3-pip
pip3 install maturin
On MacOS:
brew install python
pip3 install maturin
See https://brew.sh/ to install Homewrew.
On Ubuntu 22.04 and similar:
apt-get install -y libleveldb-dev
On MacOS:
brew install leveldb
Download the latest version counterparty-core
:
git clone https://github.com/CounterpartyXCP/counterparty-core.git
Install the counterparty-rs
library:
cd counterparty-core/counterparty-rs
pip3 install .
Install the counterparty-lib
library:
cd counterparty-core/counterparty-lib
pip3 install .
Install the counterparty-cli
library:
cd counterparty-core/counterparty-cli
pip3 install .
Note for MacOS users
Use this command if you get an error while installing one of the packages:
CFLAGS="-I/opt/homebrew/include -L/opt/homebrew/lib"
Manual configuration is not necessary for most use cases, but example configuration files may be found in the docker/
directory.
By default, the configuration files are named server.conf
and client.conf
and are located in the following directories:
- Linux:
~/.config/counterparty/
- Windows:
%APPDATA%\Counterparty\
Client and server log files are named counterparty.client.[testnet.]log
and counterparty.server.[testnet.]log
and are located in the following directories:
- Linux:
~/.cache/counterparty/log/
- Windows:
%APPDATA%\Local\Counterparty\counterparty\Logs
Counterparty API activity is logged to server.[testnet.]api.log
and client.[testnet.]api.log
.
Counterparty database files are by default named counterparty.[testnet.]db
and are located in the following directories:
- Linux:
~/.local/share/counterparty
- Windows:
%APPDATA%\Roaming\Counterparty\counterparty
All configurable parameters in the configuration file can also be passed as arguments to the counterpart-server
command. Use counterparty-server --help
to see the list of these options.
You will not be able to run counterparty-server
until addrindexrs
has caught up (and its RPC server is running), which in turn requires bitcoind
have caught up as well. The command to start the Counterparty server process is simply counterparty-server start
. However, simply running this command requires a long time to catch up with the network, and Counterparty must have parsed all published blocks before being operational.
There are two ways to speed up the process of catching up with the network:
counterparty-server bootstrap
downloads a recent snapshot of a Counterparty database from a centralized server maintained by the Counterparty Core development team. Because this method does not involve verifying the history of Counterparty transactions yourself, thebootstrap
command should not be used for mission-critical, commercial or public-facing nodes.
counterparty-server bootstrap
counterparty-server kickstart
will perform a complete catchup in around 8 to 24 hours. However, this method requires first stopping Bitcoin Core (while leavingaddrindexrs
running, so that Counterparty Core can read the Bitcoin block files directly frombitcoind
's database.
counterparty-server kickstart
Once the Counterparty server has caught up with the network, you may start the server simply with counterparty start
:
counterparty-server start