Metaboss

Stars Forks Crate Downloads

The Solana Metaplex NFT 'Swiss Army Knife' tool.

Current supported features:

  • Decode the metadata of a token mint account

  • Mint new NFTs from a JSON file

  • Set primary_sale_happened bool on an NFT's metadata

  • Set update_authorty address on an NFT's metadata

  • Verify a creator by signing the metadata accounts for all tokens in a list, for a given candy machine id or a single mint account

  • Get a snapshot of current NFT holders for a given candy machine ID or update authority

  • Get a list of mint accounts for a given candy machine ID or update authority

  • Get a list of all candy machine state and config accounts for a given update authority

  • Update all metadata Data struct fields for a NFT

  • Update just the URI for a NFT

Suggestions and PRs welcome!

Note: This is experimental software for a young ecosystem. Use at your own risk. The author is not responsible for misuse of the software or failing to test specific commands before using on production NFTs.

Binaries

Linux, MacOS and Windows binaries available in releases, thanks to CI work done by Kartik Soneji.

Install From Source

Install Rust.

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

Clone the source:

git clone git@github.com:samuelvanderwaal/metaboss.git

or

git clone https://github.com/samuelvanderwaal/metaboss.git

On Ubuntu you may need some additional packages:

sudo apt install libssl-dev libudev-dev pkg-config

Change directory and check out the main branch:

cd metaboss
git checkout main

Install or build with Rust:

cargo install --path ./

or

cargo build --release

Quick Start

Install

cargo install metaboss

or grab a binary

See Usage

metaboss -h

Decode a mint account's metadata:

metaboss decode mint -a 23gaZq8578xHozMWADsmZ2hAFqZ15iyHmQtRw14meds2

Examples

Update the URI of an existing NFT

metaboss update uri -k ~/.config/solana/devnet.json -a CQNKXw1rw2eWwi812Exk4cKUjKuomZ2156STGRyXd2Mp -u https://arweave.net/N36gZYJ6PEH8OE11i0MppIbPG4VXKV4iuQw1zaq3rls

Mint a new NFT

Prepare a JSON file.

{
    "name": "TestNFT2",
    "symbol": "TNFT",
    "uri": "https://arweave.net/FPGAv1XnyZidnqquOdEbSY6_ES735ckcDTdaAtI7GFw",
    "seller_fee_basis_points": 200,
    "creators": [
        {
            "address": "AVdBTNhDqYgXGaaVkqiaUJ1Yqa61hMiFFaVRtqwzs5GZ",
            "verified": false,
            "share": 50
        },
        {
            "address": "42NevAWA6A8m9prDvZRUYReQmhNC3NtSZQNFUppPJDRB",
            "verified": false,
            "share": 50
        }
    ]
}

Call command. In this case we do not set --receiver so we mint directly to the keypair address.

metaboss mint one -k ~/.config/solana/devnet.json -d ./new_nft.json

Snapshot Candy Machine Mint Accounts

We call the command with no output specified so it creates the file in the current directory.

metaboss snapshot mints -c BHZWQEtGRMs7voC7vDyVQCXawB1P6UvxG899ATGwxmaR

The file BHZWQEtGRMs7voC7vDyVQCXawB1P6UvxG899ATGwxmaR_mint_accounts.json is created with the contents:

[
    "D5ycm2mgBWDR37QVkvM389x84V4ux48bSeHLeiHPtX28",
    "4kYdMRRYtXjmkusgKEBntSXLDhqkHNE57GF3RPdtx6MW",
    "J8xuCFCeBRESoXewtMwrrpVUGikUG3B1WznNdLffyymz",
    "4gRtRjrbD7g5ZKUvSVA1tYMK9LZqz6uWuSc3rKeinySh"
]

Global Options

These are the options that apply to all subcommands and can be passed in at any level.

metaboss <option> <subcommand> <subcommand>
metaboss <subcommand> <option> <subcommand>
metaboss <subcommand> <subcommand> <option>

Options

-r, --rpc The RPC endpoint to use for commands.

Metaboss will try to read your Solana config settings for both the RPC endpoint and also the Commitment setting by reading from $HOME/.config/solana/cli/config.yml. If it can't find a config file it defaults to using https://psytrbhymqlkfrhudd.dev.genesysgo.net:8899/ and confirmed.

Running Metaboss with the --rpc option will override the above with whatever RPC endpoint the user provides.

-t, --timeout The timeout in seconds to use for RPC calls.

This defaults to 90 seconds which should be fine for most cases but can be overriden if needed.

Example:

metaboss snapshot holders -r https://ssc-dao.genesysgo.net/ -t 120 -u DC2mkgwhy56w3viNtHDjJQmc7SGu2QX785bS4aexojwX

Burn

Burn One

Burn a single NFT by burning the SPL token and closing the associated token account. If the keypair is also the NFT update_authority this will set the metadata account to blank/default values.

Usage

metaboss burn one -k <OWNER_KEYPAIR> --account <MINT_ACCOUNT>

Decode

Decode Mint

Decodes a mint account's metadata into a JSON file. It accepts either a single account or a list of accounts.

Usage

metaboss decode mint --account <MINT_ACCOUNT> -o <OUPUT_DIRECTORY>

The command will write the metadata JSON file to the output directory with the mint account as the name: e.g. CQNKXw1rw2eWwi812Exk4cKUjKuomZ2156STGRyXd2Mp.json. The output option defaults to the current directory.

metaboss decode mint --list-file <LIST_FILE> -o <OUPUT_DIRECTORY>

The JSON list file should be an array of mint accounts to be decoded:

["xSy...", "Cnb..." ...]

The command will write each metadata JSON file to the output directory as a separate file with the mint account as the name: e.g. CQNKXw1rw2eWwi812Exk4cKUjKuomZ2156STGRyXd2Mp.json. The output option defaults to the current directory.

As of v0.4.0, the default output will only be the Data struct matching the input format of the update data and update data-all commands. To get the full Metadata struct, use the --full option.

Use --raw to get the account data as raw bytes for debugging purposes.

Derive

Derive Candy Machine V2 Creator

Derive the candy machine creator PDA from the candy machine id.

Usage

metaboss derive cmv2-creator <candy_machine_id>

Derive Edition

Derive the edition PDA from the mint account.

metaboss derive edition <mint_account>

Derive Metadata

Derive the metadata PDA from the mint account.

metaboss derive metadata <mint_account>

Derive PDA

Derive a generic PDA from a list of seeds and a program id.

Usage

metaboss derive pda <seed1>,<seed2>,<seed3> <program_id>

Mint

Mint new NFTs from JSON files.

For both subcommands the --immutable flag sets the NFT data to be immutable and the --primary-sale-happened flag sets the primary sale happened bool to true.

Mint One

Mint a single NFT from a JSON file.

Usage

metaboss mint one --keypair <KEYPAIR> --nft-data-file <PATH_TO_NFT_DATA_FILE> --receiver <RECEIVER_ADDRESS>
metaboss mint one --keypair <KEYPAIR> --external-metadata-uri <EXTERNAL_METADATA_URI> --receiver <RECEIVER_ADDRESS> --immutable --primary-sale-happened

The JSON files should contain all the necessary data required to create an NFT's metadata fields. Creator verified fields must be false unless the creator is also the keypair.

Example JSON file:

{
    "name": "TestNFT1",
    "symbol": "TNFT",
    "uri": "https://arweave.net/FPGAv1XnyZidnqquOdEbSY6_ES735ckcDTdaAtI7GFw",
    "seller_fee_basis_points": 100,
    "creators": [
        {
            "address": "PanbgtcTiZ2PveV96t2FHSffiLHXXjMuhvoabUUKKm8",
            "verified": false,
            "share": 100
        }
    ]
}

The --external-metadata-uri option takes a URI to an external metadata file such as an Arweave link pointing to a JSON file.

If receiver is set, the NFT will be minted directly to the receiver's address, otherwise it is minted to keypair. Observant users may note that with a simple bash script this allows airdrops to be deployed with Metaboss.

Use the --sign option to sign the metadata with the keypair immediately after minting.

Mint List

Mint multiple NFTs from a list of JSON files.

Usage

metaboss mint list --keypair <KEYPAIR> --nft-data-dir <PATH_TO_NFT_DATA_FILE> --receiver <RECEIVER_ADDRESS>

This command functions the same as mint one except instead of a single JSON file, provide a path to a directory with multiple JSON files, one for each NFT to be minted.

metaboss mint list --keypair <KEYPAIR> --external-metadata-uris <PATH_TO_JSON_FILE> --receiver <RECEIVER_ADDRESS> --immutable --primary-sale-happened

To mint from URIs provide the path to a JSON file containing a list of URIs.

By default, new NFTs are minted as mutable, to make them immutable use the --immutable option.

Use the --sign option to sign the metadata with the keypair immediately after minting.

Set

Warning: These commands modify your NFT and are for advanced users. Use with caution.

Set non-Data struct values for a NFT.

Set Primary-Sale-Happened

Set primary_sale_happened to be true.

metaboss set primary-sale-happened --keypair <PATH_TO_KEYPAIR> --account <MINT_ACCOUNT>

Outputs a TxId to the command line so you can check the result.

Set Update-Authority

Set update_authority to a different public key.

metaboss set update-authority --keypair <PATH_TO_KEYPAIR> --account <MINT_ACCOUNT> --new-update-authority <NEW_UPDATE_AUTHORITY>

Set Update-Authority-All

Set update_authority to a different public key for a list of NFTs.

metaboss set update-authority-all --keypair <PATH_TO_KEYPAIR> --mint-accounts-file <PATH_TO_MINT_ACCOUNTS> --new-update-authority <NEW_UPDATE_AUTHORITY>

The mint accounts file should be a JSON file with an array of NFT mint accounts to be updated:

[
    "C2eGm8iQPnKVWxakyo8QhwJUvYrZHKF52DPQuAejpTWG",
    "8GcRqxy4VAocTcAkoxCXkPCEmM36HMtjBc8ZarWhAD6o",
    "CK2npuck3WTRNFXSdZv8YjudJJEa69EVGd6GFfeSzfGP"
]

Set Immutable

Set an NFT's Data struct to be immutable. This is not reversible.

metaboss set immutable --keypair <PATH_TO_KEYPAIR> --account <MINT_ACCOUNT>

Set Immutable-All

Set all NFTs in a list to be immutable. This is not reversible.

metaboss set immutable-all --keypair <PATH_TO_KEYPAIR> --mint-accounts-file <PATH_TO_MINT_ACCOUNTS>

Sign

Warning: These commands modify your NFT and are for advanced users. Use with caution.

Sign metadata for an unverified creator.

Sign One

Sign the metadata for a single mint account.

Usage

metaboss sign one --keypair <PATH_TO_KEYPAIR> --account <MINT_ACCOUNT>

Outputs a TxId to the command line so you can check the result.

Sign All

Sign all metadata from a JSON list or for a given first verified creator. First verified creator can be the candy machine creator id or whatever the first verified creator in the creators array is for your NFTs.

Usage

metaboss sign all --keypair <PATH_TO_KEYPAIR> --creator <FIRST_CREATOR>

For candy machine v2, you can add the --v2 option when using it with the candy machine id. Candy machine v2 has a separate creator id from the candy machine account id.

metaboss sign all --keypair <PATH_TO_KEYPAIR> --creator <CANDY_MACHINE_ID> --v2

or you can use the candy machine creator id which will be the first creator in the creators array.

metaboss sign all --keypair <PATH_TO_KEYPAIR> --creator <CANDY_MACHINE_CREATOR_ID>

With a mint acconts JSON list:

metaboss sign all --keypair <PATH_TO_KEYPAIR> --mint-accounts-file <PATH_TO_MINT_ACCOUNTS_FILE>

For the latter usage, the mint accounts file should be a JSON file with a list of mint accounts to be signed:

[
    "C2eGm8iQPnKVWxakyo8QhwJUvYrZHKF52DPQuAejpTWG",
    "8GcRqxy4VAocTcAkoxCXkPCEmM36HMtjBc8ZarWhAD6o",
    "CK2npuck3WTRNFXSdZv8YjudJJEa69EVGd6GFfeSzfGP"
]

Outputs a TxId to the command line so you can check the result.

Snapshot

Get snapshots of various blockchain states.

Snapshot CM-Accounts

Snapshot all candy machine config and state accounts for a given update_authority.

Usage

metaboss snapshot cm-accounts --update-authority <UPDATE_AUTHORITY> --output <OUTPUT_DIR>

Creates a JSON file in the output directory with the name format of <UPDATE_AUTHORITY>_accounts.json, consisting of an object with the fields config_accounts and candy_machine_accounts:

{
    "config_accounts": [
        {
            "address": "2XBqwwTLf24ACPR3BDSEKCB95PZiAwYySeX1LyN3FKDL",
            "data_len": 1456
        },
        {
            "address": "9tNkktGZhLiWHkc4JhoTYvMLXEVA8qauSVeFwyiRPCsT",
            "data_len": 1216
        }
    ],
    "candy_machine_accounts": [
        {
            "address": "DwoPaGFxJpGRq3kZQBNfBroCGaS9Hdg2rpFHJpD2iBhW",
            "data_len": 529
        },
        {
            "address": "CpFAvcReAkmxWiL7jwDjBKD9jX1Bi1Lky4bHwMkgCuxc",
            "data_len": 529
        }
    ]
}

Snapshot Holders

Snapshot all current holders of NFTs filtered by verified candy_machine_id/first creator or update_authority. Note: Update authority can be faked so use that option with caution.

Usage

metaboss snapshot holders --creator <CREATOR_ADDRESS> -p <POSITION> --output <OUTPUT_DIR>

Use the positon to indicate which creator in the creators array to filter by; defaults to the first one (position 0).

or

metaboss snapshot holders --update-authority <UPDATE_AUTHORITY> --output <OUTPUT_DIR>

For candy machine v2, you can add the --v2 option when using it with candy machine id. Candy machine v2 has a separate creator id from the candy machine account id.

metaboss snapshot holders --creator <CANDY_MACHINE_ID> --v2 --output <OUTPUT_DIR>

where <CANDY_MACHINE_ID> is the candy machine id retrieved from the cache file.

Creates a JSON file in the output directory with the name format of <CREATOR/UPDATE_AUTHORITY>_holders.json consisting of an array of objects with the following fields:

  • owner wallet -- the holder of the token
  • associated token account -- the token account the NFT is stored at
  • mint account -- the token mint account for the NFT
  • metadata account -- the metadata account decorating the mint account that defines the NFT

Example file:

[
    {
        "owner_wallet": "42NevAWA6A8m9prDvZRUYReQmhNC3NtSZQNFUppPJDRB",
        "associated_token_address": "7yGA66LYDU7uoPW2x9jrUKaDWTs9jqZ5cSNKR1VaLQdw",
        "mint_account": "C2eGm8iQPnKVWxakyo8QhwJUvYrZHKF52DPQuAejpTWG",
        "metadata_account": "8WTA3sLxwRNDKHxZFbn2CFo3FX1ZP59EqrvuDPLbmmWV"
    }
]

Snapshot Mints

Snapshot all mint accounts for a given verified candy machine id/first creator or update authority

Usage

metaboss snapshot mints --creator <FIRST_CREATOR> --output <OUTPUT_DIR>

Use the positon to indicate which creator in the creators array to filter by; defaults to the first one (position 0).

or

metaboss snapshot mints --update-authority <UPDATE_AUTHORITY> --output <OUTPUT_DIR>

For candy machine v2, you can add the --v2 option when using it with candy machine id. Candy machine v2 has a separate creator id from the candy machine account id.

metaboss snapshot mints --creator <CANDY_MACHINE_ID> --v2 --output <OUTPUT_DIR>

where <CANDY_MACHINE_ID> is the candy machine id retrieved from the cache file.

Creates a JSON file in the output directory with the name format of <CANDY_MACHINE_ID/UPDATE_AUTHORITY>_mint_accounts.json consisting of an array of mint accounts.

[
    "CQNKXw1rw2eWwi812Exk4cKUjKuomZ2156STGRyXd2Mp",
    "5pgGJ5npeMxBzTiQctDgoofEVGSwZMYm3QMz4F4NDShz",
    "8GcRqxy4VAocTcAkoxCXkPCEmM36HMtjBc8ZarWhAD6o"
]

Update

Warning: These commands modify your NFT and are for advanced users. Use with caution.

Update various aspects of an NFT.

Update Data

Update the Data struct on a NFT from a JSON file.

Usage

metaboss update data --keypair <PATH_TO_KEYPAIR> --account <MINT_ACCOUNT> --new-data-file <PATH_TO_NEW_DATA_FILE>

The JSON file should include all the fields of the metadata Data struct and should match creator verified bools for existing creators. E.g. if your NFT was minted by the Metaplex Candy Machine program, and you wish to keep your candy machine as a verified creator you must add the candy machine to your creators array with verified set to true.

Note: The on-chain Data struct is different than the external metadata stored at the link in the uri field so make you understand the difference before running this command.

Make sure you understand how the Metaplex Metadata Data struct works and how this command will affect your NFT. Always test on devnet before running on mainnet.

{
    "name": "FerrisCrab #4",
    "symbol": "FERRIS",
    "uri": "https://arweave.net/N36gZYJ6PEH8OE11i0MppIbPG4VXKV4iuQw1zaq3rls",
    "seller_fee_basis_points": 100,
    "creators": [
        {
            "address": "<YOUR_CANDY_MACHINE_ID>",
            "verified": true,
            "share": 0
        },
        {
            "address": "<KEYPAIR_CREATOR>",
            "verified": true,
            "share": 50
        },
        {
            "address": "42NevAWA6A8m9prDvZRUYReQmhNC3NtSZQNFUppPJDRB",
            "verified": false,
            "share": 50
        }
    ]
}

Outputs a TxId to the command line so you can check the result.

Update Data All

Update the Data struct on a list of NFTs from JSON files.

Usage

metaboss update data-all --keypair <PATH_TO_KEYPAIR> --data-dir <PATH_TO_DATA_DIR>

Each JSON file in the data directory should include the mint account and all the fields of the metadata Data struct and should match creator verified bools for existing creators. E.g. if your NFT was minted by the Metaplex Candy Machine program, and you wish to keep your candy machine as a verified creator you must add the candy machine to your creators array with verified set to true.

Note: The on-chain Data struct is different than the external metadata stored at the link in the uri field so make you understand the difference before running this command.

Make sure you understand how the Metaplex Metadata Data struct works and how this command will affect your NFT. Always test on devnet before running on mainnet.

{
    "mint_account": "CQNKXw1rw2eWwi812Exk4cKUjKuomZ2156STGRyXd2Mp",
    "nft_data":
    {
    "name": "FerrisCrab #4",
    "symbol": "FERRIS",
    "uri": "https://arweave.net/N36gZYJ6PEH8OE11i0MppIbPG4VXKV4iuQw1zaq3rls",
    "seller_fee_basis_points": 100,
    "creators": [
        {
            "address": "<YOUR_CANDY_MACHINE_ID>",
            "verified": true,
            "share": 0
        },
        {
            "address": "<KEYPAIR_CREATOR>",
            "verified": true,
            "share": 50
        },
        {
            "address": "42NevAWA6A8m9prDvZRUYReQmhNC3NtSZQNFUppPJDRB",
            "verified": false,
            "share": 50
        }
    ]}
}

Outputs a TxId to the command line so you can check the result.

Update Name

Update the on-chain name of a NFT, keeping the rest of the Data struct the same.

Usage

 metaboss update name --keypair <PATH_TO_KEYPAIR> --account <MINT_ACCOUNT> --new-name <NEW_NAME>

Update Symbol

Update the on-chain symbol of a NFT, keeping the rest of the Data struct the same.

Usage

 metaboss update name --keypair <PATH_TO_KEYPAIR> --account <MINT_ACCOUNT> --new-symbol <NEW_SYMBOL>

Update Creators

Update the creators of a NFT, keeping the rest of the Data struct the same.

Usage

metaboss update creators -k <PATH_TO_KEYPAIR> -a <MINT_ACCOUNT> -c <CREATOR1:SHARE:VERIFIED,CREATOR2:SHARE:VERIFIED>

Creators should be a comma-delimited list of creator:share:verified. E.g.

Example:

metaboss update creators -k ~/.config/solana/devnet.json -a 4rxTT8pKeYFrFgNBgTspBWVEnMnsAZGwChkjRUtP4Xpi -c 42NevAWA6A8m9prDvZRUYReQmhNC3NtSZQNFUppPJDRB:70:false,AVdBTNhDqYgXGaaVkqiaUJ1Yqa61hMiFFaVRtqwzs5GZ:30:false

Using the --append flag will set the shares to 0 and append to the existing creators list, otherwise the creators are overwritten with the list you pass in.

Update URI

Update the metadata URI, keeping the rest of the Data struct the same.

Usage

metaboss update uri --keypair <PATH_TO_KEYPAIR> --account <MINT_ACCOUNT> --new-uri <NEW_URI>

Update URI All

Update the metadata URI for a list of mint accounts, keeping the rest of the Data struct the same.

Usage

metaboss update uri-all --keypair <PATH_TO_KEYPAIR> --json-file <PATH_TO_JSON_FILE>
[
    {
        "mint_account": "xZ43...",
        "new_uri": "https://arweave.net/N36gZYJ6PEH8OE11i0MppIbPG4VXKV4iuQw1zaq3rls"
    },
        {
        "mint_account": "71bk...",
        "new_uri": "https://arweave.net/FPGAv1XnyZidnqquOdEbSY6_ES735ckcDTdaAtI7GFw"
    }
]

Withdraw

CM-V2

Withdraw all funds from a candy machine v2 account.

Warning: This command will drain your candy machine account and cause it to be garbage collected. Any unminted NFT items will be lost.

Usage

metaboss withdraw cm-v2 <CANDY_MACHINE_ID> -k <PATH_TO_KEYPAIR>

Example:

metaboss withdraw cm-v2 C2eGm8iQPnKVWxakyo8QhwJUvYrZHKF52DPQuAejpTWG -k ./keypair.json

Contact

Email: sam@vanderwaal.dev

Twitter: @samvwaal

Discord:

@archaeopteryx#7615

Metaboss Discord Server