Token导航 LogoToken导航TokenDH.com
开发敏感数据github未标认证来源可访问许可证需确认审计提醒

wallet-brc100钱包 BRC100

Agent Skill

wallet-brc100 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

461

周安装

19

GitHub Stars

2

下载量

150
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:wallet-brc100(钱包 BRC100)
来源仓库:https://github.com/b-open-io/bsv-skills
仓库路径:skills/wallet-brc100
安装命令:
npx skills add https://github.com/b-open-io/bsv-skills --skill wallet-brc100
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/b-open-io/bsv-skills --skill wallet-brc100

简介

用于处理 GitHub 仓库、Issue 和 Pull Request 信息,支持 BSV 区块链钱包开发协作。

  • 适用于开发类任务,可在 b-open-io/bsv-skills 项目中辅助代码管理与审查。
  • 通过 npx skills add 命令从指定仓库安装,具体功能见原始文档。
  • 建议在使用前确认是否会触发网络请求或修改钱包相关配置。
  • wallet-brc100 属于开发类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

BRC-100 Wallet Implementation Guide

This skill provides comprehensive guidance for implementing BRC-100 conforming wallets using the @bsv/wallet-toolbox package (v1.7.18+).

Getting Started: Before implementing, review the Strategic Questionnaire to determine the right architecture for your wallet type.

Quick Reference

Core Dependencies

{
  "@bsv/wallet-toolbox": "^1.7.18",
  "@bsv/sdk": "^1.9.29"
}

WalletClient vs Wallet — Choose the Right Class

This is the most important distinction in the BSV wallet stack:

ClassPackageUse When
WalletClient@bsv/sdkYour app connects to a user's *existing* wallet (browser extension, MetaNet Client, etc.) — you don't control the keys
Wallet@bsv/wallet-toolboxYou *are* building the wallet — you own the keys, storage, and services
// WalletClient — thin client, no key management
import { WalletClient } from '@bsv/sdk'
const wallet = new WalletClient() // connects to user's wallet environment

// Wallet — full wallet you build and control
import { Wallet } from '@bsv/wallet-toolbox'
const wallet = new Wallet({ chain, keyDeriver, storage, services })

Most apps (dApps, payment integrations) should use WalletClient. Only wallet *builders* need Wallet from @bsv/wallet-toolbox.

Main Classes

ClassPurposeUse When
WalletClientThin BRC-100 clientApps connecting to user's external wallet
WalletFull BRC-100 walletBuilding production wallet apps
SimpleWalletManagerLightweight wrapperSimple key-based authentication
CWIStyleWalletManagerMulti-profile walletAdvanced UMP token flows
WalletSignerTransaction signingCustom signing logic

Table of Contents

  1. Installation & Setup
  2. Wallet Initialization
  3. Transaction Operations
  4. Key Management
  5. Storage Configuration
  6. Certificate Operations
  7. Error Handling
  8. Production Patterns

1. Installation & Setup

Install Dependencies

bun add @bsv/wallet-toolbox @bsv/sdk
# Optional storage backends:
bun add knex sqlite3          # SQLite
bun add knex mysql2           # MySQL
bun add idb                   # IndexedDB (browser)

Basic Imports

import {
  Wallet,
  WalletStorageManager,
  StorageKnex,
  StorageIdb,
  Services,
  WalletServices,
  PrivilegedKeyManager
} from '@bsv/wallet-toolbox'

import {
  PrivateKey,
  KeyDeriver,
  Random,
  Utils
} from '@bsv/sdk'

2. Wallet Initialization

Pattern A: Simple Wallet (Node.js with SQLite)

import { Wallet, StorageKnex, Services } from '@bsv/wallet-toolbox'
import { PrivateKey, Random } from '@bsv/sdk'
import Knex from 'knex'

async function createSimpleWallet() {
  // 1. Create root private key (or derive from mnemonic)
  const rootKey = new PrivateKey(Random(32))
  // Use KeyDeriver from @bsv/sdk for proper BRC-42 key derivation
  const keyDeriver = new KeyDeriver(rootKey)

  // 2. Configure SQLite storage
  const knex = Knex({
    client: 'sqlite3',
    connection: { filename: './wallet.db' },
    useNullAsDefault: true
  })

  const storage = new StorageKnex({
    knex,
    storageIdentityKey: rootKey.toPublicKey().toString(),
    storageName: 'my-wallet-storage'
  })

  await storage.makeAvailable()

  // 3. Configure services (mainnet)
  const services = new Services({
    chain: 'main',
    bsvExchangeRate: { timestamp: new Date(), base: 'USD', rate: 50 },
    bsvUpdateMsecs: 15 * 60 * 1000,
    fiatExchangeRates: {
      timestamp: new Date(),
      base: 'USD',
      rates: { EUR: 0.85, GBP: 0.73 }
    },
    fiatUpdateMsecs: 24 * 60 * 60 * 1000,
    arcUrl: 'https://arc.taal.com',
    arcConfig: {}
  })

  // 4. Create wallet
  const wallet = new Wallet({
    chain: 'main',
    keyDeriver,
    storage,
    services
  })

  return wallet
}

Pattern B: Browser Wallet (IndexedDB)

import { Wallet, StorageIdb, Services } from '@bsv/wallet-toolbox'
import { PrivateKey, Random } from '@bsv/sdk'

async function createBrowserWallet() {
  const rootKey = new PrivateKey(Random(32))

  // Use IndexedDB for browser storage
  const storage = new StorageIdb({
    idb: await openDB('my-wallet-db', 1),
    storageIdentityKey: rootKey.toPublicKey().toString(),
    storageName: 'browser-wallet'
  })

  await storage.makeAvailable()

  const services = new Services({
    chain: 'main',
    // ... services config
  })

  const wallet = new Wallet({
    chain: 'main',
    keyDeriver: createKeyDeriver(rootKey),
    storage,
    services
  })

  return wallet
}

Pattern C: Multi-Profile Wallet

import { CWIStyleWalletManager, OverlayUMPTokenInteractor } from '@bsv/wallet-toolbox'

async function createMultiProfileWallet() {
  const manager = new CWIStyleWalletManager(
    'example.com', // Admin originator
    async (profilePrimaryKey, profilePrivilegedKeyManager, profileId) => {
      // Build wallet for specific profile
      const keyDeriver = createKeyDeriver(new PrivateKey(profilePrimaryKey))
      const storage = await createStorage(profileId)
      const services = new Services({ chain: 'main', /* ... */ })

      return new Wallet({
        chain: 'main',
        keyDeriver,
        storage,
        services,
        privilegedKeyManager: profilePrivilegedKeyManager
      })
    },
    new OverlayUMPTokenInteractor(), // UMP token interactor
    async (recoveryKey) => {
      // Save recovery key (e.g., prompt user to write it down)
      console.log('SAVE THIS RECOVERY KEY:', Utils.toBase64(recoveryKey))
      return true
    },
    async (reason, test) => {
      // Retrieve password from user
      const password = prompt(`Enter password for: ${reason}`)
      if (!password) throw new Error('Password required')
      if (!test(password)) throw new Error('Invalid password')
      return password
    }
  )

  // Provide presentation key (e.g., from QR code scan)
  const presentationKey = Random(32)
  await manager.providePresentationKey(presentationKey)

  // Provide password
  await manager.providePassword('user-password')

  // Now authenticated and ready to use
  return manager
}

3. Transaction Operations

Create a Transaction

import { CreateActionArgs, CreateActionResult } from '@bsv/sdk'

async function sendBSV(
  wallet: Wallet,
  recipientAddress: string,
  satoshis: number
) {
  const args: CreateActionArgs = {
    description: 'Send BSV payment',
    outputs: [{
      lockingScript: Script.fromAddress(recipientAddress).toHex(),
      satoshis,
      outputDescription: `Payment to ${recipientAddress}`,
      basket: 'default',
      tags: ['payment']
    }],
    options: {
      acceptDelayedBroadcast: false, // Broadcast immediately
      randomizeOutputs: true          // Privacy
    }
  }

  const result: CreateActionResult = await wallet.createAction(args)

  if (result.txid) {
    console.log('Transaction created:', result.txid)
    return result.txid
  } else {
    console.log('Transaction pending signature')
    return result.signableTransaction
  }
}

Spending Existing Outputs (inputBEEF Required)

CRITICAL: When spending known wallet outputs via createAction, you MUST provide inputBEEF. The wallet needs the full BEEF proof chain (merkle proofs back to confirmed ancestors) for every input being spent. Without it, createAction will fail with "missing full proof in the inputBEEF".

Two ways to obtain BEEF for inputs:

1. From listOutputs with include: 'entire transactions' — for wallet-owned outputs:

// Fetch outputs WITH their BEEF proof chain
const result = await wallet.listOutputs({
  basket: 'my-basket',
  include: 'entire transactions',  // Returns result.BEEF
  includeTags: true,
})

// Pass the BEEF when spending those outputs
const createResult = await wallet.createAction({
  description: 'Spend basket outputs',
  inputBEEF: result.BEEF,  // Full proof chain for inputs
  inputs: result.outputs.map(o => ({
    outpoint: o.outpoint,
    inputDescription: 'Basket output',
    unlockingScriptLength: 180,
    sequenceNumber: 0xffffffff,
  })),
  outputs: [],
  options: { signAndProcess: false },
})

2. From a service BEEF lookup — for external inputs (sweep, purchase):

// Fetch BEEF from chain services
const beef = await services.getBeefForTxid(txid)
// Merge multiple if needed
for (const additionalTxid of otherTxids) {
  beef.mergeBeef(await services.getBeefForTxid(additionalTxid))
}

const createResult = await wallet.createAction({
  description: 'Spend external inputs',
  inputBEEF: beef.toBinary(),
  inputs: [...],
  outputs: [...],
})

Never call createAction with inputs but without inputBEEF — even if the wallet "owns" the outputs.

noSend + BEEF Relay Pattern

Use noSend: true when you want to create and sign a transaction but let a backend service validate and/or broadcast it. The result is returned as BEEF (Background Evaluation Extended Format) — a bundle of the transaction plus merkle proofs of its inputs, enabling SPV verification without a full node.

import { WalletClient, P2PKH, Transaction } from '@bsv/sdk'

const wallet = new WalletClient()

// Build and sign, but don't broadcast
const { tx } = await wallet.createAction({
  description: 'Payment to service',
  outputs: [{
    lockingScript: new P2PKH().lock(recipientAddress).toHex(),
    satoshis: 1000,
    outputDescription: 'Service payment',
  }],
  options: { noSend: true },
})

// tx is BEEF bytes — convert to hex for JSON transport
const beefHex = Transaction.fromBEEF(tx).toHexBEEF()

// Send to backend — it can SPV-verify and broadcast
await fetch(`https://your-service.example.com/pay?session=${sessionId}`, {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({ beefHex }),
})

Why this pattern?

  • The receiving service can verify the payment is valid via SPV *before* granting access or broadcasting
  • Useful for payment-gated APIs, content unlocking, and atomic service flows
  • BEEF includes merkle proofs so the server doesn't need a full node

Common mistake: forgetting the $ in template literals — {session} is a literal string, ${session} interpolates the variable.

Sign a Transaction (Two-Phase with completeSignedAction)

Note: completeSignedAction requires @1sat/actions and @bsv/sdk v2+. If using @bsv/wallet-toolbox v1.x without @1sat/actions, use wallet.signAction() directly instead.

For two-phase actions (signAndProcess: false), use the completeSignedAction helper from @1sat/actions instead of calling signAction directly:

import { completeSignedAction } from '@1sat/actions'

const result = await completeSignedAction(
  wallet,
  createResult,           // from createAction with signAndProcess: false
  inputBEEF as number[],  // BEEF from listOutputs (full SPV proof chain)
  async (tx) => {
    // tx is a fully-wired Transaction; return unlocking scripts by input index
    return { 0: { unlockingScript: myScript.toHex() } }
  },
)

The helper handles BEEF merge, script verification, signAction, and abortAction on failure.

signableTransaction BEEF Stripping

makeSignableTransactionBeef in wallet-toolbox intentionally strips merkle proofs (uses mergeRawTx). The completeSignedAction helper fixes this by merging the unsigned tx into the original inputBEEF:

import { Beef } from '@bsv/sdk'  // Beef IS exported from @bsv/sdk

const beef = Beef.fromBinary(inputBEEF)
beef.mergeRawTx(unsignedTx.toBinary())
const atomicTx = beef.findAtomicTransaction(txid)

This reconstructs the full BEEF with merkle proofs intact.

abortAction Scope

abortAction({reference}) works on these statuses only:

  • nosend, unsigned, unprocessed

Does NOT work on: completed, failed, sending, unproven.

Server-side processAction verifies unlocking scripts independently after signAction. On verification failure, the server sets status to failed and releases inputs automatically.

Sign a Transaction (Direct signAction)

For simple cases where you need raw signAction:

async function signTransaction(
  wallet: Wallet,
  reference: string,
  unlockingScripts: Record<number, { unlockingScript: string }>
) {
  const result = await wallet.signAction({
    reference,
    spends: unlockingScripts
  })

  console.log('Transaction signed:', result.txid)
  return result
}

Check Wallet Balance

async function getWalletBalance(wallet: Wallet) {
  // Method 1: Quick balance (uses special operation)
  const balance = await wallet.balance()
  console.log(`Balance: ${balance} satoshis`)

  // Method 2: Detailed balance with UTXOs
  const detailed = await wallet.balanceAndUtxos('default')
  console.log(`Total: ${detailed.total} satoshis`)
  console.log(`UTXOs: ${detailed.utxos.length}`)
  detailed.utxos.forEach(utxo => {
    console.log(`  ${utxo.outpoint}: ${utxo.satoshis} sats`)
  })

  return balance
}

List Outputs

import { ListOutputsArgs, ListOutputsResult } from '@bsv/sdk'

async function listSpendableOutputs(wallet: Wallet) {
  const args: ListOutputsArgs = {
    basket: 'default',  // Change basket
    spendable: true,    // Only spendable outputs
    limit: 100,
    offset: 0,
    tags: ['payment']   // Optional: filter by tags
  }

  const result: ListOutputsResult = await wallet.listOutputs(args)

  console.log(`Found ${result.totalOutputs} outputs`)
  result.outputs.forEach(output => {
    console.log(`  ${output.outpoint}: ${output.satoshis} sats`)
  })

  return result
}

List Actions (Transactions)

async function listTransactionHistory(wallet: Wallet) {
  const result = await wallet.listActions({
    labels: [],
    labelQueryMode: 'any',
    limit: 50,
    offset: 0
  })

  console.log(`Found ${result.totalActions} actions`)
  result.actions.forEach(action => {
    console.log(`  ${action.txid}: ${action.status} - ${action.description}`)
  })

  return result
}

4. Key Management

Get Public Key

async function getIdentityKey(wallet: Wallet) {
  // Get wallet's identity key
  const result = await wallet.getPublicKey({ identityKey: true })
  console.log('Identity Key:', result.publicKey)
  return result.publicKey
}

async function getDerivedKey(wallet: Wallet) {
  // Get derived key for specific protocol
  const result = await wallet.getPublicKey({
    protocolID: [2, 'my-app'],
    keyID: 'encryption-key-1',
    counterparty: 'recipient-identity-key'
  })

  return result.publicKey
}

Encrypt/Decrypt Data

async function encryptMessage(
  wallet: Wallet,
  plaintext: string,
  recipientPubKey: string
) {
  const result = await wallet.encrypt({
    plaintext: Utils.toArray(plaintext, 'utf8'),
    protocolID: [2, 'secure-messaging'],
    keyID: 'msg-key',
    counterparty: recipientPubKey
  })

  return Utils.toBase64(result.ciphertext)
}

async function decryptMessage(
  wallet: Wallet,
  ciphertext: string,
  senderPubKey: string
) {
  const result = await wallet.decrypt({
    ciphertext: Utils.toArray(ciphertext, 'base64'),
    protocolID: [2, 'secure-messaging'],
    keyID: 'msg-key',
    counterparty: senderPubKey
  })

  return Utils.toUTF8(result.plaintext)
}

Create Signature

async function signData(wallet: Wallet, data: string) {
  const result = await wallet.createSignature({
    data: Utils.toArray(data, 'utf8'),
    protocolID: [2, 'document-signing'],
    keyID: 'sig-key',
    counterparty: 'self'
  })

  return Utils.toBase64(result.signature)
}

5. Storage Configuration

See references/storage-config.md for storage configuration details (SQLite, MySQL, IndexedDB, multi-storage manager).


6. Certificate Operations

See references/certificates.md for certificate operations (acquire, list, prove).


7. Error Handling

See references/error-handling.md for error handling patterns (WalletError types, WERR_REVIEW_ACTIONS, double-spend detection).


8. Production Patterns

See references/production-patterns.md for production patterns (wallet state management, transaction retry logic, background monitoring).


Related Skills

For comprehensive wallet development, also reference these skills:

SkillRelationship
encrypt-decrypt-backupStandard backup formats (.bep files, AES-256-GCM)
junglebusPopulate UTXO set from blockchain, real-time streaming
key-derivationType42/BRC-42 and BIP32 key derivation details
wallet-encrypt-decryptECDH message encryption patterns
wallet-send-bsvBasic transaction creation (simpler than BRC-100)

For 1Sat Ordinals / Token Support:

If your BRC-100 wallet needs to handle 1Sat Ordinals, BSV-20/BSV-21 tokens, or inscriptions, use @1sat/wallet-toolbox which wraps the core wallet-toolbox with ordinals capabilities.

See 1sat for:

  • wallet-create-ordinals - Mint ordinals/NFTs
  • extract-blockchain-media - Extract inscribed media from transactions
  • ordinals-marketplace - List/buy/cancel ordinals (OrdLock)
  • token-operations - BSV21 token send/receive/deploy
  • wallet-setup - BRC-100 wallet creation and sync
  • transaction-building - Action-based tx building (sendBsv, signBsm)
  • sweep-import - Import from external wallets via WIF
  • opns-names - OpNS name registration
  • dapp-connect - dApp wallet connection (@1sat/connect, @1sat/react)
  • timelock - CLTV time-locked BSV

Additional Resources

- Real-world Electron wallet with BRC-100 support - IPC architecture for storage isolation - Background monitoring patterns - HTTPS server on port 2121 for BRC-100 interface

Research: For deep dives into BRC specifications or implementation patterns, use the browser-agent to fetch current documentation from bsv.brc.dev.


Platform Guides

Platform-specific implementation guides:

PlatformGuideReference Implementation
Browser Extensionextension-guide.mdyours-wallet
Desktop (Electron)desktop-guide.mdbsv-desktop
Web Applicationweb-guide.md-
Mobile (React Native)mobile-guide.md-
Node.js Service/CLInodejs-guide.md-

See references/key-concepts.md for BRC-100 unique concepts:

  • Actions vs Transactions
  • Baskets and Tags
  • Certificate system (BRC-52/53/64/65)
  • Background Monitoring

Common Patterns Summary

TaskMethodKey Args
Send BSVcreateAction()outputs, options
Check balancebalance()None
List UTXOslistOutputs()basket, spendable
Get historylistActions()labels, limit
Get pubkeygetPublicKey()protocolID, keyID
Encrypt dataencrypt()plaintext, counterparty
Get certificateacquireCertificate()type, certifier

Remember: Always handle errors properly, use privileged keys securely, and follow BRC-100 security levels for sensitive operations!

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

33.57%
按下载量换算50

Claude

28.7%
按下载量换算43

Cursor

18.83%
按下载量换算28

Gemini CLI

9.4%
按下载量换算14

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

可疑

权限和风险

敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills