Beyond Blockchain Data: Use Tatum’s API to Build Full Blockchain Apps

This is a guest post written by Evan Vischi, community manager at Tatum.

There are many different types of blockchain APIs, and some also have their own Postman public workspaces. But when most people think of a blockchain API, they imagine a quick way to fetch blockchain data or cryptocurrency prices. While those types of blockchain APIs are extremely useful in their own right, they’re quite different from all that Tatum provides.

So what’s the big difference?

While you can also use Tatum’s APIs to look up blockchain data in a variety of ways, the main distinguishing factor of the platform is that it allows you to build full-fledged blockchain apps from the ground up for more than 40 blockchain protocols. Tatum streamlines complex blockchain operations into unified API endpoints that overlay all supported blockchains. It allows you to communicate with our blockchain infrastructure to build apps on any supported blockchain without learning to code for each one individually. You can use the same API calls for different blockchains by just changing the name of the chain in the call. Build full multi-chain and cross-chain apps, or switch between blockchains at any time.

So we’re not just talking about fetching real-time blockchain data; we’re talking about a platform that gives you everything you need to build any blockchain app you can imagine. And now you can interact with Tatum’s API effortlessly using Postman.

Let’s build some blockchain apps!

First up, you’ll need to get a free API key to communicate with Tatum’s API and get it all set up in Postman. This guide will walk you through all the steps.

Now, let’s take a look at some of the stuff you can do with Tatum in Postman. We’ve made a Postman Collection available in the Tatum public workspace with all of the API endpoints we’ll be using in this tutorial. Feel free to fork it by clicking the button below and try everything for yourself:

Generate wallets, private keys, deposit addresses

The first thing you’ll probably want to do with any kind of blockchain app is to allow your users to send and receive crypto-assets. You’ll need to generate wallets to hold their addresses and private keys, and you’ll need the addresses and keys themselves. Here’s how to do it on the Polygon blockchain, but the process is exactly the same for any other supported blockchain.

  1. Send the generate Polygon wallet call from the collection we forked above.
  2. Using the extended public key (xpub) from the response of the previous call, you can now send the generate Polygon address call and enter your wallet’s extended public key. You’ll also need to enter the “index” of the address: we’ll start with “1.”
  3. Using the index of the deposit address from the previous call and your wallet’s mnemonic, you can now send a generate private key call for that address.

So now you can receive crypto to the address you’ve generated, and you can send assets from the address using the corresponding private key. Just three API calls in Postman, and you’re all ready to go.

Send some crypto

Speaking of sending assets, let’s transfer some MATIC from a Polygon address. You’ll need the private key to the address holding the crypto and a recipient address to which you’ll send the tokens. Enter them in the “Transfer Polygon” API call body from the collection you’ve forked, and send the API call to instantly transfer some MATIC.

Deploy an NFT smart contract

First, you need to deploy a smart contract from which you will mint your NFTs. Simply send the deploy an NFT smart contract call to do it. You’ll need to enter the following parameters in the call:

  • The name of the chain to deploy the ERC721 token on (in our case “MATIC”)
  • The name of the ERC721 token
  • The symbol of the ERC721 token
  • The private key of the Polygon account address from which the fees for the deployment of the ERC721 will be paid; the private key or signature ID must be present
  • The nonce to be set to the transaction; if not present, the last known nonce will be used

Upload metadata

Now let’s upload some metadata to include in our NFT. Whether you want your NFT to be an image, video, audio file, or any other kind of digital asset, you’re going to need to store your metadata somewhere. Lucky for you, we’ve partnered with NFT.storage to offer completely free metadata storage, and we’ve got native IPFS integration built right into the Tatum platform.

To upload your metadata, send the upload metadata call, and select the file you’d like to upload to IPFS.

The response will contain the URL of the data on IPFS.

Next, you need to create a JSON scheme that includes the URL of the data from the previous response and upload it to IPFS using the same call as above. You will then include the URL in the response to this API call in the Mint NFT call below.

For a more detailed explanation of uploading metadata to IPFS, please refer to our guide.

Mint an NFT

Now that your metadata is securely stored on IPFS, let’s mint an NFT. Again, all you need to do is send the “Mint an NFT” call from the collection you’ve forked.

The parameters you’ll need to enter here are:

  • The name of the chain to deploy the ERC721 token on (in our case “MATIC”)
  • The ID of the ERC721 token
  • The recipient blockchain address to which to send the token
  • The contract address of the smart contract deployed above.
  • The URL of the metadata of the NFT (which we stored to IPFS in the previous call)

A quick note on private keys

You might have noticed we have been sending private keys in our API calls throughout this tutorial. This is fine for testing and demo purposes, but for production use, you should never send your private keys over the internet. To work with and store private keys and mnemonics securely and on-premise, you can use Tatum KMS (Key Management System). Check out this guide on how to do it.

And this is just the tip of the iceberg…

Tatum has over 300 features as API calls, which will allow you to build complex blockchain apps in no time at all—building full NFT marketplaces and even multi-chain crypto exchanges are just a few API calls away. And the data lookup APIs we mentioned earlier? You can fetch a wide range of blockchain data with simple API calls for any supported blockchain. Check out our API documentation for a complete list of the endpoints available to you.

All of our API calls are ready for use and easily available in our Postman public workspace, so head on over there to download our full collection or any sub-collections from our workshops, tutorials, and this guide. You’ll also find a treasure trove of resources in our documentation and on our Tatum blog.

If you need any help or have any questions, feel free to hop onto the Tatum Discord or subreddit and we’ll get back to you as soon as possible!

Technical review by Arlemi Turpault

What do you think about this topic? Tell us in a comment below.

Comment

Your email address will not be published. Required fields are marked *


This site uses Akismet to reduce spam. Learn how your comment data is processed.