Payments and wallets
Build payment flows and wallet integrations using light-token on Solana. The light-token API matches SPL-token and extends it to include the light token program.
| Creation cost |
SPL |
light-token |
| Token Account |
~2,000,000 lamports |
~11,000 lamports |
Workflow
- Clarify intent
- Recommend plan mode, if it's not activated
- Use
AskUserQuestion to resolve blind spots
- All questions must be resolved before execution
- Identify references and skills
- Write plan file (YAML task format)
- Use
AskUserQuestion for anything unclear — never guess or assume
- Identify blockers: permissions, dependencies, unknowns
- Plan must be complete before execution begins
- Execute
- Use
Task tool with subagents for parallel research
- Subagents load skills via
Skill tool
- Track progress with
TodoWrite
- When stuck: ask to spawn a read-only subagent with
Read, Glob, Grep, and DeepWiki MCP access, loading skills/ask-mcp. Scope reads to skill references, example repos, and docs.
API overview
| Operation |
SPL |
light-token (action / instruction) |
| Receive |
getOrCreateAssociatedTokenAccount() |
loadAta() / createLoadAtaInstructions() |
| Transfer |
createTransferInstruction() |
transferInterface() / createTransferInterfaceInstructions() |
| Get balance |
getAccount() |
getAtaInterface() |
| Tx history |
getSignaturesForAddress() |
rpc.getSignaturesForOwnerInterface() |
| Wrap from SPL |
N/A |
wrap() / createWrapInstruction() |
| Unwrap to SPL |
N/A |
unwrap() / createUnwrapInstructions() |
| Register SPL mint |
N/A |
createSplInterface() / LightTokenProgram.createSplInterface() |
| Create mint |
createMint() |
createMintInterface() |
Plural functions (createTransferInterfaceInstructions, createUnwrapInstructions) return TransactionInstruction[][] — each inner array is one transaction. They handle loading cold accounts automatically.
Domain references
| Task |
Reference |
| Build payment flows (receive, send, balance, history, wrap/unwrap) |
payments.md |
| Build wallet UI (display tokens, transfer, wrap/unwrap) |
wallets.md |
| Sign with Wallet Adapter or Mobile Wallet Adapter |
sign-with-adapter.md |
| Sign with Privy (embedded wallet provider) |
sign-with-privy.md |
| Prevent duplicate actions (double-spend prevention) |
nullifiers.md |
Setup
npm install @lightprotocol/compressed-token@beta @lightprotocol/stateless.js@beta @solana/web3.js @solana/spl-token
import { createRpc } from "@lightprotocol/stateless.js";
import {
createLoadAtaInstructions,
loadAta,
createTransferInterfaceInstructions,
transferInterface,
createUnwrapInstructions,
unwrap,
getAssociatedTokenAddressInterface,
getAtaInterface,
wrap,
} from "@lightprotocol/compressed-token/unified";
const rpc = createRpc(RPC_ENDPOINT);
Resources
SDK references
| Package |
Link |
@lightprotocol/stateless.js |
API docs |
@lightprotocol/compressed-token |
API docs |
@lightprotocol/nullifier-program |
npm |
Security
The Privy signing examples transmit secrets to an external API — review sign-with-privy.md before running.
- Declared dependencies.
HELIUS_RPC_URL is required for all examples. The Privy signing flow additionally requires PRIVY_APP_ID, PRIVY_APP_SECRET, TREASURY_WALLET_ID, and TREASURY_AUTHORIZATION_KEY — get these at privy.io. Load secrets from a secrets manager, not agent-global environment.
- Privy signing flow.
PRIVY_APP_SECRET and TREASURY_AUTHORIZATION_KEY are sent to Privy's signing API. Verify these only reach Privy's official endpoints. See sign-with-privy.md.
- Subagent scope. When stuck, the skill asks to spawn a read-only subagent with
Read, Glob, Grep scoped to skill references, example repos, and docs.
- Install source.
npx skills add Lightprotocol/skills from Lightprotocol/skills.
- Audited protocol. Audit reports at github.com/Lightprotocol/light-protocol/tree/main/audits.
1---
2name: payments-and-wallets
3description: "For stablecoin payment flows and wallet integrations on Solana 200x cheaper token accounts. Receive, send, balance, history, and client-side signing with Privy and Solana wallet adapters. Optional guide to add nullifiers to prevent payments from being executed more than once."
4metadata:
5 source: https://skillmd.com/skills/modbender/payments-and-wallets
6 upstream: https://github.com/Lightprotocol/skills
7 documentation: https://www.zkcompression.com
8 openclaw:
9 requires:
10 env: ["HELIUS_RPC_URL"] # Required for all examples
11 # Privy signing flow only (sign-with-privy.md): PRIVY_APP_ID, PRIVY_APP_SECRET, TREASURY_WALLET_ID, TREASURY_AUTHORIZATION_KEY — get these at privy.io
12 bins: ["node", "cargo"] # node for TS client, cargo for Rust nullifier example
13---
14
15# Payments and wallets
16
17Build payment flows and wallet integrations using light-token on Solana. The light-token API matches SPL-token and extends it to include the light token program.
18
19| Creation cost | SPL | light-token |
20| :---------------- | :------------------ | :------------------- |
21| **Token Account** | ~2,000,000 lamports | ~**11,000** lamports |
22
23## Workflow
24
251. **Clarify intent**
26 - Recommend plan mode, if it's not activated
27 - Use `AskUserQuestion` to resolve blind spots
28 - All questions must be resolved before execution
292. **Identify references and skills**
30 - Match task to [domain references](#domain-references) below
31 - Locate relevant documentation and examples
323. **Write plan file** (YAML task format)
33 - Use `AskUserQuestion` for anything unclear — never guess or assume
34 - Identify blockers: permissions, dependencies, unknowns
35 - Plan must be complete before execution begins
364. **Execute**
37 - Use `Task` tool with subagents for parallel research
38 - Subagents load skills via `Skill` tool
39 - Track progress with `TodoWrite`
405. **When stuck**: ask to spawn a read-only subagent with `Read`, `Glob`, `Grep`, and DeepWiki MCP access, loading `skills/ask-mcp`. Scope reads to skill references, example repos, and docs.
41
42## API overview
43
44| Operation | SPL | light-token (action / instruction) |
45|-----------|-----|-------------------------------------|
46| Receive | `getOrCreateAssociatedTokenAccount()` | `loadAta()` / `createLoadAtaInstructions()` |
47| Transfer | `createTransferInstruction()` | `transferInterface()` / `createTransferInterfaceInstructions()` |
48| Get balance | `getAccount()` | `getAtaInterface()` |
49| Tx history | `getSignaturesForAddress()` | `rpc.getSignaturesForOwnerInterface()` |
50| Wrap from SPL | N/A | `wrap()` / `createWrapInstruction()` |
51| Unwrap to SPL | N/A | `unwrap()` / `createUnwrapInstructions()` |
52| Register SPL mint | N/A | `createSplInterface()` / `LightTokenProgram.createSplInterface()` |
53| Create mint | `createMint()` | `createMintInterface()` |
54
55Plural functions (`createTransferInterfaceInstructions`, `createUnwrapInstructions`) return `TransactionInstruction[][]` — each inner array is one transaction. They handle loading cold accounts automatically.
56
57## Domain references
58
59| Task | Reference |
60|------|-----------|
61| Build payment flows (receive, send, balance, history, wrap/unwrap) | [payments.md](references/payments.md) |
62| Build wallet UI (display tokens, transfer, wrap/unwrap) | [wallets.md](references/wallets.md) |
63| Sign with Wallet Adapter or Mobile Wallet Adapter | [sign-with-adapter.md](references/sign-with-adapter.md) |
64| Sign with Privy (embedded wallet provider) | [sign-with-privy.md](references/sign-with-privy.md) |
65| Prevent duplicate actions (double-spend prevention) | [nullifiers.md](references/nullifiers.md) |
66
67## Setup
68
69```bash
70npm install @lightprotocol/compressed-token@beta @lightprotocol/stateless.js@beta @solana/web3.js @solana/spl-token
71```
72
73```typescript
74import { createRpc } from "@lightprotocol/stateless.js";
75import {
76 createLoadAtaInstructions,
77 loadAta,
78 createTransferInterfaceInstructions,
79 transferInterface,
80 createUnwrapInstructions,
81 unwrap,
82 getAssociatedTokenAddressInterface,
83 getAtaInterface,
84 wrap,
85} from "@lightprotocol/compressed-token/unified";
86
87const rpc = createRpc(RPC_ENDPOINT);
88```
89
90## Resources
91
92- [Payments docs](https://zkcompression.com/light-token/toolkits/for-payments)
93- [Wallets docs](https://zkcompression.com/light-token/toolkits/for-wallets)
94- [GitHub examples](https://github.com/Lightprotocol/examples-light-token/tree/main/toolkits/payments-and-wallets)
95- [Nullifier program](https://github.com/Lightprotocol/nullifier-program/)
96
97## SDK references
98
99| Package | Link |
100|---------|------|
101| `@lightprotocol/stateless.js` | [API docs](https://lightprotocol.github.io/light-protocol/stateless.js/index.html) |
102| `@lightprotocol/compressed-token` | [API docs](https://lightprotocol.github.io/light-protocol/compressed-token/index.html) |
103| `@lightprotocol/nullifier-program` | [npm](https://www.npmjs.com/package/@lightprotocol/nullifier-program) |
104
105## Security
106
107The Privy signing examples transmit secrets to an external API — review [sign-with-privy.md](references/sign-with-privy.md) before running.
108
109- **Declared dependencies.** `HELIUS_RPC_URL` is required for all examples. The Privy signing flow additionally requires `PRIVY_APP_ID`, `PRIVY_APP_SECRET`, `TREASURY_WALLET_ID`, and `TREASURY_AUTHORIZATION_KEY` — get these at [privy.io](https://privy.io). Load secrets from a secrets manager, not agent-global environment.
110- **Privy signing flow.** `PRIVY_APP_SECRET` and `TREASURY_AUTHORIZATION_KEY` are sent to Privy's signing API. Verify these only reach Privy's official endpoints. See [sign-with-privy.md](references/sign-with-privy.md).
111- **Subagent scope.** When stuck, the skill asks to spawn a read-only subagent with `Read`, `Glob`, `Grep` scoped to skill references, example repos, and docs.
112- **Install source.** `npx skills add Lightprotocol/skills` from [Lightprotocol/skills](https://github.com/Lightprotocol/skills).
113- **Audited protocol.** Audit reports at [github.com/Lightprotocol/light-protocol/tree/main/audits](https://github.com/Lightprotocol/light-protocol/tree/main/audits).