Skip to Content
DocumentationTokensCreate Token Mint

Create Token Mint

Creates a new SPL token mint with specified parameters.

Returns: Promise<Address>

Options

  • mintAuthority: KeyPairSigner - Authority that can mint new tokens
  • decimals: number - Number of decimal places for the token
  • name: string (optional) - Name of the token (required if useTokenExtensions is true)
  • symbol: string (optional) - Symbol of the token (required if useTokenExtensions is true)
  • uri: string (optional) - URI pointing to the token’s metadata (eg: “https://arweave.net/abc123 ”) (required if useTokenExtensions is true)
  • additionalMetadata: Record<string, string> | Map<string, string> (optional) - Additional metadata fields (default: )
  • useTokenExtensions: boolean (optional) - Use Token Extensions (Token-2022) program instead of classic Token program (default: true)

Examples

Create a token with Token Extensions (Token-2022) and additional metadata:

const mintAddress = await connection.createTokenMint({ mintAuthority: wallet, decimals: 9, name: "My Token", symbol: "TKN", uri: "https://example.com/token-metadata.json", additionalMetadata: { description: "A sample token", website: "https://example.com", }, });

Create a classic SPL token without metadata:

const mintAddress = await connection.createTokenMint({ mintAuthority: wallet, decimals: 9, useTokenExtensions: false, });

A metadata.json file, and any images inside, should be hosted at a decentralized storage service . The file itself is at minimum:

{ "image": "https://raw.githubusercontent.com/solana-developers/opos-asset/main/assets/CompressedCoil/image.png" }

Images should be square, and either 512x512 or 1024x1024 pixels, and less than 100kb if possible.

See also: Get Token Account Address, Mint Tokens, Get Mint

Last updated on