DEV Community

Cover image for How to Mint NFTs Using Tatum NFT Express in JavaScript
Joel Adewole
Joel Adewole

Posted on • Updated on • Originally published at blog.wolzcodelife.com

How to Mint NFTs Using Tatum NFT Express in JavaScript

To implement NFT minting, blockchain developers typically use tools like Cadence and Moralis. Thanks to these libraries and modules, by utilizing pre-written smart contracts, these tools allow programmers to interact with the blockchain with fewer lines of code than would otherwise be necessary.

Tatum offers a relatively simple way to interact with the blockchain without requiring developers to create new smart contracts and have any knowledge in Solidity or Truffle.
Although, it requires subscribing to different paid plans from which gas fees will be covered, there is a free plan for small scale applications.

In this article, I'll discuss Tatum and demonstrate how to mint NFTs in javascript using Tatum NFT Express. You'll need a basic understanding of the blockchain and JavaScript to follow along. You may not need to become proficient in any blockchain programming language like Solidity to create smart contracts.

With this, let's jump right in 🚀.

What is Tatum?

Tatum offers a unifying framework for thousands of digital assets and more than 40 different blockchain protocols(🤯). It is a versatile platform that aids programmers in minimizing the complexity of most blockchain development processes.

To assist in the reduction of complexity and the faster and simpler scaling of blockchain applications, Tatum offers features like:

  • NFT Express: This feature enables users instantly mint NFTs on various blockchains with just one API call.
  • Virtual Account: With this feature, you can access multi-currency wallets, make fee-free transactions, and receive alerts via webhook notifications.
  • Notification Station: This feature is the simplest and most effective way to be notified about blockchain events.

Minting NFTs with Tatum NFT Express in JavaScript

Tatum is designed to make minting NFTs easier than any other platform that assists developers with this functionality. Since the monthly credit allocation of your paid plan covers gas costs, you can successfully mint any NFT with just one API request and as many as you wish.

You must register on the Tatum dashboard to mint your first NFT using Tatum. As demonstrated below, you can register using either social authentication or an email address and password:
Tatum signup preview

After signing up, you will be redirected to your dashboard, where you can choose between using the Mainnet or Testnet and have access to two free API keys.

📌 NOTE: When deploying your application to real users, you should use the Mainnet rather than the Testnet.

API keys should be kept secret or limited to authorized people, such as the program's developers. If they fall into the wrong hands, they could compromise the security of the application and its users.

In the top-right corner of the dashboard, there is a button labelled "Create API key". By subscribing to a new billing plan, you can create new API keys with extra functionalities, as displayed below:
Tatum billing plans

You can integrate Tatum into your application once you have an API key. You need to configure Tatum first in your IDE or development environment.

Firstly, install the Tatum NFT Express JavaScript SDK by running the command given below in a terminal of your project directory:

npm install @tatumio/tatum
Enter fullscreen mode Exit fullscreen mode

After installing the SDK, we must configure the required environment variables; for the sake of this tutorial, we only need to set the TATUM_API_KEY environment variable. Run the following command in the terminal of your application directory to do this:

export TATUM_API_KEY="YOUR_TATUM_API_KEY"
Enter fullscreen mode Exit fullscreen mode

You should now be able to retrieve the value of your API key from your terminal by executing the following in your application:

console.log(process.env.TATUM_API_KEY);
Enter fullscreen mode Exit fullscreen mode

If everything is well done, we want to use Tatum's mintNFTWithUri() method to implement the functionality for minting NFT. For now, we need to import Tatum into a file called "index.js". Next, call the method with the necessary parameter as shown below:

const Tatum = require('@tatumio/tatum');
Tatum.mintNFTWithUri(false, {
    chain: Tatum.Currency.CHAIN_SYMBOL,
    to: 'ADDRESS_OF_RECEIVER',
    url: 'URL_OF_NFT_METADATA'
}).then(transactionHash => {
    console.log(transactionHash);
});
Enter fullscreen mode Exit fullscreen mode

You will notice no private key or signature ID in the code snippet above. That is because NFT Express uses a default private key, token ID, and built-in smart contracts offered by Tatum to make blockchain requests.

We then logged the 'transactionHash' as the output of the mintNFTWithUri() method, which took the following arguments:

  • chain: This is the blockchain protocol you want to use to mint NFTs. Tatum permits minting for chains including ETH, MATIC, BSC, CELO, ONE, and KLAY on both the Mainnet and Testnet.
  • to: The NFT is sent to this blockchain address after it has been minted.
  • url: this is the metadata of the NFT.

This is my actual code:

const Tatum = require('@tatumio/tatum');
Tatum.mintNFTWithUri(false, {
    chain: Tatum.Currency.ETH,
    to: '0xC34bCC0Be78C84EB94e9544982C5027861ec0D6b',
    url: 'https://i.postimg.cc/Wp0GZFK4/image.png'
}).then(transactionHash => {
        console.log(transactionHash);
});
Enter fullscreen mode Exit fullscreen mode

I want the NFT to be sent to this address: 0xC34bCC0Be78C84EB94e9544982C5027861ec0D6b.
Open the terminal in the program's root directory and enter the following command to execute the application and mint the NFT:

node index.js
Enter fullscreen mode Exit fullscreen mode

You should get something similar to this:
Terminal result

I looked up the transaction hash on EtherScan to see if the mint had been successful, and this is what I found👀:

EtherScan showing successful transaction

🥳 TADA! We successfully minted an NFT seamlessly.

Final Thoughts🤔

You will work with the blockchain seamlessly now that you are aware of Tatum, especially if you are a front-end developer.
Tatum contains practically everything you may need while working with blockchains. You can also learn more about:

Top comments (2)

Collapse
 
sloan profile image
Sloan the DEV Moderator

This looks like a great article! 🙌

In fact, the topic of your post would also work really well in the Meta Punk Community too!

Metapunk Web3 Community 🦙

We’re a community where blockchain builders and makers, web3 devs, and nft creators can connect, learn and share 🦙

favicon metapunk.to

Meta Punk is a really cool international NFT and web3 community where artists, web3 developers, and traders can connect, learn, and share exciting discoveries and ideas. 🦙

Would you consider posting this article there too? Because Meta Punk is built on the same platform as DEV (Forem) you can fairly easily copy the Markdown and post it there as well.

Really hope that you'll share this awesome post with the community there and consider browsing the other Forem communities out there!

Collapse
 
nazariussss profile image
Nazarius

The nft trading process is quite complex and heavy especially on an ongoing basis. If anyone is interested in the topic, I highly recommend this post: gamerseo.com/blog/free-nft-minting...