# BRC-100 Wallet Interface

**BRC-100** is the line between your app's code and wallet code. Your app says what it wants done, in plain method calls; the wallet decides how to do it, including which coins to use, which permissions apply, and how to sign. If you've used <Hint tip="A standard that lets any app connect to any compatible wallet">WalletConnect</Hint> on another chain, this plays a similar role: one interface, many wallets.

<Frame caption="How a desktop and mobile request flow through BRC-100">
  <img src="https://bsv-blockchain.github.io/ts-stack/assets/diagrams/brc100-wallet-flows.svg" alt="BRC-100 desktop and mobile request flows" />
</Frame>

## Why This Boundary Exists

Without a shared standard, every app would need its own integration for every wallet, and every wallet would need to support every app's way of asking for things. BRC-100 gives both sides one contract instead:

- Your app calls methods like `createAction`, `getPublicKey`, or `encrypt` without knowing which wallet product is on the other end.
- A wallet implements that same interface once and can expose it over localhost, `postMessage`, a JSON API, a native bridge, or in-process, whichever fits how it runs.
- Wallets written in other languages can target the same methods and test against the same conformance suite.

In practice, this is what lets `WalletClient` from `@bsv/sdk` connect to any compliant wallet on a user's machine, without your app knowing in advance which one it will find.

## What BRC-100 Does Not Cover

BRC-100 standardizes how an app talks to a wallet. It does not define how a wallet recovers if something goes wrong, keys get lost, a device dies. That part is the wallet's own responsibility: it has to preserve both the recoverable keys and the records that go with them (derivation metadata, output history).

If you're building an app, link out to your wallet's own recovery flow rather than trying to back up wallet data yourself, and never collect wallet secrets on your side.

## How a Request Flows: Desktop

On desktop, a web app typically uses `@bsv/simple/browser` or `WalletClient` from `@bsv/sdk` directly:

<Steps>
  <Step title="Call a BRC-100 method">
    Your app calls something like `createAction`.
  </Step>
  <Step title="Find the wallet">
    `WalletClient` checks the available channels (localhost ports, in-browser messaging) for a running wallet.
  </Step>
  <Step title="Reach the wallet">
    <Hint tip="Such as BSV Desktop">The wallet</Hint> receives the request over a local wallet server running on the user's machine.
  </Step>
  <Step title="Read and update state">
    The wallet may call shared infrastructure (for proofs, broadcast, and so on) to carry out the request.
  </Step>
  <Step title="Sign locally">
    The private key never leaves the wallet process.
  </Step>
  <Step title="Return the result">
    The wallet sends back a result, such as a `txid`, the transaction itself, or a `signableTransaction` if your app needs to add its own signature.
  </Step>
</Steps>

## How a Request Flows: Mobile

On mobile, the pattern is the same from the app's point of view, a wallet app just embeds the web app and exposes the same methods through a bridge instead of localhost:

<Steps>
  <Step title="Call the same method">
    Your app calls the same BRC-100 method it would on desktop, unchanged.
  </Step>
  <Step title="Bridge to native code">
    The WebView passes the request to native wallet code.
  </Step>
  <Step title="Sign on the device">
    The native wallet picks its own coins and signs locally.
  </Step>
  <Step title="Broadcast and prove">
    The wallet may still reach out to network services for broadcasting and proofs.
  </Step>
  <Step title="Return through the bridge">
    The result comes back to your web app the same way the request went out.
  </Step>
</Steps>

Because both flows expose the same methods, your app's logic doesn't need a separate code path for desktop versus mobile.

## What You Can Ask a Wallet to Do

BRC-100 methods fall into a few groups:

| Group | Purpose | Example methods |
| --- | --- | --- |
| Actions | Create, sign, cancel, list, or absorb transactions | `createAction`, `signAction`, `internalizeAction` |
| Outputs | Query or release the coins your app is tracking | `listOutputs`, `relinquishOutput` |
| Keys and crypto | Derive keys, encrypt, decrypt, sign | `getPublicKey`, `encrypt`, `createSignature` |
| Certificates | Issue, list, prove, or discover identity certificates | `acquireCertificate`, `proveCertificate` |
| Wallet state | Check authentication, chain height, network, version | `getHeight`, `getVersion` |

## What createAction Can Return

Calling `createAction` ends in one of two ways:

| Outcome | What you get back | What it means |
| --- | --- | --- |
| Immediate action | A `txid` and/or the transaction itself | The wallet had everything it needed to fund, sign, and process the transaction on its own. |
| Signable action | `signableTransaction: { tx, reference }` | Your app still needs to sign specific inputs itself, then call `signAction` to finish. |

Wallets can also chain several actions together before broadcasting any of them, carrying change forward and sending the whole batch at once.

## Organizing What the Wallet Tracks

BRC-100 gives you three different ways to tag things, and they're not interchangeable:

| Concept | Applies to | Used by |
| --- | --- | --- |
| Labels | A whole action or transaction | `createAction`, `listActions` |
| Tags | One specific output | `createAction`, `listOutputs` |
| Baskets | A named group of outputs | `listOutputs`, `internalizeAction` |