import Admonition from '@theme/Admonition';
NFTs, or non-fungible tokens, are unique digital assets that can be showcased, bought, and sold on the blockchain. Purchasing an NFT gives you ownership over the unique digital creation, similar to buying a distinct painting or art piece.
In this tutorial, you will learn how to mint your own NFT using the NFT minting application and LocalTerra.
- Download Google Chrome
- Station Chrome extension
- Create a Station wallet
- Install npm
- Install git
- Install Terrain
- Install LocalTerra
This tutorial uses LocalTerra, which requires at least 16GB of RAM to run optimally.
After installing all of the prerequisites listed above, use the following steps to set up your environment and clone the NFT minting repository, which contains the NFT minting smart contract and corresponding front end.
<CH.Scrollycoding>
- Create and enter a new directory for your project.
mkdir my-nft-project
cd my-nft-project
git clone --depth 1 https://github.com/terran6/nft-on-terra.git
cd nft-on-terra
npm install
- Clone the
NFT on Terrarepository to your project directory.
- Enter the cloned repository and run
npm installto install all relevant Node dependencies.
</CH.Scrollycoding>
After all the dependencies have been installed, you can close the terminal window.
LocalTerra is a complete Terra testnet and ecosystem containerized with Docker. In this tutorial, you will use LocalTerra to simulate transactions in a local testing environment.
After installing LocalTerra and all of its dependencies, open a new terminal window and run the following commands.
cd localterra
docker-compose upAfter starting LocalTerra successfully, you should start seeing simulated blockchain transactions.
In order to use your Station wallet with LocalTerra, you will need to configure your wallet to run on your LocalTerra network. The following steps walk you through importing one of LocalTerra's preconfigured wallets.
- Open the Station extension in your Google Chrome web browser. Click the gear icon in the upper right-hand corner and change the network from mainnet to localterra.
- Click on your wallet name in the upper left corner of the extension to enter the wallet manager.
-
Click Add a wallet.
-
Click Recover wallet.
- Input the following LocalTerra seed phrase and wallet information into the form and click Submit.
<CH.Code>
Name: test1
Password: testwalletnotice oak worry limit wrap speak medal online prefer cluster roof addict wrist behave treat actual wasp year salad speed social layer crew genius</CH.Code>
Now that you have successfully switched to the testing wallet on LocalTerra, you will be able to deploy your smart contract.
Before you can deploy your contract and begin minting your NFT, you will need to change the config.terrain.json file in your cloned repository.
- In your Station extension, click on your test1 in the upper left corner. Click the copy symbol to copy the address.
<CH.Scrollycoding>
- Open the
config.terrain.jsonfile in a code editor and locate the instantiate message section.
"instantiation": {
"fee": {
"gasLimit": 2000000,
"amount": {
"uluna": 1000000
}
},
"instantiateMsg": {
"name":"NFT Collection Name",
"symbol":"NFTSYMBOL",
"minter":"terraxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}
}
}
},
"mainnet": {
"_connection": {
"chainID": "phoenix-1",
"URL": "https://lcd.terra.dev"
}
},
"testnet": {
"_connection": {
"chainID": "pisco-1",
"URL": "https://pisco-lcd.terra.dev"
}
- Update the
"name"and"symbol"fields with the desired name and symbol which will correspond to your NFT collection. The"minter"field should be updated with the wallet address of the collection owner, in this case it will be yourtest1wallet address.
"instantiation": {
"fee": {
"gasLimit": 2000000,
"amount": {
"uluna": 1000000
}
},
"instantiateMsg": {
"name":"Cryptocurrency Token NFTs",
"symbol":"TOKENS",
"minter":"Paste your test1 wallet address here"
}
}
}
},
"mainnet": {
"_connection": {
"chainID": "phoenix-1",
"URL": "https://lcd.terra.dev"
}
},
"testnet": {
"_connection": {
"chainID": "pisco-1",
"URL": "https://pisco-lcd.terra.dev"
}
</CH.Scrollycoding>
Be sure to double-check the parameter values in your instantiate message and save the changes to your config.terrain.json file before exiting.
You are finally ready to deploy your contract and run the NFT minting application. Make sure you have installed Terrain before proceeding.
-
Ensure you are still running LocalTerra in a separate terminal window.
-
Open a new terminal window and run the following commands to navigate to your cloned repo and deploy your contract using Terrain.
cd my-nft-project/nft-on-terra terrain deploy cw721-metadata-onchain --signer test1
Once the contract deployment has successfully completed, you can run the front end application to start minting your NFT.
-
Change into the
frontenddirectory and install the node dependencies.cd frontend npm install -
Start the front-end application:
npm start
Your Chrome browser should open a new window and you should be viewing the front-end application at http://localhost:3000/.
-
Station will ask you to Connect to the application. Click Connect.
-
Fill out all of the information on the form to mint your first NFT.
-
ID may be any value that you would like to correspond to the ID of the new NFT.
-
Enter the Name for your NFT.
-
The Owner Address is the wallet address which will be the owner of the newly minted NFT. In this tutorial, this will be your
test1wallet address. -
Use the following URL for the NFT image of Luna used in this tutorial.
https://assets.terra.money/icon/svg/LUNA.png
Most NFT creators host their NFTs using IPFS (Interplanetary File System). There are a variety of resources available to post an NFT on IPFS, such as Pinata. In this example, the image used is available at https://assets.terra.money/icon/svg/LUNA.png.
Your NFT is ready to mint!
-
Click Mint NFT. Your Station extension will pop up to request confirmation of the transaction.
-
Click the Post Button.
After a few seconds, the front-end webpage will display your NFT.
<img className="readme-img-md" src="/img/nft/minted_nft.png" alt="Minted NFT" />
{/*
Congratulations, you have just minted your first NFT!
-
Before you can view your NFT, you'll need to locate your contract address. Open the
refs.terrain.jsonfile located in your cloned repository and copy the contract address listed after"default".{ "localterra": { "cw721-metadata-onchain": { "codeId": "1", "contractAddresses": { "default": "Copy this address" } } } } -
You can view your NFT utilizing the Station NFT page. Connect your wallet using the Connect button located in the upper right-hand corner of the screen.
-
Click Add tokens > located in the middle of the page to open the contract search window. Paste your contract address in the search bar. Click the + button located next to the address of your NFT collection.
-
Close the search window and you will be presented with information on your NFT collection.
From here, you can View relevant information about your NFT or Send your NFT to any specified wallet address.
*/}
You've just minted your first NFT on the Terra blockchain! If you have your own unique digital creation that you would like to share with the world, you can follow these instructions using the mainnet network and your personal Station wallet.
LocalTerra is not needed for deployments on the mainnet and is primarily used for local testing and development purposes.







