Mint my first NFT ERC721 with Vottun APIs

Creating a collection of NFTs from a developer’s point of view has become very easy thanks to Vottun’s APIs. In a few simple steps, and in a very short time, you can integrate the APIs with your software and develop your own DAPP.

Create your first NFT (1)

Let's start

Here are the steps to follow to mine your first NFT with Vottun APIs:

  1. Get your credentials to be able to use the APIs.
  2. Be clear about the characteristics of your collection: digital assets and metadata.
  3. Deploy your contract on the network of your choice.
  4. Upload your digital asset to IPFS using our APIs.
  5. Add the url of your digital asset to your metadata and upload it to IPFS as well.
  6. Mint your NFT with the url of the digital asset uploaded to IPFS.

How to get my credentials

Getting credentials is very easy. You have the option to get a 30 days trial at the url https://apis.vottun.tech/trial. Fill in the form and you will receive an email like the one below with your credentials ready to use.

In addition to the credentials, you also will receive the public key of a wallet that you can use in your tests (for security reasons, the private key is always kept on our servers).

Once you receive them, its use is very simple, the JWT token must be used as Bearer Authentication and the Application ID must be added in another header called x-application-vkn and you must send it in all calls.

You will find more information about APIs at https://developers.vottun.tech.

My NFTs

In order to create an NFT you must take into account 4 important aspects:

  1. The digital asset itself must be created in a digital format that can be stored on the blockchain. This can include anything from a piece of digital artwork, a music file, a video or even a tweet. The digital asset must be of high quality and resolution to ensure its value and desirability.
  2. Metadata must be added to the NFT to provide information about the asset and its ownership. This includes the title, description, creator information and any relevant details such as edition numbers or rarity. The metadata must be complete and accurate to provide transparency and confidence to potential buyers.
  3. The NFT must be stored on a decentralized storage network such as IPFS (Interplanetary File System). This ensures that the digital asset is accessible and cannot be removed or altered by any centralized entity. The use of IPFS also allows the NFT to be shared and viewed across different platforms and markets.
  4. Finally, when creating an NFT for sale in a marketplace, certain fields must be completed in order for it to be visible and searchable. These include title, description, image, collection name and creator information. It is also recommended to include additional information such as creation date, issue number and any relevant tags or keywords to increase visibility and attract potential buyers.

Deploy your smart contract

Once we have everything clear, it is time to start using the Vottun APIs. The first thing we will do is to deploy a smart contract in the network of our choice, for this article, we will use Avalanche. Remember you have all the information at https://developers.vottun.tech

The end point for the deployment is:

https://api.vottun.tech/nft/v3/erc721/deploy

It is a POST call and, in addition, you must add a JSON with the necessary information for its deployment:

As you can see, we inform the name of the Smart Contract (it will appear as a collection name in the Marketplaces), the Symbol, which is nothing more than a code name for the Token, the blockchain network, in this case the Avalanche Testnet and the gas limit to use, we have put 3000000 for this contract.

The complete call launched from curl:

And an example to be run in NodeJS:

The API will return the following result:

Upload files to IPFS

Using the APIs, we will first upload our digital asset to IPFS, this will return a url of our asset on the network. For this we will make a POST call to the endpoint:

https://ipfsapi-v2.vottun.tech/ipfs/v2/file/upload

Its content type must be multipart/form-data and will include two fields:

  • Filename: A name for the file
  • File: the file itself

The API will return the following result that contains the IPFS url to the asset:

The complete call launched from curl:

And from NodeJS:

Once we have the url of the asset, we create our metadata and upload it to IPFS as well. In our case, we have created this metadata:

The name, image, description and external_url fields are standard and are used in all marketplaces. You can also add the animation_url field with an animated gif or a video that in some marketplaces will be used to display the NFT on your page. All data content is free and you can load any valid json.

Now we only have to call our endpoint to upload the metadata (in curl):

And this call returns the following result:

Where the IpfsHash field contains the url of the metadata in IPFS, PinSize contains the total size used by the metadata and a timestamp with the time of creation.

And now, we only need to mint the NFT.

Now that we have the metadata uploaded to IPFS, we can mint our first NFT. We will need the public address of the smart contract we deployed at the beginning and the url of the metadata we got in the previous point. So, to mint we will call the following endpoint: https://api.vottun.tech/nft/v3/vottun/mint And we will provide with the necessary information to mint the NFT;

NFT Mint

In recipientAddress we will pass the address to which we are going to mint the NFT, i.e. the public address of the account that will be the owner of the token. In ipfsUri we will pass the url received from the metadata upload to IPFS, in ipfsHash the last part, which begins with Qm in this case, which is the IPFS CID and the rest are quite obvious, contractAddress contains the public address of the contract that we deployed at the beginning of this article and in royaltyPercentage we will tell the NFT that in case of transfer we have to pay this royalty to the owner of the smart contract (remember that according to the royalty standard this payment is voluntary).

This minting returns a transaction code in the following result:

This is because these types of transactions are performed asynchronously. In order to see the status of the transaction we can call the endpoint https://api.vottun.tech/nft/v3/operation/5fa5825b-a1ed-4f7d-bc70-d52eb0b16dc9 This will return information similar to the one below:

In which the most important is the statusId, which returns a 4 (a 5 means that there has been an error and another value means that the process has not finished), means that everything went well and also the transactionHash, with which we can check its status in the avalanche testnet explorer: https://testnet.snowtrace.io/tx/0x1b8c5183a59fc86e9cdaccb7505424631ec4e20daa5660e79c8259a6612c60bc

In this article we have learned how to:

  • Get our credentials to use Vottun APIs.
  • Deploy an ERC721 compliant Smart Contract on Avalanche’s (Fuji) Testnet network.
  • Create the metadata for an NFT and upload it, along with the digital asset to Vottun’s IPFS server.
  • Minting our first NFT in the Avalanche network.

In future articles we will go deeper into other transactions that we can perform with the APIs and we will work with other standards such as ERC1155.