curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
cargo install spl-token-cli
rustup override set 1.77.2
cargo install spl-token-cli
sh -c "$(curl -sSfL https://release.solana.com/v1.18.4/install)"
export PATH="/Users/spuriousdragon/.local/share/solana/install/active_release/bin:$PATH"
Follow the guide to create a new wallet using your seed phrase or a hardware wallet: Guide to Solana Keypair Conventions
Command to create a new wallet:
solana-keygen new
Send some SOL (not ETH, as Solana uses SOL for transactions) to your wallet's address.
spl-token create-token
Save the generated token address.
spl-token supply <token_address>
This should return 0
initially.
spl-token create-account <token_address>
Save the new account address.
spl-token mint <token_address> <number_of_tokens> <account_address>
Gas fees are required for this operation.
spl-token balance <token_address>
spl-token authorize <token_address> mint --disable
Verify if further minting is disabled to ensure it worked correctly.
spl-token burn <token_address> <number_of_tokens>
spl-token account-info <token_address>
spl-token transfer --fund-recipient <contract_address> <amount> <recipient_address>
cargo install metaboss
Create a metadata.json
file with the following content:
{
"name": "TokenName",
"symbol": "TKN",
"description": "Description of the token.",
"image": "https://example.com/path/to/image.png",
"extensions": {
"website": "https://example.com",
"twitter": "https://twitter.com/example"
}
}
Replace the placeholders with appropriate values.
Upload the metadata.json
file to a Content Delivery Network (CDN) or a web server where it can be publicly accessed. Ensure the URL to the JSON file is correct and accessible.
For example, if you upload it to a CDN, the URL might look something like this:
https://example-cdn.com/path/to/metadata.json
Use this URL in the uri
field of your metadata JSON file.
metaboss create metadata -a <token_address> -m https://example-cdn.com/path/to/metadata.json --rpc https://api.mainnet-beta.solana.com
If you want to change the ownership of the contract or SPL token, use the following command:
spl-token authorize <token_address> mint --new-owner <new_owner_public_key>
These steps should guide you through creating and managing an SPL token on Solana, including adding metadata to your token and changing its ownership.
If you found this tutorial helpful and would like to support my work, consider donating to:
Solana Address: FdDRBkAcbQdH56MXyPD495R73TbzCoeRYZusVnHaGk36
Thank you!