Skip to content
Developer Handbook

Blockchain, P2P and zero-conf

On this page

When you broadcast the signed payment, nodes pass it to each other over the peer-to-peer (P2P) network. A miner can then include it in a block.

Discover peers and open a P2P connection

  1. A node learns peer addresses from its saved peers, DNS seeds, address relay, or explicit configuration. Use the Bitcoin Cash mainnet parameters.
  2. Connect over TCP and exchange version messages. These carry the protocol version and service flags, among other fields. Each side acknowledges with verack.
  3. Every message starts with a network identifier, called network magic, followed by the command, payload length, and payload checksum. Once the handshake is complete, peers can exchange headers, blocks, and transaction inventory.

P2P message formats

Relay, mempools and zero confirmations

A wallet can send raw bytes to a node or to a relay endpoint. A node checks the transaction against the active chain, its relay rules, and the mempool, where it keeps accepted transactions that are waiting for a block. In ordinary P2P relay, a peer advertises an item with inv, an interested peer requests it with getdata, and the sender returns a tx message for a transaction.

A wallet can show a payment in its node’s mempool as pending, with zero confirmations. Other nodes may never see it, may evict it, or may accept a different transaction spending the same outpoint.

A Double Spend Proof can provide evidence of certain conflicts. When supported by the wallet's data source, watch for proofs for unconfirmed incoming payments. The absence of a proof cannot establish that no conflicting spend exists. Mempool reference · Double Spend Proof specification

Blocks, confirmations and reorgs

Miners can include transactions from their mempools in blocks. A block header commits to the previous header hash and to its transactions through a Merkle root, one hash derived from their transaction IDs. Nodes verify proof of work, transaction validity, and the other block rules. They follow the valid chain with the most accumulated work. Peers learn about competing blocks from headers and announcements, then request the data they need to validate them.

The first transaction in a block is the coinbase. It lets the miner claim newly issued BCH, called the block subsidy, and the fees from the other transactions, including the 300 sats from our payment. Once the block containing the payment becomes part of the active chain, the payment has one confirmation. Each block on top adds one. A stronger chain can replace one or more blocks in a reorganization. If the payment's block is removed, the wallet reconciles its state. The payment may already be included on the new branch, return to the mempool, or conflict with a spend in the new chain.

Block reference · Proof of work

Try broadcast and confirmation on Mocknet

Open the Transaction Lab in Mocknet mode. Broadcast the 50,000-sat payment and open the explorer to see it in the mempool. Select Mine a block and check that the same transaction now has one confirmation and that its funding UTXO has been spent.

Where applications connect

Use Fulcrum for indexed wallet queries and notifications. Use full-node RPC for local verification and operations. Use P2P when your software needs to exchange data directly with peers. The infrastructure guide shows where to run each service.