Skip to content
Developer Handbook

Dapp connection protocols

CashAccounts v2

On this page

CashAccounts v2 gives applications an on-chain identity for a display name, payment resolution and sign-in. Each identity is anchored to a CashTokens Identity NFT. The current live NFT output determines which keys control it. An optional Nostr key can be associated with the identity.

Resolve the account

  1. Ask a resolver on the selected BCH network to resolve a v2 name or category ID. A confirmed name can take the form Amber#3F2A with extra collision digits when needed.
  2. Use the network and Identity NFT category as the application’s stable identity key. The name and collision hash help people choose an identity. A pending registration acquires its final collision hash after it confirms.
  3. For payments, ask the wallet to use the resolved CashCode. For sign-in, issue a fresh CashID challenge bound to the browser session.

Integrate sign-in through OpenID Connect

An OpenID Connect (OIDC) bridge turns a wallet’s signed CashID proof into a web sign-in. The bridge verifies control of the current Identity NFT and acts as the application’s issuer. Register the app and its exact redirect URI with the issuer. Discover its endpoints through the issuer’s /.well-known/openid-configuration document.

  1. Start an authorization-code flow with the openid scope and S256 PKCE. Keep the state, nonce and verifier bound to the pending sign-in session.
  2. The bridge presents a CashID request. The wallet shows the requesting service, lets the user pick an identity and signs the request. The bridge verifies that proof and asks the browser to confirm the verified account.
  3. At the callback, match state, exchange the code with the PKCE verifier and validate the ID token using the configured issuer’s keys. Check issuer, audience, expiry and nonce before starting the application session.

Key the local user by (iss, sub). The bridge’s subject follows the Identity NFT and can survive a transfer. If the application relies on owner-specific access, implement the issuer’s back-channel logout and end affected sessions after verified key changes or burns.

Verify CashID directly

A direct integration issues a short-lived, single-use cashid: challenge and receives a signed response from the wallet. Verify the exact signed URI, the Schnorr signature and its binding to the live Identity NFT. Recheck the NFT’s outpoint before accepting login and consume the challenge when the session is authorized.

CashID proves control of the identity for a login. For payments or contract calls that require approval, use the wallet’s transaction connection flow.

Wallet key derivation

The reference wallet derives the first CashAccount’s scan and spend keys at m/44'/145'/0'/2/0' and m/44'/145'/0'/2/1'. A CashID v2 response uses a fresh key derived by tweaking the CashAccount spending key with the exact response URI. BCH derivation types

CashAccounts v2 protocol reference · CashAccounts v2 demo · OIDC authorization-code flow