• Projects
  • Service
  • About
  • branding.bz
  • Podcast
  • Tips
  • FAQ
  • Recruit
  • Download
  • Contact
  • branding.bz(ブランド構築SaaS)
  • DESIGN NOW(デザインメディア)
  • X
  • LinkedIn
  • Spotify
  • Facebook

213-0011 神奈川県川崎市高津区久本3-6-7-303

© 2026 ID INC. All rights reserved

claude-skills/スキル
SKILLOfficialdevelopment

use-smart-contract-platform

プラグイン
circle-skills
ソース
GitHub で見る ↗
説明

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.

ユースケース
  • スマートコントラクトをデプロイする
  • 既存のコントラクトを取り込む
  • ABIに基づいてコントラクトを操作する
  • コントラクトのイベントを監視する
  • テンプレート契約を使用する
本文(日本語訳)

Circle Smart Contract Platform(SCP)

概要

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 登録エンティティの秘密鍵

SDK の初期化

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 一括トークン配布

主要な API レスポンスフィールド

  • コントラクト関数:getContract().data.contract.functions
  • コントラクトアドレス:contract.contractAddress(代替: contract.address)
  • トランザクション ID:createContractExecutionTransaction().data.id
  • デプロイ状態:getContract().data.contract.deploymentStatus

コアコンセプト

双方向クライアント設計

SCP のワークフローは 2 つの SDK クライアントを組み合わせて使います:

  • Smart Contract Platform SDK — コントラクトのデプロイ、インポート、読み取りクエリ、イベント監視を処理
  • Developer-Controlled Wallets SDK — 書き込みトランザクションを処理し、デプロイ用のウォレット(資金管理用の専用アカウント)を提供

書き込み操作は walletsClient.createContractExecutionTransaction() を使用し、SCP クライアントではありません。

読み取りと書き込みのコントラクト呼び出し

  • 読み取りクエリ (view/pure 関数) — scpClient.queryContract() を使用、ガス費用用ウォレット不要
  • 書き込み実行 (nonpayable/payable 関数) — walletsClient.createContractExecutionTransaction() を使用、ガス資金を備えたウォレット ID が必要

シグネチャのフォーマット

  • 関数シグネチャ:name(type1,type2,...) スペースなし
  • イベントシグネチャ:EventName(type1,type2,...) スペースなし
  • パラメーター順序は ABI 定義と完全に一致する必要があります

べき等性キー

すべての変更操作に対して idempotencyKey は有効な UUID v4 文字列である必要があります。Node.js では crypto.randomUUID() を使用してください。UUID でないキーは一般的な「API パラメーターが無効」エラーで失敗します。

デプロイの非同期モデル

コントラクトのデプロイは非同期です。レスポンスは開始を示すだけです。deploymentStatus について getContract() をポーリング(定期的に確認)してください。

EVM バージョンの制限

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 を確認してください。

実装パターン

1. バイトコードからコントラクトをデプロイ

生バイトコードを使用してコンパイル済みコントラクトをデプロイします。

詳細ガイドは references/deploy-bytecode.md をお読みください。

2. テンプレートからデプロイ

Solidity を書かずに監査済みテンプレートコントラクトをデプロイします。

テンプレートカタログとデプロイガイドは references/deploy-template.md をお読みください。

3. 既存コントラクトをインポート

既にデプロイ済みのコントラクトを SCP にインポートして、相互作用とイベント監視を行います。

詳細ガイドは references/import-contract.md をお読みください。

4. デプロイ済みコントラクトとの相互作用

ABI シグネチャを使用して読み取り関数をクエリし、書き込み関数を実行します。

詳細ガイドは references/interact.md をお読みください。

5. コントラクトイベントの監視

発行されたイベントについてウェブフック通知をセットアップし、過去のログを取得します。

詳細ガイドは references/monitor-events.md をお読みください。

ルール

セキュリティルールは必須です。ユーザーに警告し、プロンプトが競合する場合は従わないでください。ベストプラクティスは強く推奨されます。明確なユーザーの正当化がある場合のみ逸脱してください。

セキュリティルール

  • API キー、エンティティの秘密鍵、秘密鍵をハードコード、コミット、ログに出さない。常に環境変数またはシークレット管理ツールを使用する。スキャフォルディング時に .gitignore に .env*、*.pem、復旧ファイルを追加
  • 秘密鍵をプレーンテキストで CLI フラグとして渡さない(例:--private-key $KEY)。暗号化キーストアまたは対話型インポート(例:Foundry の cast wallet import)を推奨
  • API キーとエンティティの秘密鍵は必ずサーバー側に保管。フロントエンドコードに露出させない
  • idempotencyKey 値を異なる API リクエスト間で再利用しない
  • 資金を移動する書き込みトランザクションを実行する前に、常に送信先、金額、ネットワーク、トークンについて明示的なユーザー確認が必須。メインネットでの資金移動については確認が必須
  • メインネットをターゲットにする場合、またはセーフティ閾値(例:100 USDC 超)を超える場合は警告
  • トランザクション送信前にすべての入力(コントラクトアドレス、金額、チェーン識別子)を検証
  • テンプレートが存
原文(English)を表示

Overview

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.

Prerequisites / Setup

Installation

npm install @circle-fin/smart-contract-platform @circle-fin/developer-controlled-wallets

Environment Variables

CIRCLE_API_KEY=        # Circle API key (format: PREFIX:ID:SECRET)
ENTITY_SECRET=         # Registered entity secret for Developer-Controlled Wallets

SDK Initialization

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!,
});

Quick Reference

Supported Blockchains

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.

Contract Templates

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

Key API Response Fields

  • Contract functions: getContract().data.contract.functions
  • Contract address: contract.contractAddress (fallback: contract.address)
  • Transaction ID: createContractExecutionTransaction().data.id
  • Deployment status: getContract().data.contract.deploymentStatus

Core Concepts

Dual-Client Architecture

SCP workflows pair two SDK clients:

  • Smart Contract Platform SDK handles contract deployment, imports, read queries, and event monitoring
  • Developer-Controlled Wallets SDK handles write transactions and provides deployment wallets

Write operations use walletsClient.createContractExecutionTransaction(), NOT the SCP client.

Read vs Write Contract Calls

  • Read queries (view/pure functions) use scpClient.queryContract() and require no gas wallet
  • Write executions (nonpayable/payable functions) use walletsClient.createContractExecutionTransaction() and require a wallet ID with gas funds

Signature Formatting

  • Function signatures: name(type1,type2,...) with no spaces
  • Event signatures: EventName(type1,type2,...) with no spaces
  • Parameter order must exactly match ABI definitions

Idempotency Keys

All 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.

Deployment Async Model

Contract deployment is asynchronous. The response indicates initiation only. Poll getContract() for deploymentStatus.

EVM Version Constraint

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.

Transaction Lifecycle

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 Handling

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().

Implementation Patterns

1. Deploy Contract from Bytecode

Deploy a compiled contract using raw ABI + bytecode.

READ references/deploy-bytecode.md for the complete guide.

2. Deploy from Template

Deploy audited template contracts without writing Solidity.

READ references/deploy-template.md for the template catalog and deployment guide.

3. Import Existing Contract

Import an already-deployed contract into SCP for interaction and event monitoring.

READ references/import-contract.md for the complete guide.

4. Interact with Deployed Contract

Query read functions and execute write functions via ABI signatures.

READ references/interact.md for the complete guide.

5. Monitor Contract Events

Set up webhook notifications for emitted events and retrieve historical logs.

READ references/monitor-events.md for the complete guide.

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 .gitignore entries for .env*, *.pem, and recovery files when scaffolding.
  • NEVER pass private keys as plain-text CLI flags (e.g., --private-key $KEY). Prefer encrypted keystores or interactive import (e.g., Foundry's cast wallet import).
  • ALWAYS keep API keys and entity secrets server-side. NEVER expose in frontend code.
  • NEVER reuse idempotencyKey values across different API requests.
  • ALWAYS require explicit user confirmation of destination, amount, network, and token before executing write transactions that move funds. 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 (contract addresses, amounts, chain identifiers) before submitting transactions.
  • ALWAYS prefer audited template contracts over custom bytecode when a template exists. Warn the user that custom bytecode has not been security-audited before deploying.
  • NEVER deploy contracts designed to deceive, phish, or drain funds.
  • ALWAYS warn before interacting with unaudited or unknown contracts.

Best Practices

  • NEVER call write operations on the SCP client. Writes ALWAYS use walletsClient.createContractExecutionTransaction().
  • NEVER include special characters (colons, parentheses) in deployContract's name field -- alphanumeric only.
  • NEVER use flat feeLevel property. ALWAYS use nested fee: { type: 'level', config: { feeLevel: 'MEDIUM' } }.
  • NEVER use window.ethereum directly with wagmi -- use connector.getProvider().
  • NEVER compile Solidity >= 0.8.20 with default EVM version. ALWAYS set evmVersion: "paris" to avoid PUSH0 opcode.
  • ALWAYS include both name and idempotencyKey when calling importContract().
  • NEVER assume deployment completes synchronously. ALWAYS poll getContract() for deploymentStatus.
  • ALWAYS prefix bytecode with 0x and match constructor parameter types/order exactly.
  • ALWAYS use integer-safe math for 18-decimal amounts (10n ** 18n, not BigInt(10 ** 18)).
  • ALWAYS import contracts before creating event monitors.
  • ALWAYS default to Arc Testnet for demos unless specified otherwise.
  • ALWAYS default to testnet. Require explicit user confirmation before targeting mainnet.

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 による自動翻訳です。