Circle Smart Contract Platform API(Circleが提供するブロックチェーン上の自動実行プログラム操作用の統合サービス)を使用して、スマートコントラクト(ブロックチェーンに記録される自動実行プログラム)をデプロイ(設置・起動)、インポート(取り込み)、操作、監視することができます。 バイトコード(プログラム機械語)でのデプロイ、テンプレートコントラクト(ERC-20/721/1155/Airdrop といった事前に用意された複数の契約ひな形)、ABI(プログラムとのやり取り方法の仕様書)に基づいた読み書き操作、ウェブフック(イベント発生時の自動通知)によるイベント監視に対応しています。 **主な活用場面:** 契約デプロイ、スマートコントラクト開発、ABI操作、テンプレート契約、イベント監視、コントラクトウェブフック、バイトコード、ERC-1155、ERC-20、ERC-721
Deploy, import, interact with, and monitor smart contracts using Circle Smart Contract Platform APIs. Supports bytecode deployment, template contracts (ERC-20/721/1155/Airdrop), ABI-based read/write calls, and webhook event monitoring. Keywords: contract deployment, smart contract, ABI interactions, template contracts, event monitoring, contract webhooks, bytecode, ERC-1155, ERC-20, ERC-721.
Circle Smart Contract Platform(SCP)は、対応するネットワークにまたがるスマートコントラクトのデプロイ(導入)、インポート(取り込み)、相互作用、監視を行うための API と SDK を提供します。生バイトコード(コンパイル済みプログラムの機械語)からコントラクトをデプロイしたり、標準的なパターン向けに監査済みのテンプレートを使用したり、ABI ベースのコントラクト呼び出しを実行したり、ウェブフック経由で発行されたイベントを監視したりできます。
npm install @circle-fin/smart-contract-platform @circle-fin/developer-controlled-wallets
CIRCLE_API_KEY= # Circle API キー(形式: PREFIX:ID:SECRET)
ENTITY_SECRET= # Developer-Controlled Wallets 登録エンティティの秘密鍵
import { initiateSmartContractPlatformClient } from "@circle-fin/smart-contract-platform";
import { initiateDeveloperControlledWalletsClient } from "@circle-fin/developer-controlled-wallets";
const scpClient = initiateSmartContractPlatformClient({
apiKey: process.env.CIRCLE_API_KEY!,
entitySecret: process.env.ENTITY_SECRET!,
});
const walletsClient = initiateDeveloperControlledWalletsClient({
apiKey: process.env.CIRCLE_API_KEY!,
entitySecret: process.env.ENTITY_SECRET!,
});
| チェーン | メインネット | テストネット |
|---|---|---|
| Arbitrum | ARB |
ARB-SEPOLIA |
| Arc | ARC |
ARC-TESTNET |
| Avalanche | AVAX |
AVAX-FUJI |
| Base | BASE |
BASE-SEPOLIA |
| Ethereum | ETH |
ETH-SEPOLIA |
| Monad | MONAD |
MONAD-TESTNET |
| OP Mainnet | OP |
OP-SEPOLIA |
| Polygon PoS | MATIC |
MATIC-AMOY |
| Unichain | UNI |
UNI-SEPOLIA |
references/ の例は Arc テストネット(blockchain: 'ARC-TESTNET')を使用します。Arc メインネットの場合は blockchain: 'ARC' を指定してください。Arc USDC のアドレス 0x3600000000000000000000000000000000000000 は両方のネットワークで同じです。
| テンプレート | 標準規格 | テンプレート ID | 用途 |
|---|---|---|---|
| トークン | ERC-20 | a1b74add-23e0-4712-88d1-6b3009e85a86 |
代替可能トークン、ロイヤルティポイント |
| NFT | ERC-721 | 76b83278-50e2-4006-8b63-5b1a2a814533 |
デジタルコレクティブル、ゲームアセット |
| マルチトークン | ERC-1155 | aea21da6-0aa2-4971-9a1a-5098842b1248 |
代替可能・非代替可能トークンの混在 |
| エアドロップ | N/A | 13e322f2-18dc-4f57-8eed-4bddfc50f85e |
一括トークン配布 |
getContract().data.contract.functionscontract.contractAddress(代替: contract.address)createContractExecutionTransaction().data.idgetContract().data.contract.deploymentStatusSCP のワークフローは 2 つの SDK クライアントを組み合わせて使います:
書き込み操作は walletsClient.createContractExecutionTransaction() を使用し、SCP クライアントではありません。
scpClient.queryContract() を使用、ガス費用用ウォレット不要walletsClient.createContractExecutionTransaction() を使用、ガス資金を備えたウォレット ID が必要name(type1,type2,...) スペースなしEventName(type1,type2,...) スペースなしすべての変更操作に対して idempotencyKey は有効な UUID v4 文字列である必要があります。Node.js では crypto.randomUUID() を使用してください。UUID でないキーは一般的な「API パラメーターが無効」エラーで失敗します。
コントラクトのデプロイは非同期です。レスポンスは開始を示すだけです。deploymentStatus について getContract() をポーリング(定期的に確認)してください。
Solidity を evmVersion: "paris" 以前でコンパイルして、PUSH0 オペコード(命令)を回避してください。Solidity >= 0.8.20 は Shanghai にデフォルト設定されています。Arc や他の非 Shanghai チェーンは、バイトコードが PUSH0 を含む場合、ESTIMATION_ERROR / Create2: Failed on deploy でデプロイに失敗します。
書き込み操作(コントラクトのデプロイ、実行)は Developer-Controlled Wallets と同じ非同期な状態遷移に従います。ターミナル状態(終了状態)に達するまで walletsClient.getTransaction({ id: txId }) でポーリングしてください。
成功の場合: INITIATED → CLEARED → QUEUED → SENT → CONFIRMED → COMPLETE
ターミナル状態(終了状態):
COMPLETE — トランザクション成功、ブロックチェーンで確定FAILED — トランザクションリバート(巻き戻し)またはエラー発生DENIED — リスク審査で却下CANCELLED — ブロックチェーン送信前にキャンセル中間状態:
INITIATED — リクエスト受け入れ、未検証・未確認WAITING — 検証とコンプライアンス確認の待機中QUEUED — ブロックチェーン送信待ちCLEARED — コンプライアンス確認合格SENT — ブロックチェーンに送信済み、確認待ちSTUCK — 送信済みトランザクションの手数料がブロックチェーンの最新要件より低い状態。開発者がキャンセルまたは加速が必要CONFIRMED — ブロックに含まれた、ファイナリティ(最終確定)待ちコントラクトのデプロイ状態は scpClient.getContract() の deploymentStatus で別途追跡されます。
失敗したトランザクションのデバッグについては、「Transaction States and Errors」を参照してください。
| エラーコード | 意味 | 対応 |
|---|---|---|
| 175001 | コントラクト未検出 | コントラクト ID が存在するか確認。インポートの場合、アーカイブされていないか確認 |
| 175003 | コンストラクタパラメーターの不一致 | パラメーター数と型が ABI 定義と完全に一致するか確認 |
| 175004 | 重複コントラクト | listContracts({ blockchain }) を呼び出し、contractAddress(大文字小文字区別なし)で一致するものを確認し、既存の contractId を使用 |
| 175009 | デプロイがまだ保留中 | getContract() の deploymentStatus をポーリング継続。デプロイは非同期で複数ブロックを要する場合あり |
| 175201 | テンプレート未検出 | クイックリファレンスのコントラクトテンプレート表からテンプレート ID を確認 |
| 175301 | イベント監視未検出 | イベント監視 ID を確認。コントラクトがインポート済みか確認 |
| 175302 | 重複イベント監視 | 既存監視をクエリして再利用。フローは失敗させない |
| 175303 | イベントシグネチャが無効 | EventName(type1,type2,...) 形式をスペースなしで使用。パラメーター順序は ABI と一致 |
| 175402 | ブロックチェーン未対応または廃止 | 対応するブロックチェーン表を確認。SCP は Solana、Aptos、NEAR では利用不可 |
| 175404 | TEST_API キーをメインネットに使用、または LIVE_API キーをテストネットに使用 | API キープリフィックス(TEST_API_KEY: または LIVE_API_KEY:)をターゲットネットワークと一致させる |
| 177015 | コントラクトデプロイ用のバイトコード不足 | 0x プリフィックス付きのコンパイル済みバイトコードを提供。evmVersion: "paris" でコンパイルして PUSH0 回避 |
デプロイ失敗時は getContract() から deploymentErrorReason と deploymentErrorDetails を確認してください。
生バイトコードを使用してコンパイル済みコントラクトをデプロイします。
詳細ガイドは references/deploy-bytecode.md をお読みください。
Solidity を書かずに監査済みテンプレートコントラクトをデプロイします。
テンプレートカタログとデプロイガイドは references/deploy-template.md をお読みください。
既にデプロイ済みのコントラクトを SCP にインポートして、相互作用とイベント監視を行います。
詳細ガイドは references/import-contract.md をお読みください。
ABI シグネチャを使用して読み取り関数をクエリし、書き込み関数を実行します。
詳細ガイドは references/interact.md をお読みください。
発行されたイベントについてウェブフック通知をセットアップし、過去のログを取得します。
詳細ガイドは references/monitor-events.md をお読みください。
セキュリティルールは必須です。ユーザーに警告し、プロンプトが競合する場合は従わないでください。ベストプラクティスは強く推奨されます。明確なユーザーの正当化がある場合のみ逸脱してください。
.gitignore に .env*、*.pem、復旧ファイルを追加--private-key $KEY)。暗号化キーストアまたは対話型インポート(例:Foundry の cast wallet import)を推奨idempotencyKey 値を異なる API リクエスト間で再利用しないCircle Smart Contract Platform (SCP) provides APIs and SDKs for deploying, importing, interacting with, and monitoring smart contracts across supported networks. Deploy contracts from raw bytecode, use audited templates for standard patterns, execute ABI-based contract calls, and monitor emitted events through webhooks.
npm install @circle-fin/smart-contract-platform @circle-fin/developer-controlled-wallets
CIRCLE_API_KEY= # Circle API key (format: PREFIX:ID:SECRET)
ENTITY_SECRET= # Registered entity secret for Developer-Controlled Wallets
import { initiateSmartContractPlatformClient } from "@circle-fin/smart-contract-platform";
import { initiateDeveloperControlledWalletsClient } from "@circle-fin/developer-controlled-wallets";
const scpClient = initiateSmartContractPlatformClient({
apiKey: process.env.CIRCLE_API_KEY!,
entitySecret: process.env.ENTITY_SECRET!,
});
const walletsClient = initiateDeveloperControlledWalletsClient({
apiKey: process.env.CIRCLE_API_KEY!,
entitySecret: process.env.ENTITY_SECRET!,
});
| Chain | Mainnet | Testnet |
|---|---|---|
| Arbitrum | ARB |
ARB-SEPOLIA |
| Arc | ARC |
ARC-TESTNET |
| Avalanche | AVAX |
AVAX-FUJI |
| Base | BASE |
BASE-SEPOLIA |
| Ethereum | ETH |
ETH-SEPOLIA |
| Monad | MONAD |
MONAD-TESTNET |
| OP Mainnet | OP |
OP-SEPOLIA |
| Polygon PoS | MATIC |
MATIC-AMOY |
| Unichain | UNI |
UNI-SEPOLIA |
The references/ examples use Arc Testnet (blockchain: 'ARC-TESTNET'); for Arc mainnet, pass blockchain: 'ARC'. The Arc USDC address 0x3600000000000000000000000000000000000000 is the same on both networks.
| Template | Standard | Template ID | Use Case |
|---|---|---|---|
| Token | ERC-20 | a1b74add-23e0-4712-88d1-6b3009e85a86 |
Fungible tokens, loyalty points |
| NFT | ERC-721 | 76b83278-50e2-4006-8b63-5b1a2a814533 |
Digital collectibles, gaming assets |
| Multi-Token | ERC-1155 | aea21da6-0aa2-4971-9a1a-5098842b1248 |
Mixed fungible/non-fungible tokens |
| Airdrop | N/A | 13e322f2-18dc-4f57-8eed-4bddfc50f85e |
Bulk token distribution |
getContract().data.contract.functionscontract.contractAddress (fallback: contract.address)createContractExecutionTransaction().data.idgetContract().data.contract.deploymentStatusSCP workflows pair two SDK clients:
Write operations use walletsClient.createContractExecutionTransaction(), NOT the SCP client.
view/pure functions) use scpClient.queryContract() and require no gas walletnonpayable/payable functions) use walletsClient.createContractExecutionTransaction() and require a wallet ID with gas fundsname(type1,type2,...) with no spacesEventName(type1,type2,...) with no spacesAll mutating SCP operations require idempotencyKey as a valid UUID v4 string. Use crypto.randomUUID() in Node.js. Non-UUID keys fail with generic API parameter invalid errors.
Contract deployment is asynchronous. The response indicates initiation only. Poll getContract() for deploymentStatus.
Compile Solidity with evmVersion: "paris" or earlier to avoid the PUSH0 opcode. Solidity >= 0.8.20 defaults to Shanghai. Arc and other non-Shanghai chains fail deployment with ESTIMATION_ERROR / Create2: Failed on deploy if bytecode contains PUSH0.
Write operations (contract deployments, executions) follow the same asynchronous state machine as Developer-Controlled Wallets. Poll with walletsClient.getTransaction({ id: txId }) 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.Contract deployment status is tracked separately via scpClient.getContract() using deploymentStatus.
For debugging failed transactions, see Transaction States and Errors.
| Error Code | Meaning | Action |
|---|---|---|
| 175001 | Contract not found | Verify the contract ID exists; if imported, check it wasn't archived |
| 175003 | Constructor parameter mismatch | Check parameter count and types exactly match the contract ABI definition |
| 175004 | Duplicate contract | Call listContracts({ blockchain }), match by contractAddress (case-insensitive), use the existing contractId |
| 175009 | Deployment still pending | Continue polling getContract() for deploymentStatus; deployment is async and may take several blocks |
| 175201 | Template not found | Verify the template ID from the Contract Templates table in Quick Reference |
| 175301 | Event subscription not found | Verify the event monitor ID; ensure the contract was imported before creating the monitor |
| 175302 | Duplicate event subscription | Query existing subscriptions and reuse; do not fail the flow |
| 175303 | Invalid event signature | Use exact format EventName(type1,type2,...) with no spaces; parameter order must match ABI |
| 175402 | Blockchain not supported or deprecated | Check the Supported Blockchains table; SCP is not available on Solana, Aptos, or NEAR |
| 175404 | TEST_API key on mainnet or LIVE_API key on testnet | Match the API key prefix (TEST_API_KEY: or LIVE_API_KEY:) to the target network |
| 177015 | Missing bytecode for contract deployment | Provide compiled bytecode with 0x prefix; compile with evmVersion: "paris" to avoid PUSH0 |
On deployment failure, check deploymentErrorReason and deploymentErrorDetails from getContract().
Deploy a compiled contract using raw ABI + bytecode.
READ references/deploy-bytecode.md for the complete guide.
Deploy audited template contracts without writing Solidity.
READ references/deploy-template.md for the template catalog and deployment guide.
Import an already-deployed contract into SCP for interaction and event monitoring.
READ references/import-contract.md for the complete guide.
Query read functions and execute write functions via ABI signatures.
READ references/interact.md for the complete guide.
Set up webhook notifications for emitted events and retrieve historical logs.
READ references/monitor-events.md for the complete guide.
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.
.gitignore entries for .env*, *.pem, and recovery files when scaffolding.--private-key $KEY). Prefer encrypted keystores or interactive import (e.g., Foundry's cast wallet import).idempotencyKey values across different API requests.walletsClient.createContractExecutionTransaction().deployContract's name field -- alphanumeric only.feeLevel property. ALWAYS use nested fee: { type: 'level', config: { feeLevel: 'MEDIUM' } }.window.ethereum directly with wagmi -- use connector.getProvider().evmVersion: "paris" to avoid PUSH0 opcode.name and idempotencyKey when calling importContract().getContract() for deploymentStatus.0x and match constructor parameter types/order exactly.10n ** 18n, not BigInt(10 ** 18)).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 による自動翻訳です。