Nexa Counterparty and Protocol Discovery (CAPD)

Counterparty discovery is currently a barrier to using many crypto-financial protocols in a trustless, anonymous, peer-to-peer manner. Unlike the entry of a long-running node into a peer-to-peer network, these protocols are often short-lived and require selective discovery. In this context, selective discovery refers to the need to find a partner that fits very specific criteria rather than any member of a broad group. Because many crypto-financial protocols operate for only a short time, the discovery phase becomes a critical but often unspecified part of the user experience. Coin mixing, atomic cross-chain swaps, and any form of trade or bet are examples of short-duration interactions that would benefit from a counterparty discovery service. Likewise, any type of service discovery (e.g., finding a server supporting a particular feature) can also benefit, since service discovery is simply counterparty discovery with broader criteria.

Decentralized Exchanges

CAPD is the protocol that enables an open-outcry communication style on Nexa. CAPD is a generic, broadcast-only (no direct one-to-one messaging), best-effort communication system built into Nexa full nodes. A node can broadcast a message, and it will be forwarded, on a best-effort basis with no guarantees, to every other full node, where it will be stored locally for a limited time before being removed. Anyone can broadcast nearly any type of message using CAPD.

Counterparty discovery mechanisms are part of decentralized exchanges. Research on these mechanisms has largely taken place within the Ethereum ecosystem. These solutions are usually designed specifically for exchanging tokens (typically ERC-20) on Ethereum and operate as part of a larger framework that completes a decentralized exchange. This specialization makes them unsuitable or awkward for general-purpose counterparty discovery.

A decentralized exchange can broadcast trade offers through CAPD that include partial transactions in a known format (similar to PSBTs on Bitcoin circa 2017). Anyone listening on the network can complete the transaction and submit it to finalize the trade. CAPD messages are not recorded on the blockchain. If you are offline when a message is broadcast, you will not receive it later when your node synchronizes. You may request CAPD messages from your peers, but there is no guarantee they have retained all of them. To prevent trade offers from being lost, a trader-indexer server can listen for CAPD messages and provide an external list of available offers.

Payments

The initial version of this protocol assumes the service is free. However, most intended uses eventually lead to transactions on the Nexa network, meaning this “free” service indirectly generates more transaction fees and increases overall usage and adoption of the Nexa cryptocurrency. Therefore, it is reasonable to expect that miners and NEXA holders will continue offering this service without cost for some time.

A micropayment mechanism could be added later to pay for certain features of the protocol, especially the filtering services provided through the Query and QueryNotify messages.

If CAPD becomes widely used, the proof-of-work required for message submission may exceed the capability of some clients. In this case, clients could outsource the work, either through micropayment channels or a trust-based arrangement (e.g., prepaying for a set number of “solves”). Paying one on-chain transaction per solved message would defeat the purpose of CAPD’s pooled messaging system unless the messages are extremely large.

Persistent Messages

This initial version of CAPD is designed as a communication layer for active agents — connecting parties that want to interact immediately. However, it can be extended into a persistent message system where messages are stored for longer durations.

In the extended model, wallets open a payment channel to one or more full nodes and send micropayments along with desired retention duration and filter parameters. While the service could be free, this opens the door to storage-exhaustion attacks, where wallets request storage from every node. To prevent this, wallets may need to provide some minimal proof of effort or identity. Full nodes store all matching messages until the wallet retrieves them or the retention period expires. Full nodes could drop or hide messages, but wallets can subscribe to multiple nodes, making the system function like email with best-effort delivery.

While CAPD is initially focused on real-time communication, optional future upgrades could introduce stronger delivery guarantees, paid retention, or more advanced message commitment techniques. These extensions are not required for CAPD’s core functionality but can expand its usefulness for applications that need longer-term storage or verifiable delivery.

To Sum Up

Nexa Counterparty and Protocol Discovery (CAPD) is a powerful foundation for building and interacting with decentralized services, exchanges, and other protocols. The potential applications are extensive, including decentralized exchanges, messaging systems, and the communication layers required for distributed applications. By enabling trustless and anonymous counterparty discovery, CAPD opens the door to broader innovation across the Nexa ecosystem.

1 Like