How to create an NFT Minting API for Ethereum?
Who is this for?
If you are building a web3 application or a game that requires any read to or write from a blockchain, this is for you!
thirdweb Engine is a dedicated cloud server that allows anyone to read, write, and deploy contracts on the ethereum blockchain at scale. Engine from your backend to any contract onchain. This guide will walk you through how to call a contract to mint NFTs on ethereum from your backend with thirdweb Engine.
Create an ethereum Blockchain API with thirdweb Engine
Deploy an Engine Instance
Log into your thirdweb Dashboard and navigate to the "Engine" tab. Here, you'll create a new Engine instance tailored to your use case. Once you've created your Engine instance, you'll also receive an Engine URL, which you can now use to call any blockchain action from your backend.
Set Up & Fund Backend Wallets
Every transaction sent on the blockchain requires a signer and a gas fee to be paid. After deploying your Engine instance, you can create a smart backend wallet to sign and transact on your behalf from your server. thirdweb's smart backend wallets do not need to hold crypto in order to transact—thirdweb handles gas management for you, so you can start calling your contract immediately.
Call Your ethereum Contract
If you haven't already done so, you can deploy an NFT contract on ethereum through thirdweb's Contract Explorer. Once you deploy your contract and obtain its contract address, you can mint your NFT with the following call:
https://<your-engine-url>/contract/1/<your-contract-address>/erc721/mint-to
You'll also need to provide details specifying the destination wallet for the NFT ("the receiver") as well as any metadata including name & description:
{
"receiver": "<destination-wallet-address>",
"metadata": {
"name": "My NFT",
"description": "My NFT description",
"image": "ipfs://QmciR3WLJsf2BgzTSjbG5zCxsrEQ8PqsHK7JWGWsDSNo46/nft.png"
}
}
Once you call this endpoint, you should see your newly minted NFT in your chosen destination wallet.
As you can see, with thirdweb Engine, you can turn NFT minting into a simple API call. No need to worry about ABIs or any other blockchain complexity.
thirdweb Engine is built for more than just minting NFTs. You can use Engine to create HTTP endpoints for airdrops, fetching blockchain data, marketplace transactions, and more. Check out our Engine API Documentation to learn more, or visit the Engine Explorer page in the thirdweb dashboard.
Happy building!