How to develop an NFT using Stellar Blockchain
Tags: blockchain, codenewbie, computerscience
Published: 2021-07-01 19:38:33

## Key Definitions

### What is an NFT?

A non-fungible token (NFT) is a unit of data stored on a digital ledger, called a blockchain, that certifies a digital asset to be unique and therefore not interchangeable. NFTs can be used to represent items such as photos, videos, audio, and other types of digital files.

### What is Stellar?

Stellar is a distributed ledger technology that allows anyone to build low-cost and fast financial services. Stellar has some of the best documentation and tutorials to help a blockchain developer get started quickly.

### What is a lumen?

Lumens are the tokens used by the wider Stellar Network, to send sums of money and convert currency.

### What is a Stellar Laboratory?

The Stellar Laboratory is a set of tools that enables people to try out and learn about the Stellar network. The laboratory can build transactions, sign them, and submit them to the network. It can also make requests to any of the Horizon endpoints.


## Foolish Assumptions

1. You have an internet connection
2. You have a laptop
3. You are eager to learn


## Quick Summary

We will build a Non-Fungible Token using two keypair accounts issuer and distributor on the stellar testnet . We will make use of the [Stellar laboratory](https://laboratory.stellar.org/) to make the learning experience accessible and awesome.🤗


## These are the steps that we will cover 

#### 1. Create a 2 keypair  accounts
#### 2.  Fund the accounts 
#### 3. Create a trustline
#### 4. Create the NFT
#### 5. Lock Issuing account
#### 6. Sign and Submit blockchain transaction
#### 7. Explore the Accounts and NFT


## Step 1:  Creating two stellar keypair accounts

Firstly , let's go to the [stellar laboratory link](https://laboratory.stellar.org) and make sure you are using testnet 

![Screenshot 2021-07-01 at 15.59.30.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1625147976708/GrHnvGrGU.png)

Click the  `Generate Keypair` purple button to generate the first key pair. Repeat the process to create the second keypair account.

![Screenshot 2021-07-01 at 16.06.56.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1625148421415/w1uvF7c2j.png)

In my case, these are the public keys for the two accounts I created. Make sure you don't mix up the two accounts 😜😜

```
Distributor
Public Key
GB4CQMAJEFBR4KWZHR4WY4SXIT5DXME6F4BUPNCIYTU4RIKLHU5XIYV6

Issuer
Public Key
GBT6JLUJ5JB2LVSRLR24EBQVIQAX23EMGJ4S7F3OF6B7GNOOCXWZTXDG
```
## Step 2:  Funding the two stellar keypair accounts

Next , we fund both accounts with 10,000 lumens on the test network using Friendbot. 

Just add the public key for the account you want to fund and click on `Get test network lumens`.

![Screenshot 2021-07-01 at 16.33.49.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1625150033275/vzrD6O0PE.png)

![Screenshot 2021-07-01 at 16.34.04.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1625150047625/SB_GympIh.png)

## Step 3:  Creating a trustline between the issuer and distributor

In the third step let's set up a trustline between the issuer and the distributor. A Trustline in Stellar explicitly implies that the distribution account trusts the issuing account with the handling of the assets issued.

Firstly , we go to the transaction builder tab. The transaction builder lets us build a new Stellar transaction on the Stellar Network.

![Screenshot 2021-07-01 at 19.47.38.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1625161663812/nFl8mVshV.png)

Let's add the public of the issuer in `Source account` field and generate the Transaction Sequence Number by clicking `Fetch next sequence number for account starting with "GBT6JLUJ5J"` purple button below that field.

![Screenshot 2021-07-01 at 16.38.54.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1625150339990/lUC5apwsz.png)

Next, let's go to the Operation Type field and select `Change Trust` option from the dropdown. On the Asset field, we named our asset `"StellarNFT"` and added the issuer account public Id. On the `Source Account` field, we added the distributor public Id.

![Screenshot 2021-07-01 at 16.40.53.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1625150457342/YkDprZu_Y.png)

## Step 4:  Creating the Non-Funguiable Token 

In this step , we create the NFT we start by adding another operation below the trustline operation.

![Screenshot 2021-07-01 at 20.48.35.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1625165322164/KXVfzwfby.png)

This will be our second operation and we select the  `Payment` operation as the operation type from the dropdown. Add the distributor account public Id in the `destination` field .

Next , we create our asset by selecting `alphanumeric 12` and adding our Asset code in this case it's `StellaNFT`. Then we add the issuer public id in the next field and lastly, we add the amount of token we want to create.

![Screenshot 2021-07-01 at 16.43.44.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1625150630641/p1xEkGptJ.png)

Lastly , we add metadata to our NFT which in this case is an image from Imgur . Lol we are a bit lazy to do anything complex but this is enough to get the point across

![Screenshot 2021-07-01 at 16.48.49.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1625150934881/iaypCFETEC.png)

Quick one checkout [IPFS](https://ipfs.io/) and how it's used in the distributed web. The InterPlanetary File System (IPFS) is a protocol and peer-to-peer network for storing and sharing data in a distributed file system. When building a real-world NFT I recommend using IPFS.

![Screenshot 2021-07-01 at 16.47.11.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1625150838378/Kcw82Lo7F.png)


## Step 5:  Locking the issuing account 

In step 5 , we go on the `Operation Type` field and select the `Set Options` option from the dropdown. Let's go to the `Master Weight` field and add a value of `0` .This will prevent the issuer from minting more tokens in the future and it's optional.

![Screenshot 2021-07-01 at 16.50.10.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1625151015958/NWIP0k4YZ.png)

## Step 6:  Signing and Submitting Transaction

Firstly , we click the `Sign in Transaction Signer` button near the footer of the page and this will
give us a transaction overview and Signatures fields.

Below is the Signatures field where we add the issuer secret id  in the `Add Signer` field and click `Sign with BIP path` button 

![Screenshot 2021-07-01 at 21.15.12.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1625166917771/2PSa2N8Jj.png)

Lastly, we submit the transaction as shown by the images below: 

![Screenshot 2021-07-01 at 21.11.14.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1625166682830/yPOFdDaIb.png)

![Screenshot 2021-07-01 at 16.54.36.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1625151283542/dH3Jb_hfQ.png)

![Screenshot 2021-07-01 at 16.56.50.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1625151415632/IuJoPgVaf.png)

## Step 6:  Exploring the stellar accounts and NFT

![Screenshot 2021-07-01 at 16.52.33.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1625151160120/FMBBZ-056.png)

You made it to the final step!! 🤗 Here we navigate to [ Stellar Explorer](https://stellar.expert/explorer/testnet/) to check out all accounts . Feel free to play around using the public ids of the issue and distributor. 

![Screenshot 2021-07-01 at 16.57.20.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1625151444704/18ItcHx2q.png)

![Screenshot 2021-07-01 at 16.58.26.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1625151511384/NvnVe67Tu.png)

You also check out the NFT we created using this link https://stellar.expert/explorer/testnet/asset/StellarNFT-GBT6JLUJ5JB2LVSRLR24EBQVIQAX23EMGJ4S7F3OF6B7GNOOCXWZTXDG

![Screenshot 2021-07-01 at 16.58.47.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1625151531928/vrtfcyW5l.png)

![Screenshot 2021-07-01 at 17.00.59.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1625151665459/O0lizloyJ.png)

### Conclusion🤓

Check out my previous article on NFTs: [How to create an NFT on Ethereum Blockchain ](https://dev.to/cypriantinasheaarons/how-to-create-an-nft-on-ethereum-blockchain-3j8l)

You have successfully built and deployed an NFT on the Stellar blockchain . 🚀 . Congratulations!! .

But I recommend you start building something blockchain-related using stellar as quickly as possible  🦾 
 
> 🙏Thanks to [Stellar ](https://www.stellar.org/?locale=en) 

>  🙏Thank you for reading this -Follow me on [Twitter](https://twitter.com/CyprianAarons)

> Checkout my [website](cyprianaarons.co.zw).

<a href="https://www.buymeacoffee.com/cyprianaarons" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" style="height: 60px !important;width: 217px !important;" ></a>