This blog illustrates minting NFTs in a gasless manner on Solana, where the NFT creator does not have to pay the gas fees required for the creation transaction.

Creating NFTs on any blockchain such as Solana may be time-consuming and the creator has to be familiar with the Web3 tech stack and all the development stuff. This is where SHYFT APIs help the creators. SHYFT provides a series of APIs and tools for creators to create, read, modify, and burn NFTs in a hassle-free manner. Moreover, SHYFT also has APIs for almost all possible operations on Solana blockchain, be it NFTs, Tokens, Wallets, and whatnot.
In this Blog, we will see how we can create NFTs using a gasless transaction, where the NFT creator will not have to pay any gas fees to receive the NFTs. Instead, we, the create NFT service providers will pre-pay the gas fees on behalf of the NFT receiver. Also note that the service providers mentioned here can be any service provider, who is using SHYFT APIs as a part of their system.
Read SHYFT Documentation here.
Pre-requisites
Authentication: Get your Shyft API key
x-api-key is an authentication parameter, which gives you access to SHYFT APIs. You can get your own API Key from the SHYFT website. Just signup with your email id here and you can get it for free.
Phantom Wallet
We will need the Phantom wallet browser extension, you can download it from the link below.
Once done, set up your Phantom wallet account. On-screen tips are available, which will guide you through setting up and getting started. You can also find a detailed guide related to this here.
Details of the NFT being created
First, we need to accept all the details regarding the NFT being created. Let’s create a simple form for accepting all the details. We have used React for creating the form, but you can use any language of your choice.

Simple form to accept the details of the NFT being created
Creating the NFT in a gasless manner
We will be using the following create API endpoint to create the NFT.
POST https://api.shyft.to/sol/v2/nft/create
This API accepts x-api-key parameter in the header, which is an authorization parameter used by SHYFT for validating its users. You can get your own **x-api-key** from the SHYFT website for free here. The Content-Type for this API call is multipart/form-data .
One of the most striking features of this API is, it allows us to separate the transaction_fee payer from the NFT creator wallet. This means, the wallet which is being used to create the NFT and the wallet which is paying the gas fees for the transaction may or may not be the same.
Read the SHYFT API Documentation here.
Parameters being used in this API call:
network: Selects the Solana Blockchain network instance.creator_wallet: Selects the wallet which will have theupdate_authorityof the NFT being created. In our case this will be thewallet_addressof the user who is creating the NFT.name: name of the NFT being created.symbol: symbol of the NFT that is being created.description: a small description about the NFTattributes: This accepts the NFT metadata in a specified format. Each attribute has atrait_typeandvaluefield in the following format.
{
trait_type: "Speed", //the first attribute
value: "25", //its value
},
{
trait_type: "Accuracy", //the second attribute
value: "98",//its value
},
max_supply: Number of edition NFTs that can be minted for this particular NFT. In our case, this will be 0, as we want to create one-of-a-kind NFTs.image: Selects the NFT image.service_charge: Specifies the receiver, token, and the amount which will be deducted as a service charge. This is an optional parameter and can be used to pay a small service charge to the service provider. Please note that thefee_payerspecified will pay the service charge and the gas fees as well.
{
"receiver": WALLET_ADDRESS_OF_THE_SERVICE_CHARGE_RECEIVER,
"token": TOKEN_ADDRESS_OF_THE_AMOUNT, //SOL if left blank
"amount": 0.5 //service charge amount
}
fee_payer: Specifies the wallet address from which the service_charge will be deducted. In our case, this will be the wallet address of the service provider
Press enter or click to view image in full size

Accepting details via form
You can also try out our APIs using the swagger UI here.
We have used FormData to accept all this information, and for the API call we have used the axios package.
const fee_Payer = "Feepayer_Public_Key"; //wallet_address of the feepayer
const formData = new FormData();
formData.append("network",network);
formData.append("creator_wallet",creator);
formData.append("name",name);
formData.append("symbol",symbol);
formData.append("description",desc);
formData.append("attributes",JSON.stringify(attr));
formData.append("external_url",extUrl);
formData.append("max_supply",maxSupply);
formData.append("royalty",royalty);
formData.append("fee_payer",fee_Payer);
formData.append(
"service_charge",
JSON.stringify(
{
"receiver": fee_Payer,
"amount": Number(serviceCharge),
},
)
);
formData.append("image",image);
axios({
// Endpoint to get NFTs
url: `https://api.shyft.to/sol/v2/nft/create`,
method: "POST",
headers: {
"Content-Type": "multipart/form-data",
"x-api-key": "Your X_API_KEY", // Your api key from SHYFT website
},
data: formData,
})
Once this request is successfully executed, the response should look somewhat like this.
{
"success": true,
"message": "NFT create request generated successfully",
"result": {
"encoded_transaction": "AgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADd/kZ7nuc7bHY1UZVoVPsZ2Slp+9Sz9dwdHYG7/EP0XTgUn5L1oPWrbCiWyhASqoz4vROwbl2Neo1exHuYvnYIAgAID0mioYxx/asdasdsSls7U3Uq1cPiWEWioadmJJkpfEpJj1IRPDYHVKLFdzmKAhEV5ABsw3PbAIcv3yNkm3z5V2dA0oNsKtkdrxCZh81eIaZc6sHtpoVRDXqCwk2sxG3tUhDS4Opo80GCvyIr4gr+MfwhU03cnO9eEM/I2BvSTn8atGSgv4jEnlxkrsXIO3WpLa65+YPE+hVbcdZfoTSlkuSZace5SwBw7BnI9z9u9hPXYCyNkAAWPPPEqUQJe24xjrsbmyqqUL4gQg6etSyylLP4PMcsG5bcYK4xg9sKxkzNEVAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAYyp9RxUce7b6XJTmDH3BTasbGTY2hJe2h0xJ16/4PFYyXJY9OJInxuz0QKRSODYMLWhOZ2v8QhASOe9jb6fhZzgOeiS4FIAsM7m2Xp1OR42r2qbdt9WblPm7k6dy0XkQLcGWx49F8RTidUn9rBMPNWLhscxqg/bVJttG8A/gpRgan1RcZLFxRIYzJTD1K8X9Y2u4Im6H9ROPb2YoAAAAABt324ddloZPZy+FGzut5rBy0he1fWzeROoz1hX7/AKkOmNc6v7OEyaYVVIa6Sv4A/AgVM+wz147I5bRZEbS74yKOCI5qZRvBPiwWe60BzPA23jIRrCRiPj2oAj/VJbo9BQcCAAE0AAAAAGBNFgAAAAAAUgAAAAAAAAAG3fbh12Whk9nL4UbO63msHLSF7V9bN5E6jPWFfv8AqQ0CAQxDAABJoqGMcf65O3NEpbO1N1KtXD4lhFoqGnZiSZKXxKSY9QFJoqGMcf65O3NEpbO1N1KtXD4lhFoqGnZiSZKXxKSY9QkHAAMIAQcNDAANAwEDAAkHAQAAAAAAAAALDgYFAgEEAAAADggKDQcMCQsCAAAAAAAAAA==",
"mint": "5FjMDMkhcjYggt5LyWDUf5FFpKBuSgmEaaoHKuwoegju"
}
}
Now, this encoded_transaction received in the response needs to the signed by two wallets, one the NFT **creator_wallet** and the **fee_payer** wallet.
Check out our dev guide on how to sign transactions on Solana here.
First, let’s see how we can sign the transaction from the backend using the fee_payer (service provider’s) wallet. We use the following function for signing the encoded_transactionpartially by the fee_payer wallet.
export async function partialSignWithKey(network, encodedTransaction, privateKey)
{
const connection = new Connection(clusterApiUrl(network),'confirmed');
const feePayer = Keypair.fromSecretKey(decode(privateKey));
const wallet = new NodeWallet(feePayer);
const recoveredTransaction = Transaction.from(Buffer.from(encodedTransaction, 'base64'));
recoveredTransaction.partialSign(feePayer); //partially signing transaction with privatekey of the fee_payer
return recoveredTransaction;
}
Here privateKey indicates the private key of the user that is signing the transaction partially(in our case which is the fee_payer). Next, we attempt to sign the recoveredTransaction received from this function with the creator_wallet.
export async function partialSignWithWallet(connection, encodedTransaction, wallet) {
//we have to pass the recoveredTransaction received in the previous step in the encodedTransaction parameter
const signedTx = await wallet.signTransaction(encodedTransaction);//signing transaction with the creator_wallet
const confirmTransaction = await connection.sendRawTransaction(signedTx.serialize());
return confirmTransaction;
}
Once successfully signed by both wallets, the gas fees will be deducted from the fee_payer wallet, and the NFT will be created in the creator_wallet.
Please note that, sometimes the transaction charges are displayed during signing transaction from the wallet, but charges are actually deducted from the _fee_payer_ wallet only.

Newly created NFT on Solana Explorer
You can find all the functions related to signing a transaction here, or you can also check out our blog on signing transactions.
So, that’s pretty much about this blog in which we see how we can create NFTs using one wallet and use another wallet as a fee_payer. The NFTs created are all gasless, in the sense that the NFT creator need not pay the gas fees for the create transaction.
If you enjoyed building along with this blog, feel free to check out our other blogs on Creating Your Own NFT Marketplace, or Getting NFT Collections on Solana.
We hope you have a great time building dApps with SHYFT APIs. Happy Hacking!
Resources
Join our Discord


