Posts

Issue an NFT on Elrond: from A to Z (EGLD NFT)

avatar of @tcsenpai
25
@tcsenpai
·
·
0 views
·
4 min read

How to pioneer into EGLD NFT ecosystem in 6 simple steps

Written by the Elrond Dragons team: join us and take your airdrop!

0. Pre requisites

There are some requisites you need to address to follow this guide. The first is the access to a Linux / MacOS console (better if a server, but a local one is good as well).

You could theoretically follow these paths on a powershell console, but I strongly suggest you to use a Bash shell.

On Windows, you can download and use Bash following this tutorial or using GIT Bash. Note that this method is experimental and is not meant to be official.

You have to install erdpy following the official guide, follow the manual route if erdpy-up is not working for some reasons (e.g. you are root).

As long as you can run

erdpy

you are good to go.

1. Create or import a wallet

To start using erdpy, you must use a .pem wallet generated by the command line utility itself.

To do that, you can either create a new one or import your own using your mnemonic phrase (only do that if you are working in a secure environment: this is the access to your wallet and anyone can do anything with your money with it).

Issue this command to create a wallet and note the .pem file name

erdpy wallet derive — mnemonic main.pem

Take note of the “erd…” address as well.

2. Create a NFT collection

The next step is to create a collection to store our NFTs in.

Before continuing, it is important to point that every operation involving parameters in erdpy must be performed with hex values (0x…) . There are countless tools to convert from and to hex, but I suggest you one of the fastest and completely free: Hex to ASCII | Hex to Text converter

That said, keep the ASCII to HEX converter tab opened and choose a name for your NFT collection. In this example, we will use “AWESOME” (we did the same with https://t.me/elrondragons).

Convert AWESOME to hex:

Remember to use 415745534f4d45 with 0x in front of it in the next step.

Repeat the same process for your ticker (ex. AWSM): this will be your NFT collection short name. In our case, the output is 4157534d.

Issue this command to create a collection (it costs 0.05 EGLD), replacing the hex values with the right ones:

erdpy contract call erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzllls8a5w6u --function issueNonFungible --arguments 0x415745534f4d45 0x4157534d --recall-nonce --gas-limit 60000000 — pem main.pem --send --value 50000000000000000

Finally, check your address page at this

https://gateway.elrond.com/address/YOUR_ADDRESS/registered-nfts

Or issue

curl https://gateway.elrond.com/address/YOUR_ADDRESS/registered-nfts

To get a list of your collections. Note your collection name (e.g. AWESOME-KG4B) and hex it to obtain 415745534f4d452d4b473442.

3. Get your address HEX value

We need another small info before continuing.

Don’t worry, is an easy one!

Simply, replace your erd address in this snippet to obtain the hex value needed to continue:

erdpy wallet bech32 --decode erd1nl38ewqjetkw84jaf75577pz4lmv6zmfgrx2y6kcm9eulsxfs32s6n6x4c

4. Set minting role to your address

To be able to issue new NFTs, you will need to grant yourself minting permissions. On the Elrond network, this permission is called ESDTRoleNFTCreate.

To do that, issue this:

erdpy contract call erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzllls8a5w6u --function setSpecialRole --arguments 0x454c4452412d613437663334 0x9fe27cb812caece3d65d4fa94f7822aff6cd0b6940cca26ad8d973cfc0c98455 0x45534454526f6c654e4654437265617465 --recall-nonce --gas-limit 60000000 --pem main.pem --send

As you can see, the arguments are:

  • The collection name
  • Your hex address
  • A fixed field meaning ESDTRoleNFTCreate in hex

5. Create your NFT

This is the final and most complex part, and it needs some steps to achieve a working results. First of all, let’s take a moment and understand what is contained in a NFT issuing transaction:

  • Collection name in HEX
  • Quantity
  • NFT Name in HEX
  • Royalities percentage in cent
  • Are there attribute (1 or 0)
  • Attributes separated by ; (description:[…];key1:[…];key2:[…])
  • Image link in HEX
  • JSON metadata link in HEX

Each one of this fields must be present in the transaction in this exact order, so to allow marketplaces like EMoon and DeFi wallets to read the NFT data correctly.

The last two points are the least trivial ones:

  • To obtain a decentralized, secure and permanent link for your image you can either use IPFS (through a free pinning service like Pinata, or Arweave if you really want to achieve maximum persistance (as unused IPFS files are submerged). To use Arweave, you have to follow Arweave wallet guide to set up a wallet and then you can use a service like ArDrive to obtain Arweave links. Anyway, IPFS is more than enough usually

  • To create a proper JSON file, write in your favorite code or text editor a file following this skeleton:

{“name”:”Your single NFT name”,”description”:”feel free to write what you want here”,”properties”:[{“key”:”Unique ID”,”value”:”0"},{“key”:”Special Notes”,”value”:”test 1"}],”image”:”https://thelinktoyourim.ag/e.png"}

Proceed to load the JSON file in IPFS or Arweave and hex that link too

Having the two links encoded, remember to write and encode a string containing all the metadata needed as in point 6.

An example is:

description:A fully grown, unique and magical Dragon that decided to move from the depth of Valinor to the Elrond blockchain;Unique ID:#0;Special notes:first test

With all these infos, you should have everything you need to build your transaction.

Let’s break the tx and see what we have got:

erdpy contract call erd1nl38ewqjetkw84jaf75577pz4lmv6zmfgrx2y6kcm9eulsxfs32s6n6x4c --function ESDTNFTCreate --arguments 0x454c4452412d613437663334 1 0x456c726f6e64277320447261676f6e202331 50 1 0x6465736372697074696f6e3a412066756c6c792067726f776e2c20756e6971756520616e64206d61676963616c20447261676f6e2074686174206465636964656420746f206d6f76652066726f6d20746865206465707468206f662056616c696e6f7220746f2074686520456c726f6e6420626c6f636b636861696e3b556e697175652049443a23303b5370656369616c206e6f7465733a6669727374207465737420 0x68747470733a2f2f696e746572706c616e65746172796b69746368656e2e6d7970696e6174612e636c6f75642f697066732f516d51326a395661516672774248747675513346785645345144393766637057356f5163374d4770333342456551 0x68747470733a2f2f696e746572706c616e65746172796b69746368656e2e6d7970696e6174612e636c6f75642f697066732f516d523769706b57553746316a46314b6b4b34673269615a6b51424875743634526f74555a5532695a41486e4d67 --recall-nonce --gas-limit 70000000 --pem main.pem --send

The first argument is the collection name, followed by the supply number, the single NFT name, the royalities in cent, the flag activating the attributes, the attribute string itself, the image link and finally the json metadata link.

It could appear a little complicated but, after all, its just a bunch of arguments hex encoded one after another.
Feel free to copy-paste the example TX and modify it as needed. Remember, however, to change the address after call as it needs to be yours.

Send the command and here you are, you did your first NFT on Elrond!

Remarks

Now that you know how to create NFTs the easy way on Elrond blockchain, you can also see them and sell them on all the major marketplaces like EMoon, or send them through your wallet.

If this guide helped you, feel free to like this article and to join (https://t.me/elrondragons)[https://t.me/elrondragons], our NFT project with active airdrops and contests!

Posted Using LeoFinance Beta