Metaboss was made to help out users to interact with their tokens and its main functionalities allow to get data from nonfungible tokens and even update them. We will begin by installing the program and then proceed to use several of its commands and features.
To install you can copy paste the following command into your terminal.
bash <(curl -sSf https://raw.githubusercontent.com/samuelvanderwaal/metaboss/main/scripts/install.sh)
//Result
✅ Installation successful: type 'metaboss' to start using it.
In case any errors occur, here are some helpful programs to install that will help you fix them.
Macos
brew install openssl@3
Ubuntu
sudo apt install libssl-dev libudev-dev pkg-config
In this section we will be exploring some of the different uses for Metaboss. We will begin by looking at the different methods that we have avaiable by using:
metaboss -h
//Result
Metaboss 0.8.4
Metaplex NFT 'Swiss Army Knife' tool.
USAGE:
metaboss [OPTIONS] <SUBCOMMAND>
FLAGS:
-h, --help Prints help information
-V, --version Prints version information
OPTIONS:
-l, --log-level <log-level> Log level [default: off]
-r, --rpc <rpc> RPC endpoint url to override using the Solana config or the hard-coded default
-T, --timeout <timeout> Timeout to override default value of 90 seconds [default: 90]
SUBCOMMANDS:
burn Burn token
collections NFT collections commands
decode Decode on-chain data into JSON format
derive Derive PDAs for various account types
find Find things
help Prints this message or the help of the given subcommand(s)
mint Mint new NFTs from JSON files
parse-errors Parse Errors commands
set Set non-Data struct values for a NFT
sign Sign metadata for an unverified creator
snapshot Get snapshots of various blockchain states
update Update various aspects of NFTs
uses NFT uses commands
From this, you'll notice that there are many very useful functions including burning tokens, signing collections and taking snapshots which includes holders snapshots, and even mint NFTs. You can also take note of the different flags that you can pass of which include --rpc
and --timeout
which are very useful for more demanding commands. You can pass these flags before the commands:
metaboss --rpc <YOUR-RPC> --timeout 100 ...subcommands-here
We will begin with one of the most important things to do when working with NFTs. Metaboss allows us to mint an NFT from a json file.
This command requires the path to the keypair of your file system wallet and if you happen to have several you can always get information including the path of it by using:
solana config get
We will now proceed to mint a single token.
metaboss mint one --keypair <PATH-TO-KEYPAIR> --nft-data-file <PATH-TO-JSON-FILE>
//Example
metaboss mint one --keypair /Users/macos/my-keypair.json --nft-data-file /Users/macos/test-nft.json
Tx id: 2z1rkgwJx3NhtHN2ME7X44uV5mxjEYihSxEy3munJW3X6eyyuKDhN5aWkFF1FJ8ciCwpWPe2cGAEVHsNWVgqDcnc
Mint account: 5RGsE43RfvdtfLhcVjfpjqoX43vy2fQLj2H7RngLmCDN
Done!
This directly mint our token to the wallet of the keypair we provided. We also have the option of changing the wallet that receives the NFT, and for this we must provide an address. To do this we will add a --receiver
flag at the end.
metaboss mint one --keypair <PATH-TO-KEYPAIR> --nft-data-file <PATH-TO-JSON-FILE> --receiver <ADDRESS-OF-RECEIVER>
We will now move on to finding mints using a creator address.
//This is the command we'll use
metaboss snapshot mints --creator <FIRST_CREATOR> --output <OUTPUT_DIR>
//Example: Here the result should look similar with any creator you add
metaboss snapshot mints --creator <CREATOR> --output /Users/macos
Getting accounts...
Getting metadata and writing to file...
Done!
For many projects a snapshot of the holdres is very important for several reasons. And metaboss has a simple snapshot
command that takes in the update authority
and allows you to choose the directory to output the holders list like the following:
metaboss snapshot holders --update-authority <UPDATE-AUTHORITY> --ouput <OUTPUT-DIR>
The next command we will be trying out is called update
. Oftentimes we might find ourselves with a token, specifically a nonfungible token that might require some changes in its metadata. To do so we will start with smaller updated within the metdata of the tokens.
In our first example, we'll be updating the seller basis fees points. For this, we will need the path to your keypair stored in your system:
metaboss update sfbp --keypair <PATH_TO_KEYPAIR> -a <MINT_ACCOUNT> -n <NEW_SELLER_FEE_BASIS_POINTS_VALUE>
//Example
metaboss update sfbp --keypair /Users/macos/solana-wallet/keypair.json -a 4rxTT8pKeYFrFgNBgTspBWVEnMnsAZGwChkjRUtP4Xpi -n 500
Updating other sections of the data struct can be done through similar commands. For example, let's try to update the symbol of our NFT:
metaboss update symbol --keypair <PATH_TO_KEYPAIR> --account <MINT_ACCOUNT> --new-symbol <NEW_SYMBOL>
//Example
metaboss update symbol --keypair /Users/macos/solana-wallet/keypair.json --account 4rxTT8pKeYFrFgNBgTspBWVEnMnsAZGwChkjRUtP4Xpi --new-symbol SYM
Once again we're using updating but we've replaced sfbp
with symbol
.
For our following update we will do something similar with the command and instead of symbol
we'll write creators
.
metaboss update creators -k <PATH_TO_KEYPAIR> -a <MINT_ACCOUNT> -c <CREATOR1:SHARE:VERIFIED,CREATOR2:SHARE:VERIFIED>
//Example
metaboss update creators -k /Users/macos/solana-wallet/keypair.json -a 4rxTT8pKeYFrFgNBgTspBWVEnMnsAZGwChkjRUtP4Xpi -c 42NevAWA6A8m9prDvZRUYReQmhNC3NtSZQNFUppPJDRB:70:false,AVdBTNhDqYgXGaaVkqiaUJ1Yqa61hMiFFaVRtqwzs5GZ:30:false
In this example, we've included two creators separated by a comma and set verified to false.
Finally, we can also use a JSON file to update the data struct using data
and providing the path to the JSON file.
metaboss update data --keypair <PATH_TO_KEYPAIR> --account <MINT_ACCOUNT> --new-data-file <PATH_TO_NEW_DATA_FILE>
//Example
metaboss update data --keypair /Users/macos/solana-wallet/keypair.json --account 4rxTT8pKeYFrFgNBgTspBWVEnMnsAZGwChkjRUtP4Xpi --new-data-file /Users/macos/new_data.json
Now that we've done trying out the different parts of the metadata we can update let's move on to burning NFTs. At some point you might want to get rid of an NFT and to do that we will burn it. For this command we will need the mint account of the NFT we want to burn. Metaboss also provides us with the option of burning multiple NFTs at once by listing them in JSON file such as shown below.
[
"D5ycm2mgBWDR37QVkvM389x84V4ux48bSeHLeiHPtX28",
"4kYdMRRYtXjmkusgKEBntSXLDhqkHNE57GF3RPdtx6MW",
"J8xuCFCeBRESoXewtMwrrpVUGikUG3B1WznNdLffyymz",
"4gRtRjrbD7g5ZKUvSVA1tYMK9LZqz6uWuSc3rKeinySh"
]
//Burn Single NFT
metaboss burn one -k <OWNER_KEYPAIR> --account <MINT_ACCOUNT>
//Burn Mulitple NFTs
metaboss burn all -k <OWNER_KEYPAIR> -L <JSON_LIST_OF_MINTS_ACCOUNTS>
Sometimes the NFTs we mint do not belong to a single collection, and with the new Metaplex Certified Collections we might want our NFTs to belong to a single on-chain collection. We can migrate
our collection using a mint list within a JSON file as shown below.
[
"D5ycm2mgBWDR37QVkvM389x84V4ux48bSeHLeiHPtX28",
"4kYdMRRYtXjmkusgKEBntSXLDhqkHNE57GF3RPdtx6MW",
"J8xuCFCeBRESoXewtMwrrpVUGikUG3B1WznNdLffyymz",
"4gRtRjrbD7g5ZKUvSVA1tYMK9LZqz6uWuSc3rKeinySh"
]
We will also need the mint address of the parent NFT that will be representing this collection. With this information we just grab the path to the JSON we've created in the first step and migrate the collection.
metaboss collections migrate -k my_keypair.json -L my_mint_list.json --mint-address 9wtpdjMysSphxipTSJi7pYWGzSZFm2PRFtQucJiiXUzq
The longer our list becomes the higher our chance of encountering a small error. This often happens because migrate
will attempt to finish moving the collection quickly. To give the command a higher chance of success we can pass the --retries
flag along with a number.
metaboss collections migrate -k my_keypair.json -L my_mint_list.json --mint-address 9wtpdjMysSphxipTSJi7pYWGzSZFm2PRFtQucJiiXUzq --retries 10
If after running this, there are still some, this will result with a cache file containing the errors. We can then take this file and pass it on to the command before running it again.
metaboss collections migrate -k my_keypair.json --cache-file metaboss-cache-migrate-collections.json --mint-address 9wtpdjMysSphxipTSJi7pYWGzSZFm2PRFtQucJiiXUzq
We can also find ourselves with a repeating error with can be addressed by looking through the contents of the cache file. Let's look at the following cache file.
{
"FqKGC9CCVThn857VAyZtZQq5L31njnbeUTe1JoCsCX8J": {
"error": "Migration failed with error: RPC response error -32002: Transaction simulation failed: Error processing Instruction 0: custom program error: 0x39 [5 log messages]"
},
"H7xrCZwA7oqsFeRcPsP6EEYHCxqq7atUBuuQAursXvWF": {
"error": "Migration failed with error: RPC response error -32002: Transaction simulation failed: Error processing Instruction 0: custom program error: 0x39 [5 log messages]"
}
}
Both errors indicate the 0x39
error. From the Metaplex errors we know that 0x39
means that these two NFTs have a different update authority.
0x39:
Token Metadata | IncorrectOwner: Incorrect account owner
Once migration has finished we must verify that it all the items successfully moved and belong to the same verified collection.
metaboss collections check-items --collection-mint <COLLECTION_NFT_MINT_ADDRESS> -L <PATH_TO_MINT_LIST>