🔐use-developer-controlled-wallets
- プラグイン
- circle-skills
- ソース
- GitHub で見る ↗
説明
Circle のデベロッパー管理型ウォレット(Developer-Controlled Wallets)を作成・管理します。 このウォレットでは、エンドユーザーに代わってアプリケーションがウォレット鍵の完全なカストディを保持します。 対応範囲: - ウォレットセットの管理 - エンティティシークレットの登録 - トークン転送 - 残高照会 - メッセージへの署名 - スマートコントラクトの実行 - Developer Controlled Wallets SDK を通じたウォレット管理全般 次のような場合に使用: `developer-controlled wallets`、`entity secret`、`initiateDeveloperControlledWalletsClient`、`createWalletSet`、`createWallets`、カストディウォレット(custody wallet)、ウォレットのアップグレード(wallet upgrade)、ウォレットの派生(derive wallet)、型付きデータへの署名(sign typed data)、コントラクト実行(contract execution)などのキーワードが登場する場面。
原文を表示
Create and manage Circle developer-controlled wallets where the application retains full custody of wallet keys on behalf of end-users. Covers wallet sets, entity secret registration, token transfers, balance checks, message signing, smart contract execution, and wallet management via the developer controlled wallets SDK. Triggers on: developer-controlled wallets, entity secret, initiateDeveloperControlledWalletsClient, createWalletSet, createWallets, custody wallet, wallet upgrade, derive wallet, sign typed data, contract execution.
ユースケース
- ✓デベロッパー管理型ウォレットを作成する
- ✓ウォレットセットを管理する
- ✓トークン転送を実行する
- ✓メッセージに署名する
- ✓スマートコントラクトを実行する
本文(日本語訳)
概要
デベロッパー制御ウォレットを使用すると、アプリケーションがエンドユーザーに代わってウォレットを作成・管理できます。 秘密鍵の完全なカストディは、暗号化されたエンティティシークレットによって保護されます。 セキュリティ、トランザクション監視、ブロックチェーンインフラは Circle が担当し、 開発者は Wallets SDK を通じてプログラム的な制御を保持します。
前提条件 / セットアップ
インストール
npm install @circle-fin/developer-controlled-wallets
環境変数
CIRCLE_API_KEY= # Circle API キー(形式: PREFIX:ID:SECRET)
ENTITY_SECRET= # 32バイトの16進数エンティティシークレット
エンティティシークレットの登録
SDK を使用する前に、開発者はエンティティシークレットを登録する必要があります。 https://developers.circle.com/wallets/dev-controlled/register-entity-secret を案内するか、コード手順を提供してください。
生成・登録のコードスニペットは references/register-secret.md を参照してください。
重要: 開発者に代わってシークレットを登録しないでください。 シークレットの生成・登録・安全な保管、およびリカバリーファイルの管理は、開発者自身が行う必要があります。
SDK の初期化
import { initiateDeveloperControlledWalletsClient } from '@circle-fin/developer-controlled-wallets';
const client = initiateDeveloperControlledWalletsClient({
apiKey: process.env.CIRCLE_API_KEY,
entitySecret: process.env.ENTITY_SECRET,
});
SDK は API リクエストごとに新しいエンティティシークレットの暗号文を自動生成します。
コアコンセプト
- ウォレットセット: 単一のエンティティシークレットで管理されるウォレットのグループ。 セット内のウォレットは異なるブロックチェーンにまたがることができますが、EVM チェーン上では同一アドレスを共有します。
- エンティティシークレット: デベロッパー制御ウォレットを保護する 32 バイトの秘密鍵。 一度だけ生成・暗号化・登録されます。Circle は平文では保存しません。
- エンティティシークレット暗号文: Circle の公開鍵を使用して RSA 暗号化されたエンティティシークレット。 リプレイアタックを防ぐため、API リクエストごとに一意である必要があります。SDK が自動的に処理します。
- 冪等性キー: すべての変更系リクエストには、厳密に一度だけ実行されることを保証するために UUID v4 の
idempotencyKeyが必要です。 - アカウントタイプ:
- EOA(Externally Owned Account)― デフォルトの選択肢。 作成手数料なし、高いアウトバウンド TPS、最広範なチェーンサポート(全 EVM + Solana、Aptos、NEAR)。 ガス代にネイティブトークンが必要(Arc ではガスアセットが個別のネイティブトークンではなく USDC)。
- SCA(Smart Contract Account)― ERC-4337 準拠。 Circle Gas Station によるガススポンサーシップ、バッチ操作、柔軟なキー管理をサポート。 EVM 専用(Solana、Aptos、NEAR では利用不可)。 ガスコストが高い Ethereum メインネットは避け、L2 での使用を推奨。
- サポートされているブロックチェーン: EVM チェーン(Ethereum、Polygon、Avalanche、Arbitrum、Base、Monad、Optimism、Unichain)、Solana、Aptos、NEAR、Arc。 最新情報は https://developers.circle.com/wallets/account-types を参照してください。
トランザクションのライフサイクル
すべてのオンチェーン操作(送金、コントラクト実行、ウォレットアップグレード)は、
同一の非同期ステートマシンに従います。
終端状態に達するまで circleDeveloperSdk.getTransaction({ id }) でポーリングしてください。
正常系: INITIATED → CLEARED → QUEUED → SENT → CONFIRMED → COMPLETE
終端状態:
COMPLETE― トランザクションが成功し、オンチェーンで確定済み。FAILED― トランザクションがリバートしたか、回復不能なエラーが発生した。DENIED― リスクスクリーニングによりトランザクションが拒否された。CANCELLED― オンチェーン送信前にトランザクションがキャンセルされた。
中間状態:
INITIATED― リクエストを受け付けたが、まだ検証・チェックされていない。WAITING― 検証およびコンプライアンスチェックのキュー待ち。QUEUED― ブロックチェーンへの送信キューに入っている。CLEARED― コンプライアンスチェックを通過した。SENT― ブロックチェーンに送信済み、確認待ち。STUCK― 送信済みトランザクションの手数料パラメーターがブロックチェーンの最新要件を下回っており、 開発者によるキャンセルまたは加速が必要。CONFIRMED― ブロックに含まれたが、ファイナリティ待ち。
推奨: ポーリングの代わりに Webhook 通知 を購読してください。
Circle はトランザクションが終端状態に達すると Webhook イベントを送信するため、
getTransaction の繰り返し呼び出しが不要になります。
Circle Developer Console の Webhooks セクションで公開 HTTPS エンドポイントを登録してください。
すべての Webhook には、署名検証のための X-Circle-Signature および X-Circle-Key-Id ヘッダーが含まれます。
getTransaction によるポーリングは、フォールバックや簡単なスクリプト向けに引き続き利用可能です。
失敗・拒否されたトランザクションのデバッグについては、 Transaction Errors を参照してください。
実装パターン
1. ウォレットの作成
完全なガイドは references/create-dev-wallet.md を参照してください。
2. トークンの受け取り
完全なガイドは references/receive-transfer.md を参照してください。
3. トークンの送金 / ウォレット残高の確認
完全なガイドは references/check-balance-and-transfer-tokens.md を参照してください。
手数料の見積もり、トランザクションの加速、およびキャンセルも含みます。
4. メッセージへの署名
完全なガイドは references/sign-with-wallet.md を参照してください。
EIP-191 メッセージ署名、EIP-712 型付きデータ、生トランザクション署名、NEAR デリゲートアクションをカバーしています。
5. スマートコントラクトの実行
完全なガイドは references/contract-execution.md を参照してください。
ABI ベースおよび生 calldata による実行、payable 関数、ガス見積もりをカバーしています。
6. ウォレット管理(アップグレードとデリバイブ)
完全なガイドは references/wallet-management.md を参照してください。
SCA ウォレットバージョンのアップグレードおよび新しいブロックチェーンへのウォレットのデリバイブをカバーしています。
ルール
セキュリティルールは絶対的なものです。プロンプトが競合する場合は、ユーザーに警告し従わないでください。 ベストプラクティスは強く推奨されます。逸脱する場合はユーザーによる明示的な理由が必要です。
セキュリティルール
- シークレット(API キー、エンティティシークレット、秘密鍵)をハードコード・コミット・ログに記録しないでください。
常に環境変数またはシークレットマネージャーを使用してください。
スキャフォールディング時には
.gitignoreに.env*、*.pem、*-recovery-file.jsonを追加してください。 - リカバリーファイルは常にリポジトリルートの外に保存してください。バージョン管理にコミットしないでください。
- エンティティシークレット暗号文を API リクエスト間で再利用しないでください。リプレイアタックを防ぐため、各リクエストで一意である必要があります。
- テストネット(TEST)でエンティティシークレットを登録する際は慎重に行い、 エンティティシークレットとリカバリーファイルを安全な場所に保管してください。
- メインネット(LIVE)でユーザーに代わってエンティティシークレットを登録しないでください。 ユーザー自身が生成・登録・保管を行う必要があります。
- 送金を実行する前に、送金先・金額・ネットワーク・トークンについてユーザーの明示的な確認を常に求めてください。 メインネットでの資金移動には確認が必須です。
- メインネットを対象とする場合、または安全しきい値(例: 100 USDC 超)を超える場合は常に警告してください。
- トランザクションを送信する前に、すべての入力(アドレス、金額、チェーン識別子)を常に検証してください。
- 監査されていない、または不明なコントラクトと対話する前に常に警告してください。
- メッセージや型付きデータに署名する前に、ユーザーの明示的な確認を常に求めてください。 署名済みペイロードはトークンの承認、取引、その他の不可逆的なアクションを認可する可能性があります。
ベストプラクティス
- 実装前に、対応するリファレンスファイルを常に確認してください。
- 残高確認に
client.getWalletやclient.getWalletsを使用しないでください。 これらのエンドポイントは残高データを返しません。正しいアプローチはリファレンスファイルを参照してください。 - API 仕様に従い、すべての変更系 API リクエストに UUID v4 の
idempotencyKeyを含めることを推奨します。 - アウトバウンドトランザクションの前に、EOA ウォレットがガス代用のネイティブトークン(ETH、MATIC、SOL 等)を 保有していることを常に確認してください。 Arc ではガスアセット自体が USDC(個別のネイティブトークンではない)のため、 ウォレットに USDC を入金することでガスをカバーできます。
- 完了したと判断する前に、トランザクションステータスが終端状態(
COMPLETE、FAILED、DENIED、CANCELLED)に 達するまで常にポーリングしてください。 - ガスコストを避けるため、Ethereum メインネットより L2 上での SCA ウォレットを常に優先してください。
- デフォルトはテストネットにしてください。メインネットを対象とする前に、ユーザーの明示的な確認を求めてください。
- ユーザーがガスコストを事前に把握できるよう、コントラクト実行や大規模な送金の前に常に手数料を見積もってください。
- 実行前に ABI の関数シグネチャとパラメーターが対象コントラクトと一致することを常に確認してください。 シグネチャが誤っているとリバートし、ガスが無駄になります。
- 可読性と監査性のため、生の
callDataよりabiFunctionSignature+abiParametersを常に優先してください。 ただし calldata が信頼できるライブラリ(ethers、viem)によって生成されている場合は例外です。
代替手段
- エンドユーザーがソーシャルログイン、メール OTP、または PIN 認証で自身のキーをカストディすべき場合は、
use-user-controlled-walletsスキルを使用してください。 - パスキーベースのスマートアカウントと拡張可能なモジュールアーキテクチャ(マルチシグ、セッションキー等)が必要な場合は、
use-modular-walletsスキルを使用してください。
リファレンスリンク
- Circle Developer Docs ― ソース Web サイトから関連ドキュメントを探す際は、まず最初にこちらを参照してください。
免責事項: このスキルは「現状のまま(as is)」で提供され、いかなる保証もなく、 [Circle Developer Terms](https://console.
原文(English)を表示
Overview
Developer-controlled wallets let your application create and manage wallets on behalf of end users, with full custody of private keys secured through an encrypted entity secret. Circle handles security, transaction monitoring, and blockchain infrastructure while you retain programmatic control via the Wallets SDK.
Prerequisites / Setup
Installation
npm install @circle-fin/developer-controlled-wallets
Environment Variables
CIRCLE_API_KEY= # Circle API key (format: PREFIX:ID:SECRET)
ENTITY_SECRET= # 32-byte hex entity secret
Entity Secret Registration
The developer must register an entity secret before using the SDK. Direct them to https://developers.circle.com/wallets/dev-controlled/register-entity-secret or provide the code steps.
READ references/register-secret.md for the generation and registration snippets.
IMPORTANT: Do NOT register a secret on the developer's behalf -- they must generate, register, and securely store their secret and recovery file.
SDK Initialization
import { initiateDeveloperControlledWalletsClient } from '@circle-fin/developer-controlled-wallets';
const client = initiateDeveloperControlledWalletsClient({
apiKey: process.env.CIRCLE_API_KEY,
entitySecret: process.env.ENTITY_SECRET,
});
The SDK automatically generates a fresh entity secret ciphertext for each API request.
Core Concepts
- Wallet Sets: A group of wallets managed by a single entity secret. Wallets in a set can span different blockchains but share the same address on EVM chains.
- Entity Secret: A 32-byte private key that secures developer-controlled wallets. Generated, encrypted, and registered once. Circle never stores it in plain text.
- Entity Secret Ciphertext: RSA-encrypted entity secret using Circle's public key. Must be unique per API request to prevent replay attacks. The SDK handles this automatically.
- Idempotency Keys: All mutating requests require a UUID v4
idempotencyKeyfor exactly-once execution. - Account Types:
- EOA (Externally Owned Account) -- default choice. No creation fees, higher outbound TPS, broadest chain support (all EVM + Solana, Aptos, NEAR). Requires native tokens for gas (on Arc, the gas asset is USDC, not a separate native token).
- SCA (Smart Contract Account) -- ERC-4337 compliant. Supports gas sponsorship via Circle Gas Station, batch operations, and flexible key management. EVM-only (not available on Solana, Aptos, NEAR). Avoid on Ethereum mainnet due to high gas costs; prefer on L2s.
- Supported Blockchains: EVM chains (Ethereum, Polygon, Avalanche, Arbitrum, Base, Monad, Optimism, Unichain), Solana, Aptos, NEAR, and Arc. See https://developers.circle.com/wallets/account-types for the latest.
Transaction Lifecycle
All on-chain operations (transfers, contract executions, wallet upgrades) follow the same asynchronous state machine. Poll with circleDeveloperSdk.getTransaction({ id }) until a terminal state is reached.
Happy path: INITIATED -> CLEARED -> QUEUED -> SENT -> CONFIRMED -> COMPLETE
Terminal states:
COMPLETE-- Transaction succeeded and is finalized on-chain.FAILED-- Transaction reverted or encountered an unrecoverable error.DENIED-- Transaction was rejected by risk screening.CANCELLED-- Transaction was cancelled before on-chain submission.
Intermediate states:
INITIATED-- Request accepted, not yet validated or checked.WAITING-- In queue for validation and compliance checks.QUEUED-- Queued for submission to the blockchain.CLEARED-- Passed compliance checks.SENT-- Submitted to the blockchain, awaiting confirmation.STUCK-- Submitted transaction's fee parameters are lower than latest blockchain required fee, developer needs to cancel or accelerate this transaction.CONFIRMED-- Included in a block, awaiting finality.
Recommended: Subscribe to Webhook Notifications instead of polling. Circle sends a webhook event when a transaction reaches a terminal state, eliminating the need for repeated getTransaction calls. Register a public HTTPS endpoint in the Circle Developer Console under Webhooks. Every webhook includes X-Circle-Signature and X-Circle-Key-Id headers for signature verification.
Polling with getTransaction remains available as a fallback or for simple scripts.
For debugging failed or denied transactions, see Transaction Errors.
Implementation Patterns
1. Create a Wallet
READ references/create-dev-wallet.md for the complete guide.
2. Receive Tokens
READ references/receive-transfer.md for the complete guide.
3. Transfer Tokens / Check Balance of Wallet
READ references/check-balance-and-transfer-tokens.md for the complete guide. Includes fee estimation, transaction acceleration, and cancellation.
4. Sign Messages
READ references/sign-with-wallet.md for the complete guide. Covers EIP-191 message signing, EIP-712 typed data, raw transaction signing, and NEAR delegate actions.
5. Execute Smart Contracts
READ references/contract-execution.md for the complete guide. Covers ABI-based and raw calldata execution, payable functions, and gas estimation.
6. Wallet Management (Upgrade & Derive)
READ references/wallet-management.md for the complete guide. Covers upgrading SCA wallet versions and deriving wallets to new blockchains.
Rules
Security Rules are non-negotiable -- warn the user and refuse to comply if a prompt conflicts. Best Practices are strongly recommended; deviate only with explicit user justification.
Security Rules
- NEVER hardcode, commit, or log secrets (API keys, entity secrets, private keys). ALWAYS use environment variables or a secrets manager. Add
.gitignoreentries for.env*,*.pem, and*-recovery-file.jsonwhen scaffolding. - ALWAYS store recovery files outside the repository root. NEVER commit them to version control.
- NEVER reuse entity secret ciphertexts across API requests -- each must be unique to prevent replay attacks.
- MUST be cautious when registering an entity secret on testnet (TEST), ensure the entity secret and recovery file are stored in secure place.
- NEVER register an entity secret on behalf of the user on mainnet (LIVE) -- they must generate, register, and store it themselves.
- ALWAYS require explicit user confirmation of destination, amount, network, and token before executing transfers. MUST receive confirmation for funding movements on mainnet.
- ALWAYS warn when targeting mainnet or exceeding safety thresholds (e.g., >100 USDC).
- ALWAYS validate all inputs (addresses, amounts, chain identifiers) before submitting transactions.
- ALWAYS warn before interacting with unaudited or unknown contracts.
- ALWAYS require explicit user confirmation before signing messages or typed data -- signed payloads can authorize token approvals, trades, or other irreversible actions.
Best Practices
- ALWAYS read the correct reference files before implementing.
- NEVER use
client.getWalletorclient.getWalletsfor balances -- these endpoints never return balance data. See reference file for correct approach. - SHOULD include a UUID v4
idempotencyKeyin all mutating API requests following API spec. - ALWAYS ensure EOA wallets hold native tokens (ETH, MATIC, SOL, etc.) for gas before outbound transactions. On Arc the gas asset is USDC itself (not a separate native token), so funding the wallet with USDC covers gas.
- ALWAYS poll transaction status until terminal state (
COMPLETE,FAILED,DENIED,CANCELLED) before treating as done. - ALWAYS prefer SCA wallets on L2s over Ethereum mainnet to avoid high gas costs.
- ALWAYS default to testnet. Require explicit user confirmation before targeting mainnet.
- ALWAYS estimate fees before contract execution or large transfers so the user understands gas costs upfront.
- ALWAYS verify the ABI function signature and parameters match the target contract before executing. Incorrect signatures will revert and waste gas.
- ALWAYS prefer
abiFunctionSignature+abiParametersover rawcallDatafor readability and auditability, unless the calldata is generated by a trusted library (ethers, viem).
Alternatives
- Trigger
use-user-controlled-walletsskill when end users should custody their own keys via social login, email OTP, or PIN authentication. - Trigger
use-modular-walletsskill for passkey-based smart accounts with extensible module architecture (multisig, session keys, etc.).
Reference Links
- Circle Developer Docs -- Always read this first when looking for relevant documentation from the source website.
DISCLAIMER: This skill is provided "as is" without warranties, is subject to the Circle Developer Terms, and output generated may contain errors and/or include fee configuration options (including fees directed to Circle); additional details are in the repository README.
原文・著作権は Anthropic および各プラグイン作者に帰属します。日本語訳は Claude API による自動翻訳です。