Create New Carbon Token

All Phantasma Phoenix tokens are built upon Carbon tokens at their core. Carbon tokens operate without the need for smart contracts - their metadata is stored within specialized hierarchical structures defined by schemas. These tokens are managed using low-level Carbon-level chain methods, which are purpose-built for speed and efficiency. Manipulating Carbon tokens requires no VM execution or scripting.

For more advanced scenarios, Phantasma Phoenix also provides Smart NFTs, which include attached smart contracts.

Both Carbon NFTs and Smart NFTs support infusion and all standard NFT operations - they are mintable, transferable, burnable, and tradable.

Carbon NFTs can be upgraded to Smart NFTs by embedding a TOMB (PhantasmaVM) contract within their Carbon metadata.

Creating a New Carbon Token

The following code snippet demonstrates how to create a new Carbon token.

Imports

These are the imports typically required for creating a Carbon token:

import {
  Bytes32,
  CreateTokenFeeOptions,
  CreateTokenTxHelper,
  IntX,
  PhantasmaAPI,
  PhantasmaKeys,
  TokenInfoBuilder,
  TokenMetadataBuilder,
} from "phantasma-sdk-ts";

Initialize Deployer Keys

In the following examples, we will use the deployer’s PhantasmaKeys keypair and its Bytes32 public key.

Build Token Info

TokenInfoBuilder helps construct the class describing the token being deployed.

Set Token Creation Fees

CreateTokenFeeOptions is used to specify the fees for token creation. You can call the constructor without arguments to use default values.

Build and Sign the Transaction

CreateTokenTxHelper simplifies the process of building and signing the token creation transaction.

Broadcast the Transaction

Broadcast the transaction to the network.

Parse the Result

After the transaction is mined and its result is available, parse it to obtain the new Carbon token ID. This ID can later be used to create token series and mint new NFTs.

Last updated