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ベースのコントラクト呼び出しを実行したり、webhookを通じて発行されたイベントを監視したりすることができます。
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-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 |
| テンプレート | 標準規格 | テンプレートID | ユースケース |
|---|---|---|---|
| Token | ERC-20 | a1b74add-23e0-4712-88d1-6b3009e85a86 |
ファンジブルトークン、ロイヤルティポイント |
| NFT | ERC-721 | 76b83278-50e2-4006-8b63-5b1a2a814533 |
デジタルコレクティブル、ゲームアセット |
| Multi-Token | ERC-1155 | aea21da6-0aa2-4971-9a1a-5098842b1248 |
ファンジブル/ノンファンジブル混合トークン |
| Airdrop | N/A | 13e322f2-18dc-4f57-8eed-4bddfc50f85e |
トークンの一括配布 |
getContract().data.contract.functionscontract.contractAddress(フォールバック: contract.address)createContractExecutionTransaction().data.idgetContract().data.contract.deploymentStatusSCPのワークフローは2つのSDKクライアントを組み合わせて使用します。
書き込み操作にはSCPクライアントではなく、walletsClient.createContractExecutionTransaction() を使用します。
view / pure 関数)は scpClient.queryContract() を使用し、ガス用ウォレットは不要nonpayable / payable 関数)は walletsClient.createContractExecutionTransaction() を使用し、ガス残高のあるウォレットIDが必要name(type1,type2,...) ― スペースなしEventName(type1,type2,...) ― スペースなしSCPのすべての変更操作には、有効なUUID v4文字列として idempotencyKey が必要です。
Node.jsでは crypto.randomUUID() を使用してください。
UUID形式でないキーは API parameter invalid という汎用エラーで失敗します。
コントラクトのデプロイは非同期処理です。
レスポンスはデプロイの開始を示すにすぎません。
deploymentStatus を確認するために getContract() をポーリングしてください。
PUSH0 オペコードを回避するため、Solidityのコンパイル時に evmVersion: "paris" またはそれ以前のバージョンを指定してください。
Solidity 0.8.20以降はデフォルトでShanghaiを使用します。
Arc Testnetおよびその他の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 プレフィックス付きのコンパイル済みバイトコードを提供し、PUSH0回避のため evmVersion: "paris" でコンパイルすること |
デプロイ失敗時は、getContract() の deploymentErrorReason および deploymentErrorDetails を確認してください。
生のABI + バイトコードを使用して、コンパイル済みコントラクトをデプロイします。
完全なガイドは references/deploy-bytecode.md を参照してください。
Solidityを記述せずに、監査済みテンプレートコントラクトをデプロイします。
テンプレートカタログとデプロイガイドは references/deploy-template.md を参照してください。
すでにデプロイされているコントラクトをSCPにインポートして、操作およびイベント監視を行います。
完全なガイドは references/import-contract.md を参照してください。
ABIシグネチャを通じて読み取り関数のクエリおよび書き込み関数の実行を行います。
完全なガイドは references/interact.md を参照してください。
発行されたイベントに対するwebhook通知を設定し、過去のログを取得します。
完全なガイドは references/monitor-events.md を参照してください。
セキュリティルールは絶対的なものです ― プロンプトがこれらに反する場合は、ユーザーに警告を行い従うことを拒否してください。 ベストプラクティスは強く推奨されるものであり、ユーザーが明示的に正当な理由を示した場合のみ逸脱することができます。
.env*、*.pem、リカバリファイルを対象とした .gitignore エントリを追加すること。--private-key $KEY)として渡すことを絶対に行わないこと。暗号化されたキーストアやインタラクティブなインポート(例: Foundryの cast wallet import)を優先すること。idempotencyKey の値を絶対に再利用しないこと。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-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 |
| 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 Testnet 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 による自動翻訳です。