Counterparty Development 101
Counterparty is NOT a blockchain.
What is Counterparty?
Counterparty is a protocol and network of nodes that reads and writes data to the Bitcoin blockchain using bitcoin txs and a standardized message format. Off-chain, Counterparty nodes validate this embedded data and compute the current state of the network, with each new block.
Counterparty nodes maintain identical ledgers without using a P2P network specific to Counterparty because they are running the same Counterparty software to enforce protocol rules and piggy-backing on Bitcoin’s Proof-of-Work for tx ordering and propogation. This is known as embedded consensus.
A Federated Counterparty Node is a Bitcoin Full Node that uses AddrIndex and runs counterparty-lib software. Counterparty is coded primarily in Python using a SQLite database. Counterparty tracks balances using bitcoin addresses as “accounts” and credits and debits account balances when executing valid protocol messages.
Counterparty Node Operators have two interface options: CLI and API. The CLI and JSON-RPC API are both well documented. And it’s not necessary to know Python to interface with either of these options.
You can think of each Counterparty message as a standardized input to a hard-coded smart contract which differentiates Counterparty from other platforms, like Ethereum, where users write their own smart contract code. Rather than users rolling their own code and using different approaches for common actions, Counterparty standardizes common actions as features.
Counterparty can be upgraded to include new smart contracts, if they gain enough consensus and are deemed to be an improvement through the CIP process. This usually requires a hard-forking upgrade where every node must upgrade to the new software version to maintain the same network state.
The easiest way to get started is to read the API documentation and play around with the Public Development API hosted by Coindaddy.io (link below). The counterparty-lib code is also extremely readable with each smart contract having a standard format: database schema, validation, parsing, etc.
Here are two videos from two of the Founders of Counterparty that give both a conceptual and a technical overview of the project.
Reference Implementation: https://github.com/CounterpartyXCP/counterparty-lib
Setup a Federated Node:
Public Federated Node API:
Counterparty Explorer (Mainnet):
Counterparty Explorer (Testnet):
How to Start: