Solana - Mint and Transfer NFTs
NFTs over Solana work differently than other EVM (like Ethereum) chains. With most EVM chains, you need to deploy a smart contract from which you will mint NFTs.
However, Solana uses the Metaplex Protocol — a smart contract and metadata standard for creating and working with NFTs. Tatum’s API endpoints leverage the Metaplex protocol, and as a result, you do not need to deploy your own smart contract to mint NFTs.
When an NFT is minted on Solana, a new blockchain address is created to receive the NFT under the recipient's account address (the one in the to parameter of the request body). This address is returned in the nftAccountAddress
parameter in the response body, is owned by the recipient's address, and has the same private key. The response body also returns the address of the minted NFT itself, which is held in the nftAddress
parameter.
Usually, the JSON metadata scheme that points to the metadata included in your NFT must be stored on IPFS. However, on Solana, this metadata is stored on the blockchain itself, so you do not need to create a JSON metadata scheme and upload it to IPFS. All you need to do is include a URL that points to the metadata in the URI field of the Mint NFT API call.
How to Mint a Solana NFT
Available Request Body Schema:
- MintNftExpressSolana
- MintNftSolana
- MintNftSolana
Request example:
curl --location --request POST 'https://api.tatum.io/v3/nft/mint/' \
--header 'x-api-key: {API_KEY}' \
--header 'Content-Type: application/json' \
--data-raw '{
"from": "FykfMwA9WNShzPJbbb9DNXsfgDgS3XZzWiFgrVXfWoPJ",
"chain": "SOL",
"fromPrivateKey": "####",
"to": "FykfMwA9WNShzPJbbb9DNXsfgDgS3XZzWiFgrVXfWoPJ",
"metadata": {
"name": "Tatum API",
"symbol": "TAPI",
"sellerFeeBasisPoints": 10,
"uri": "ipfs://bafybeidi7xixphrxar6humruz4mn6ul7nzmres7j4triakpfabiezll4ti",
}
}'
//Response:
{
"txId": "5GAwhRcMR7h5Dx71KCQax4CAcCFA6FcrVE5fwNedq7wXDYS1qpZaGd4Bj2zh8dCUfAz7fqVSXhdZzXRigsNoTZsb",
"nftAddress": "7dQWANaodDyttJNz3seaXoAe6VA8cLpPV1bM4cPGuNhG",
"nftAccountAddress": "3z2bPwKzfTAFDKPNKTM4vvffBSDvcBvkuRJeME5iALs3"
}
How to Transfer a Solana NFT
The way the Solana blockchain works with minting and transferring NFTs uses nftAccountAddresses
. For practical use of Tatum’s API, this makes very little difference, but it is important to know that for transferring NFTs, the nftAddress
of the NFT is used, NOT the nftAccountAddress
.
Request example:
curl --request POST \
--url https://api.tatum.io/v3/nft/transaction \
--header 'content-type: application/json' \
--header 'x-api-key: {API_KEY}' \
--data '{
"chain": "SOL",
"from": "FykfMwA9WNShzPJbbb9DNXsfgDgS3XZzWiFgrVXfWoPJ",
"to": "FykfMwA9WNShzPJbbb9DNXsfgDgS3XZzWiFgrVXfWoPJ",
"contractAddress": "7dQWANaodDyttJNz3seaXoAe6VA8cLpPV1bM4cPGuNhG",
"fromPrivateKey": "####"
}'
//Response:
{
"txId": "c83f8818db43d9ba4accfe454aa44fc33123d47a4f89d47b314d6748eb0e9bc9"
}
Updated 5 months ago