Dynamic NFT Metadata on Polybase
HC

Shaki
•
Mar 24, 2023
With dynamic NFT metadata stored on Polybase, you can build new kinds of utility or gaming NFTs that need faster and cheaper NFT metadata updates. Here’s a step-by-step walkthrough of how you can store your NFT metadata using Polybase.
Create an ERC-721 token
Open a terminal and make a directory for building your ERC-721 token.

Navigate into the nftMetadata directory, install the following dependencies

Under the contracts folder, create a new file "myToken.sol" and add the following code to it.

Update the truffle-config.js file with the following code.

You should store your Mnemonic phrase & Infura API key in the .env file that you need to create in this repository!
Your .env file would look like this.

Compile and deploy your contracts

Once you have compiled the smart contract we need to migrate it over to the Goerli network! Add a new file 1_deploy_contract.js under the migrations folder and update it with the following script.

Now save this code, navigate to the terminal, and type in the following command.

This would deploy your NFT in the Goerli test network. Make sure you recharge your Goerli testnet wallet before migrating it.
Creating a collection in Polybase
Now login to Polybase Explorer & add create a new app. You would be taken to the default boilerplate. Remove that code and paste the code given below. You can find this code in our docs.

Save the collection. Once you have done this head over to your terminal.
Install Polybase SDK

Add a mintnft.js file to your directory.

Navigate to the terminal and run this command.

Kudos! You have created your first record in the Polybase database. Here's a video where Shaki walks you through how to store your NFT metadata on Polybase.