Giter Club home page Giter Club logo

nft-on-terra's Introduction

Minting an NFT on the Terra Blockchain

NFTs have been generating a lot of buzz in the blockchain community for some time now, particularly in the digital art space. NFTs, or non-fungible tokens, are unique digital assets that may be showcased and bought/sold on the blockchain. Purchasing an NFT gives you ownership over the unique digital creation, somewhat similar to buying a distinct painting or art piece.

In this tutorial, we will go over how you may transfer your digital art to the blockchain, minting your own NFT. Transferring your NFT to the Terra blockchain allows for exposure to millions of users who utilize the Terra ecosystem worldwide.

If you would like to view available collections that are on sale on the Terra blockchain, you may navigate to randomearth marketplace.

Getting Started

These instructions assume that you have already set up a Terra Station wallet in order to interact with the Terra blockchain. You may create a new wallet on the Terra Station extension on Google Chrome which you will need to install in order to confirm transactions on the application.

You will also need to install LocalTerra, a Terra blockchain and test environment which runs on your personal computer, and Terrain, a Terra development environment for smart contract development. Be sure to carefully follow the instructions to install all necessary dependencies for both LocalTerra as well as Terrain and ensure that they are both running properly on your system.

After installing the above dependencies, you may clone this repository, which contains the smart contract with NFT minting functionality as well as the corresponding front end application, to the directory of your choice utilizing the following command.

git clone --depth 1 https://github.com/terran6/nft-on-terra.git

Change directory into the cloned repository and run the command npm install in your terminal to install all relevant Node dependencies. If you have not installed Node.js or npm (Node Package Manager) on your computer, you may find the download link to install the required Node.js LTS version 16 along with npm for your operating system here.

Wallet Setup

There are a few changes you will have to make before you can deploy your smart contract and create your first NFT. First, you will need to ensure that LocalTerra is active and running on a tab in your terminal throughout this tutorial. To test your smart contract functionality, you will be utilizing the preconfigured LocalTerra testing wallet test1. This wallet will be available on any Terra Station generated wallet. In order to view your test1 wallet, you may navigate to LocalTerra on your Terra Station extension on Google Chrome and switch your wallet to the preconfigured test1 wallet.

Change Network to LocalTerra

Open the Terra Station extension on your Google Chrome web browser. Click on the settings icon in the upper right-hand corner and select the localterra network.

Switch to LocalTerra

Switch to Test Wallet

Next, you will click on Switch wallet, then click on Preconfigured wallets... from the subsequent pop-up and finally select test1 from the drop-down list that appears.

Switch Wallet Select Test Wallet

Now that you have successfully switched to the test1 wallet on LocalTerra, you have setup your environment to be able to deploy your smart contract.

Contract Setup & Deployment

Updating the Instantiate Message

Before you may deploy your contract and begin minting your NFT, you must make a change to the config.terrain.json file in this repository. Open this file and find the instantiate message section below.

"instantiateMsg": {
  "name":"NFT Collection Name",
  "symbol":"NFTSYMBOL",
  "minter":"terraxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}

You must first update the name and symbol that will correspond to your NFT collection with which your minted NFTs will be associated. Also, the minter will have to be updated to your test1 wallet address. This may be copied directly from your Terra Station extension.

Copy Wallet Address

In this tutorial, we will be minting an NFT of Luna, the native token of Terraform Labs, to our Cryptocurrency Token NFTs collection. Therefore, we will update the parameters in the instantiate message to the following:

"instantiateMsg": {
  "name":"Cryptocurrency Token NFTs",
  "symbol":"TOKENS",
  "minter":"terra111111111111111111111111111111111111111"
}

Deploy Contract to LocalTerra

Now, you are finally ready to deploy your contract and run the NFT minting application. First, ensure you are running LocalTerra in a tab on your terminal. If you need to view instructions on how to get LocalTerra up and running, please refer to the LocalTerra documentation.

Once LocalTerra is up and running, run the following command in another tab of your terminal in order to deploy the contract with your test1 wallet as the owner.

terrain deploy cw721-metadata-onchain --signer test1

Mint an NFT!

Once the contract deployment is successfully completed, you may change into the frontend directory. From here, you must run npm install to install all necessary Node dependencies. Finally, you may run the command npm start to start up the NFT minting application.

NFT Minting Application

As shown above, you may fill out all of the necessary 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. The Owner Address is the wallet address which will be the owner of the newly minted NFT (our test1 wallet address in this case). You may then enter a name for the NFT as well as input its corresponding URL. For this tutorial, we will minting an NFT of Luna, the native token of Terra, available at the following URL:

https://assets.terra.money/icon/svg/LUNA.png

NFT URL Note: In general, many prefer to host their NFTs on IPFS (Interplanetary File System). You may use a variety of resources in order to post an NFT on IPFS. One service that you may utilize is Pinata. In this example, I have used an image available at terra.money.

Now, you are ready to mint your NFT! Click on the Mint NFT button which will make your Terra Station extension pop up to request confirmation of the transaction. Click on the Post button from your Terra Station extension and you will be presented with information on your newly minted NFT!

Minted NFT

View Your New NFT

Now that you have minted your NFT, you may interact with it via the NFT webpage on the Terra Station website. If your wallet is not already connected, make sure to click on the Connect button in the upper right-hand corner of the screen and select your Terra Station Wallet.

Connect Wallet

Next, click on Add tokens > and you will be presented with a pop-up box with a search bar. In this search bar, you will be pasting in your contract address. This can be found in this repository in the refs.terrain.json file next to the default key.

{
  "localterra": {
    "cw721-metadata-onchain": {
      "codeId": "1",
      "contractAddresses": {
        "default": "terra222222222222222222222222222222222222222"
      }
    }
  }
}

Copy this address, paste it into the search bar and click on the + button located next to the name of your NFT collection.

Search NFT Collection

Now, you may close out this window and you will be presented with information on your NFT collection.

NFT Collection

As shown in the image above, we have our NFT presented in our Cryptocurrency Token NFTs collection. From here, we may View relevant information about our NFT as well as Send our NFT to any specified wallet address. You may utilize the application to mint even more NFTs for your collection as desired and interact with them on this webpage.

Congratulations!

You have now 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 and are comfortable with the steps to mint an NFT on Terra, you may follow these instructions utilizing the mainnet network on your personal Terra Station wallet.

NOTE: LocalTerra is not needed for deployments on mainnet and is only utilized for local testing and development purposes.

nft-on-terra's People

Contributors

octalmage avatar terran6 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

nft-on-terra's Issues

Deploy cw721 contract to localterra (Out of gas)

AxiosError: Request failed with status code 500
Response: out of gas in location: Compiling wasm bytecode; gasWanted: 3000000, gasUsed: 3742289: out of gas
[cosmos/[email protected]/baseapp/recovery.go:55] With gas wanted: '3000000' and gas used: '3742289'
Code: ERR_BAD_RESPONSE

I have a problem deploying a cw721 contract to localterra, can someone help me?

400 error on deploying contract on localterra: "Error calling the VM: Error during static Wasm validation: Wasm contract has unknown interfaceversion*"

I'm a noob and newbie, trying to explain from what I understood :). Problem seems to relate using wron CosmWasm version resp. needs to be updated for working on Terra 2.
Tried to update dependencies Cargo.toml, but then I get an 404 error when deploying. Find details describe on new Terra (not classic) discord:

Multiple instantiateMsg's

Is there a way to have mutliple instantiateMsg's configured in the config.terrain.json?

I have multiple contracts I want to be able to deploy, namely the NFT 721 contract and then my own.

Right now i just create a copy of the json file with two different instantiateMsg objects defined and rename them as needed, but it would be nice to be able to pass in a flag in the deploy command and it will use a specific instantiateMsg from this file.

Thanks

failed to fetch `https://github.com/rust-lang/crates.io-index`

I followed README and changed config.terrain.json:

    "instantiateMsg": {
     "name":"Cryptocurrency Token NFTs",
     "symbol":"TOKENS",
     "minter":"terra1x46rqay4d3cssq8gxxvqz8xt6nwlz4td20k38v"
   }

Then when I deploy I get this:
$ terrain deploy cw721-metadata-onchain --signer test1
using pre-baked 'test1' wallet on localterra as signer
Updating crates.io index
Downloaded serde_derive v1.0.138
Downloaded serde v1.0.138
Downloaded 2 crates (131.1 KB) in 0.32s
Compiling proc-macro2 v1.0.40
Compiling quote v1.0.20
...
Finished release [optimized] target(s) in 27.30s
Info: RUSTC_WRAPPER=sccache
Info: sccache stats before build
Compile requests 0
Compile requests executed 0
Cache hits 0
Cache misses 0
Cache timeouts 0
Cache read errors 0
Forced recaches 0
Cache write errors 0
Compilation failures 0
Cache errors 0
Non-cacheable compilations 0
Non-cacheable calls 0
Non-compilation calls 0
Unsupported compiler calls 0
Average cache write 0.000 s
Average cache read miss 0.000 s
Average cache read hit 0.000 s
Failed distributed compilations 0
Cache location Local disk: "/root/.cache/sccache"
Cache size 0 bytes
Max cache size 10 GiB
Building contract in /code ...
Updating crates.io index
warning: spurious network error (2 tries remaining): failed to resolve address for github.com: Try again; class=Net (12)
warning: spurious network error (1 tries remaining): failed to resolve address for github.com: Try again; class=Net (12)
error: failed to get serde as a dependency of package cw721-metadata-onchain v0.13.2 (/code)

Caused by:
failed to fetch https://github.com/rust-lang/crates.io-index

Caused by:
network failure seems to have happened
if a proxy or similar is necessary net.git-fetch-with-cli may help here
https://doc.rust-lang.org/cargo/reference/config.html#netgit-fetch-with-cli

Caused by:
failed to resolve address for github.com: Try again; class=Net (12)
Error: Command failed: docker run --rm -v "$(pwd)":/code --mount
type=volume,source="$(basename "$(pwd)")_cache",target=/code/target --mount
type=volume,source=registry_cache,target=/usr/local/cargo/registry
cosmwasm/rust-optimizer:0.12.5

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.