NFT MarketPlace on DigitalBits BlockChain

NFT MarketPlace on DigitalBits BlockChain

What is DigitalBits Blockchain, what are NFT's and How to Build NFT's on DigitalBits and My work experience.

Introduction

DigitalBits Is a consumer first open source blockchain, which helps you to create digital assets. Assets like Loyalty points, gift cards, fan tokens, digital currencies and more.​ The DigitalBits blockchain can process up to 10,000 transactions per second and uses the Federated Byzantine agreement consensus mechanism that makes the network eco-friendly.

It has an average transaction fees of less than 0.1 USD. and it can execute 3000+ transactions per second.

What are NFT's

NFT's basically means Non Fungible tokens. They are used to represent any asset which is unique. You might be confusing it with cryptocurrencies. But the basic difference between cryptocurrencies and NFT's is it's fungibility aka its uniqueness. There can be multiple bitcoins but there can be only one NFT for a particular thing. You can think of it in terms of money and property. Money is same for everyone, same value, you can exchange 100 Rs note with another 100 Rs note but You can't exchange a property with another property as it is unique in it's characteristics.

Why DigitalBits for NFT's

Digital Bits is a fast blockchain with very low transaction fee. It has inbuilt support for creating assets. It has user friendly SDK to build applications and great Docs to get started with.

How to Create NFT's on DigitalBits

Digital Bits doesn't have an inbuilt support for creating NFT's but a work around for this is to use stroop(0.0000001) which is the smallest value possible for an asset on XDB for it's representation on the blockchain. Also Digitalbits does not have smart contracts as such though it has a great SDK to build transactions, Therefore we need to write transactions in a function which basically represent Smart contracts.

Example of a transaction looks like this

const server = new DigitalBitsSdk.Server('https://frontier.testnet.digitalbits.io')
const source = DigitalBitsSdk.Keypair.fromSecret('SCCCQQFNTF3RRIQYWIWLJUN6HEANTHASMIU57B6EESA2IBFYZFTN6Z3C')
const destination = DigitalBitsSdk.Keypair.random()

server.accounts()
  .accountId(source.publicKey())
  .call()
  .then(({ sequence }) => {
    const account = new DigitalBitsSdk.Account(source.publicKey(), sequence)
    const transaction = new DigitalBitsSdk.TransactionBuilder(account, {
      fee: DigitalBitsSdk.BASE_FEE,
      networkPassphrase: Networks.TESTNET
    })
      .addOperation(DigitalBitsSdk.Operation.createAccount({
        destination: destination.publicKey(),
        startingBalance: '100'
      }))
      .setTimeout(30)
      .build()
    transaction.sign(DigitalBitsSdk.Keypair.fromSecret(source.secret()))
    return server.submitTransaction(transaction)
  })
  .then(results => {
    console.log('Transaction', results._links.transaction.href)
    console.log('New Keypair', destination.publicKey(), destination.secret())
  })

Also as you don't not have smart contract kind of thing deployed on blockchain here, so we need to build a blockchain backend or you can say API's to send and receive transactions.

My Project of building NFT MarketPlace on DigitalBits

Under my Internship I worked on making a NFT marketplace where you can mint NFT's by uploading Images or videos to the platform and then performing the following transactions using that:-

  • You can sell NFT by providing a trade price
  • You can buy NFT by sending the trade amount
  • You can put NFT for Auction with a reserve price
  • You can bid for an auction
  • You can transfer a NFT to other user

Basically In my platform you first upload data to a S3 bucket and then pass it on to the Pinata IPFS blockchain to store the image and metadata on it. It provides a unique hash in return which is then on minting stored in the data field of issuing account of NFT asset. The rest of transaction we do are like the transfer of amount to accounts, putting the nft in order book of blockchain and executing transactions. To secure data and restrict the issuing account from minting more assets we lock the issuing account by setting the weight field to 0. MongoDB stores almost all this data and is also responsible for generating unique ids for asset which helps in easy fetching of data and transacting stuff using that.

When a user calls the API for minting or for any other transaction, my backend creates and builds transaction for the user and doing the necessary signing that is required. After this it sends back a transaction envelope or you can say XDR to user, which user needs to sign and submit to confirm transaction. This creates another level of security and checks for performing blockchain transactions.

RabitMQ is also used to queue all transactions so that all are executed in right manner.

Cost of transactions

The minting cost comes out to be only 30 XDB and average transactions cost is almost less than 0.1 USD as of now. The transaction confirmation time is 3 to 5 seconds.

Tech Stack

Tech stack Used to build the blockchain backend is:

  • Nodejs
  • Pinata
  • MongoDB
  • IPFS
  • AWS
  • RabitMQ
  • DigitalBits SDK
  • Docker
  • Postman for testing

Conclusion

It was great to work on such an amazing project where I got to learn about totally new way of minting nfts and performing transactions that to be with out smart contracts. I would like to express thanks to accubits and Bennett University for the support.