Skip to content
Developer Handbook

Protocol reference

Dapp connection reference

On this page

WizardConnect

wiz://?p=<pubkey_bech32>&s=<secret_bech32>
wiz://<host>:<port>?p=<pubkey_bech32>&s=<secret_bech32>&pr=<ws-or-wss>

p encodes a 32-byte x-only Nostr public key. s encodes an 8-byte pairing secret. The default relay is wss://relay.riften.net:443. The documented transport uses Nostr NIP-17 gift wrap.

ActionDirectionFields
dapp_readyDapp → walletsupported_protocols, wallet_discovered, optional selected_protocol, app name and icon.
wallet_readyWallet → dappsupported_protocols, wallet_name, wallet_icon, dapp_discovered, session, public_key and echoed secret.
sign_transaction_requestDapp → wallettransaction is a WC2-BCH signing request. inputPaths contains tuples [inputIndex, pathName, addressIndex]. sequence correlates the response.
sign_transaction_responseWallet → dappsequence, signedTransaction as hex, and optional error. A failed response has empty signed bytes.
sign_cancelDapp → walletThe original sequence and optional reason.
disconnectEitherCourtesy notification before session teardown.

Messages carry action and time in Unix seconds. wallet_ready.session.hdwalletv1.paths contains { name, xpub } entries. receive, change and defi are well-known names. Session extensions may supply more.

WizardConnect protocol · URI and key exchange · Relay transport

WalletConnect for BCH

CAIP-2 chain IDs are bch:bitcoincash for mainnet, bch:bchtest for test networks and bch:bchreg for regtest. A session proposal places requested chains, methods and events under the bch namespace. The documented address-change event is addressesChanged.

MethodParamsResult
bch_getAddresses{}Array of CashAddr strings.
bch_signTransactiontransaction, sourceOutputs, optional broadcast and userPrompt.{ signedTransaction, signedTransactionHash }, both hex strings.
bch_signMessagemessage, optional userPrompt.Base64 signature using the Bitcoin Signed Message format.

transaction can be raw hex or a Libauth transaction representation. Each sourceOutputs entry combines the input outpoint and sequence data with the data for the UTXO being spent and optional contract metadata. The Libauth extended JSON form carries byte arrays and big integers as tagged strings. broadcast defaults to true. The raw request is scoped to the approved topic and chainId.

WC2-BCH specification and types

CashConnect Nostr SDK

bch-cc-v1:<x-only-pubkey-hex>?relay=<urlencoded-relay-url>

The SDK uses Nostr event kind 5001 and defaults to wss://nostr.infra.cash. The proposal’s chain field is a nonempty string. The template determines action names, parameters and result types.

MessageDirectionPayload and result
sessionProposalWallet → dapp{} → proposal with id, dapp, chain, template, allowedTokens, methods and events.
sessionCreateWallet → dapp{ allowedTokens } → {} on successful approval.
getBalances, getTokensDapp → wallet{} → spendable balance or token output records.
executeActionDapp → wallet{ action, params } → data, transactions, utxos.consumed, utxos.emitted, balanceChanges, optional meta.
balancesChanged, sessionDeleteWallet → dapp for balances. Either for deletion.Spendable balance notification or deletion notification with optional reason.

CashConnect Nostr protocol schemas · Template types

XO Stack

XOInvitation carries an invitationIdentifier, templateIdentifier, actionIdentifier, signed commits, and optional action result. Commit records identify contributions to the invitation and can refer to a specific template action. @xo-cash/types defines the data structures.

Engine methodInterface
importTemplateRegisters a template and returns its templateIdentifier.
createInvitation, acceptInvitationCreates or accepts the stored invitation for the action.
listMissingRequirements, appendInvitation, updateInvitationQueries unfilled requirements, adds local contributions or applies a shared revision.
signInvitationSigns the specified input for the invitation identifier.
executeActionTakes an invitation identifier and broadcastTransaction option. Returns builtTransaction and storedInvitation.

Engine API signatures · XOInvitation fields · Sync-client API

CashAccounts v2

Registration and identity NFT

Registration output 0 is a covenant-bound mutable Identity NFT. Its Pay to Script locking bytecode carries the CashCode spending public key. Output 1 is an OP_RETURN carrying the registration identifier 0x01010102 as a four-byte push, then the account name and optional profile fields. The name is 2–32 ASCII letters, digits or underscores.

OffsetBytesNFT commitment field
01Identity NFT version 0x02
11CashCode version 0x01 for mainnet or 0x05 for testnet
21CashCode prefix
333Compressed CashCode scan public key
364CashCode expiry, unsigned big-endian
4032Optional x-only Nostr public key

The display collision hash is the uppercase hex of the first two bytes of SHA256d(blockHash || categoryId), using the hashes decoded from display-order hex. A collision extension appends more lowercase digits from that digest. The stable identity key is (network, categoryId).

CashID challenge and response

Request:  cashid:<host><path>?x=<nonce>[&e=<expiry>]
Response: cashid:<host><path>?x=<nonce>[&e=<expiry>]&d=<category>:<txid>:<vout>

x is a 16-byte random nonce encoded as 32 lowercase hex characters. e is optional Unix time in seconds. An omitted path resolves to /cashid for delivery. Preserve the URI’s exact path and parameter order in the signed string. Both IDs in d are 64-character lowercase display-order hex. The output index is decimal without leading zeros.

The JSON response has request (the complete signed URI), address (the derived P2PKH CashAddr), and signature (the padded Base64 encoding of the raw 64-byte BCH Schnorr signature). The key tweak is SHA256(ASCII("CashID/v2") || spendPublicKey || UTF8(responseUri)), interpreted as an unsigned big-endian integer. The signature covers the URI in the Bitcoin Signed Message format. Verification binds the signature to the currently live Identity NFT outpoint.

The reference indexer exposes GET /resolve?id=<identifier> and POST /verify-cashid. The OpenID Connect bridge issues authorization codes using S256 PKCE and can send signed back-channel logout tokens for affected sessions after confirmed spending-key rotation or burn.

CashAccounts v2 demo · OpenID Connect Core