> For the complete documentation index, see [llms.txt](https://black-sheep-finance.gitbook.io/black-sheep-finance-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://black-sheep-finance.gitbook.io/black-sheep-finance-docs/core-concepts/wallets.md).

# Wallets

A wallet in Black Sheep is a managed Solana keypair plus metadata.

## Kinds

| Kind    | Purpose                                           | Policy required        |
| ------- | ------------------------------------------------- | ---------------------- |
| `user`  | Personal / treasury wallet you control directly   | No                     |
| `agent` | Issued to a non-human caller (LLM, cron, service) | Yes (default attached) |

## Lifecycle

1. **Created** — keypair generated server-side, secret encrypted with libsodium (`xchacha20-poly1305`), public key returned to you.
2. **Funded** — you transfer SOL (for gas) and USDC (for spending) to the pubkey.
3. **Active** — accepts `send` calls subject to its policy.
4. **Frozen** *(optional)* — toggle in dashboard; all sends throw `Wallet frozen`.

## Custody model

* **Secret key**: encrypted at rest with a key held in our secrets vault. Never returned via any API. Never logged.
* **Decryption**: happens only inside the server function that signs the transaction, in memory, for the duration of one signing operation.
* **Export**: not supported by default. If you require self-custody, contact us about BYO-key mode (you sign client-side, we enforce policy + bookkeeping).

## Balances

`balance` is fetched live from a Solana RPC node — we don't cache it. Two amounts are returned:

```ts
{ sol: 0.0419, usdc: 184.32 }
```

`sol` is in whole SOL; `usdc` is in whole USDC (6 decimals on-chain, exposed as a number for ergonomics).

## Limits

* One account can hold an unlimited number of wallets.
* Pubkeys are unique per wallet — collisions are not possible (cryptographic).
* Renaming a wallet does not affect the pubkey or balances.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://black-sheep-finance.gitbook.io/black-sheep-finance-docs/core-concepts/wallets.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
