CLI utility for deploying Carbon fungible tokens and NFTs on the Phantasma blockchain. The tool consumes structured metadata and token schemas defined in TOML configuration files and relies on the latest phantasma-sdk-ts builders for serialization.
- Three primary actions:
--create-token,--create-series,--mint-nft. - Configuration-first workflow: fill in
config.toml(JSON blobs embedded in TOML) and let the CLI generate and submit Carbon transactions. - Dry-run mode available for payload inspection without broadcasting.
# install dependencies
npm install
# copy the sample configuration and adjust it to your needs
cp config/config.example.toml config.toml
# build the CLI
npm run build
# run an action (uses config.toml by default)
npm start -- --create-tokenHelper just recipes are available (just ct, just cs, just mn, etc.) if you have just installed.
All configuration is read from config.toml (or an alternate file passed via --config). CLI flags remain available for overrides, but the recommended flow is to edit config.toml and keep secrets outside of version control.
Key sections in config/config.example.toml:
-
Connection
rpc,nexus,wif.wifmay be left empty for dry runs. -
Token definition
symbol,token_type("nft"or"fungible"), optionaltoken_max_supply/fungible_max_supplyandfungible_decimals(mandatory for fungible tokens), optionalrom(hex string) for Carbon token ROM. -
Carbon identifiers
carbon_token_id(required for series creation or minting against an existing token) andcarbon_token_series_id(required for minting). -
Metadata blobs
Each metadata block is a multi-line JSON string embedded in TOML:token_metadata = """ { "name": "My test token!", "icon": "data:image/svg+xml;base64,...", "url": "https://example.com", "description": "Token description", "extraField": "Optional custom data" } """
token_metadatais mandatory for all tokens. Required fields:name,icon,url,description.
Theiconmust be a base64 encoded data URI (data:image/png;base64,...,data:image/jpeg;base64,..., ordata:image/svg+xml;base64,...).series_metadata(optional) defines shared metadata for NFT series. Populate when metadata should be stored once at the series level.nft_metadata(optional) defines per-instance defaults for minting. You can override fields per mint by editing this block before running--mint-nft.- Numeric settings such as
royaltiesshould be plain numbers (e.g.10000000for 1%).
-
Token schemas
token_schemasis a JSON object describing the Carbon VM schemas used for series metadata, NFT ROM, and NFT RAM. Example structure:token_schemas = """ { "seriesMetadata": [ { "name": "extraSharedSampleField", "type": "String" } ], "rom": [ { "name": "name", "type": "String" }, { "name": "description", "type": "String" }, { "name": "imageURL", "type": "String" }, { "name": "infoURL", "type": "String" }, { "name": "royalties", "type": "Int32" }, { "name": "extraSampleField", "type": "String" } ], "ram": [] } """
Rules enforced by the SDK:
-
Mandatory fields
name,description,imageURL,infoURL,royaltiesmust appear either inseriesMetadata(shared) or inrom(per NFT); the builder fills core structural fields such as the Carbonid,mode, andromplaceholders automatically. -
Field
typevalues must matchVmTypenames understood by the SDK. Supported values:Dynamic Array Bytes Struct Int8 Int16 Int32 Int64 Int256 Bytes16 Bytes32 Bytes64 String Array_Dynamic Array_Bytes Array_Struct Array_Int8 Array_Int16 Array_Int32 Array_Int64 Array_Int256 Array_Bytes16 Array_Bytes32 Array_Bytes64 Array_String -
Leave
ramempty ([]) to use a dynamic RAM schema; provide field definitions if you need strict RAM layout.
-
-
Limits and fees
create_token_max_data,create_token_series_max_data,mint_token_max_data,gas_fee_*entries are numeric boundaries passed to the transaction helpers. The bundled defaults are tuned for typical deployments and are a safe starting point; change them only if you know you need higher caps or different fee multipliers. -
Runtime flags
dry_runtoggles dry-run mode when set totruein TOML.config_pathis automatically injected when you load a custom file via--config.
Ensure every value present in config.example.toml is reviewed and updated (or deliberately left as default) before sending real transactions.
Each action reads the active configuration, prints a summary (without exposing your WIF), and either broadcasts or exits depending on --dry-run.
-
Create a token
npm start -- --create-token --config path/to/config.toml
Requirements:
token_typemust be set (nftorfungible).- For fungible tokens provide
token_max_supply/fungible_max_supplyandfungible_decimals. token_metadataand (for NFTs)token_schemasmust be present.
-
Create an NFT series
npm start -- --create-series --config path/to/config.toml
Requirements:
carbon_token_idreferencing the deployed token.token_schemas.seriesMetadatadescribing the shared schema used for the series.- Optional metadata comes from
series_metadata.
-
Mint an NFT
npm start -- --mint-nft --config path/to/config.toml
Requirements:
carbon_token_idandcarbon_token_series_id.token_schemas.romto drive ROM serialization.nft_metadatacontaining per-instance values.
Append --dry-run to any command to inspect the serialized payload without submitting it:
npm start -- --create-token --dry-runAction selectors (first match wins):
--create-token--create-series--mint-nft
Common utility flags:
--config <path>– load an alternate TOML file.--dry-run– skip broadcasting even if the config hasdry_run = false.
Configuration overrides (values override config.toml when provided):
--rpc <url>– RPC endpoint.--nexus <nexus>– nexus name.--wif <wif>– signer WIF.--symbol <symbol>– token symbol.--token-type <nft|fungible>– token kind.--token-max-supply <number>/--fungible-max-supply <number>– maximum supply.--fungible-decimals <number>– decimals for fungible token.--carbon-token-id <id>– existing Carbon token id.--carbon-token-series-id <id>– existing Carbon series id.--rom <hex>– token ROM as hex string.--token-schemas '<json>'– inline JSON for schemas.--token-metadata '<json>'– inline JSON for token metadata.--series-metadata '<json>'– inline JSON for series metadata.--nft-metadata '<json>'– inline JSON for NFT metadata.--create-token-max-data <number>– payload limit for token creation.--create-token-series-max-data <number>– payload limit for series creation.--mint-token-max-data <number>– payload limit for minting.--gas-fee-base <number>– base gas fee.--gas-fee-create-token-base <number>– gas fee for token creation.--gas-fee-create-token-symbol <number>– symbol registration fee.--gas-fee-create-token-series <number>– fee for series creation.--gas-fee-multiplier <number>– multiplier applied to gas fee.
Notes:
- JSON arguments must be passed as single-line quoted strings; for substantial edits, updating
config.tomlis usually more convenient. - Unknown flags are ignored by the loader; prefer editing the TOML file for long-lived configuration changes.