機能
Core Collectionの作成
Last updated April 8, 2026
createCollection命令は、名前、メタデータURI、オプションのプラグインを持つ新しいCore CollectionアカウントをSolana上に作成します。
学習内容
- 名前とURIを使ったシンプルなCollectionの作成
- Royaltiesプラグインを付与したCollectionの作成
- よくある作成エラーの対処法
Summary
createCollectionは、Core Assetを共有メタデータとプラグインの下にグループ化する新しいCollectionアカウントをデプロイします。
- collectionアドレスとして新しいキーペアが必要です — 既存のアドレスを再利用すると失敗します
- 作成時にオプションのプラグインを指定できます
- レントとして約0.0015 SOLが必要です
- デフォルトでPayerが
updateAuthorityになります
Quick Start
- インストール:
npm install @metaplex-foundation/mpl-core @metaplex-foundation/umi - コレクションメタデータJSONをアップロードしてURIを取得
createCollection(umi, { collection, name, uri })を呼び出す- Assetを作成する際にcollectionアドレスを渡す
ジャンプ: シンプルなCollection · プラグインあり · エラー対処
前提条件
- signerとRPC接続が設定されたUmi — JavaScript SDKを参照
- トランザクション手数料用のSOL(Collection1つあたり約0.002 SOL)
- ArweaveまたはIPFSにアップロードされたコレクション画像と名前を含むメタデータJSON
シンプルなCollectionの作成
createCollectionにはname、メタデータuri、そしてcollection signerとして新しいキーペアが必要です。
1import { createUmi } from '@metaplex-foundation/umi-bundle-defaults'
2import { createCollection } from '@metaplex-foundation/mpl-core'
3import { mplCore } from '@metaplex-foundation/mpl-core'
4import { generateSigner } from '@metaplex-foundation/umi'
5
6// Initialize UMI
7const umi = createUmi('https://api.devnet.solana.com')
8 .use(mplCore())
9
10// Generate a new keypair for the collection
11const collectionSigner = generateSigner(umi)
12
13// Create a new Collection
14await createCollection(umi, {
15 collection: collectionSigner,
16 name: 'My Collection',
17 uri: 'https://example.com/collection.json',
18}).sendAndConfirm(umi)
19
20console.log('Collection created:', collectionSigner.publicKey)
collectionパラメータは毎回新しいキーペアである必要があります。既存のアカウントアドレスを再利用するとCollection account already existsエラーが発生します。
プラグインを付与したCollectionの作成
createCollectionにplugins配列を渡すことで、作成時にプラグインを付与できます。以下の例ではRoyaltiesプラグインを付与しています。
Royaltiesプラグインを付与したCore Collectionの作成
create-collection-with-royalties.ts
import { generateSigner, publicKey } from '@metaplex-foundation/umi'
import { createCollection, ruleSet } from '@metaplex-foundation/mpl-core'
const collectionSigner = generateSigner(umi)
const creator1 = publicKey('11111111111111111111111111111111')
const creator2 = publicKey('22222222222222222222222222222222')
await createCollection(umi, {
collection: collectionSigner,
name: 'My NFT',
uri: 'https://example.com/my-nft.json',
plugins: [
{
type: 'Royalties',
basisPoints: 500,
creators: [
{ address: creator1, percentage: 20 },
{ address: creator2, percentage: 80 },
],
ruleSet: ruleSet('None'),
},
],
}).sendAndConfirm(umi)
よくあるエラー
Collection account already exists
このネットワークでcollectionキーペアが既に使用されています。毎回新しいsignerを生成してください:
const collectionSigner = generateSigner(umi) // 一意のキーペアであること
Insufficient funds
Payerウォレットに約0.002 SOLが必要です。Devnetでは以下でチャージできます:
solana airdrop 1 <WALLET_ADDRESS> --url devnet
Notes
- 作成時に追加したプラグインは後から
updateCollectionPluginで更新できます — Collectionの更新を参照 updateAuthorityはデフォルトでPayerになります — 別のアカウントに設定するには明示的にupdateAuthorityを渡してください- Assetに利用可能なすべてのプラグインはCollectionにも適用できます — プラグイン概要を参照
Quick Reference
| 項目 | 値 |
|---|---|
| Instruction | CreateCollectionV1 |
| JS関数 | createCollection |
| 必須アカウント | collection(新しいキーペア)、payer |
| オプションアカウント | updateAuthority、systemProgram |
| 必須引数 | name、uri |
| オプション引数 | plugins |
| レントコスト | 約0.0015 SOL |
| ソース | GitHub |
