I’m struggling to mint an NFT on the Tron blockchain. My code looks like this:
async function mintNewToken() {
const nftContract = await tronWeb.contract().at('contractAddress');
try {
const tx = await nftContract.createTokenWithMetadata(
'myWalletAddress',
tokenId,
'metadataUri'
).send({
feeLimit: 150_000_000,
callValue: 0,
tokenId: 1000042,
tokenValue: 150,
shouldPollResponse: true
});
console.log('Minting successful:', tx);
} catch (error) {
console.error('Minting failed:', error);
}
}
But I keep getting this error message:
CONTRACT_VALIDATE_ERROR: contract validate error : Owner no asset!
I’ve double-checked my wallet balance and contract permissions. What could be causing this issue? Any ideas on how to fix it or what I might be missing?
hey isaac, ive seen this error before. its usually cuz u dont have enough TRX or the right token balance in ur wallet. double check ur TRX balance and make sure u got the correct token ID. also, try increasing the feeLimit a bit, sometimes that helps. good luck!
The ‘Owner no asset’ error typically occurs when the contract doesn’t have the necessary tokens to perform the minting operation. To resolve this, ensure your contract is properly funded with the required TRC10 or TRC20 tokens. You might need to transfer some tokens to the contract address before minting.
Also, verify that you’re using the correct contract address and that it’s initialized with the right parameters. Sometimes, this error can arise from permission issues within the contract itself.
If you’ve confirmed these aspects and the problem persists, consider reviewing your contract’s implementation of the createTokenWithMetadata function. There might be a condition that’s not being met, causing the transaction to fail.
hey there isaac31!
this nft stuff can be tricky, right? i’ve been dabbling in it too and ran into similar issues. have you considered that maybe the contract itself doesnt have the necessary permissions or resources? sometimes its not just about our wallet balance, but what the contract is allowed to do.
btw, im curious - what kind of nft are you trying to mint? is it art, music, or something else entirely? it’d be cool to hear more about your project!
oh, and just a thought - have you tried minting on a testnet first? it’s a great way to troubleshoot without risking real TRX. what do you think about giving that a shot?
keep us posted on how it goes! ive got my fingers crossed for you 