Guide to creating an NFT-Ticket Booking Dapp using Express Protocol SDK
NFT Tickets are unleashing the unlimited potential for revenue-generating opportunities; thus encouraging a lot of event organizers to create their own NFT-Ticket Booking Dapps. But, the issue is most of the organizers are unfamiliar with the intricacies of blockchains or smart contracts which intimidates them to jump into the development of a Dapp of their own. No worries, Express Protocol got you covered with Multichain Data-Rich Express SDK.
Express Protocol is a decentralized, interoperable NFT Market gateway that provides a one-stop solution for users interested in creating their NFT Dapps. The hybrid technology of Express SDK eliminates all the technical hassle and allows you to create your NFT-Ticket Dapp with few lines of code in just a matter of time.
Sharing a complete guide on how to create NFT-Ticket Dapp? to simplify the process for you.
Some of the prerequisites, you must require before building the project:
- NodeJS version > 16.0.0
- NPM version > 6.0.0
- Metamask Browser Extension
- Parcel Bundler(For bundling Javascript)
Here are the steps to build your own NFT-Ticket Booking:
1. First, you need to create an empty folder in your favorite editor. Here, we’re using VScode for the editor and Parcel for bundling the javascript code.
npm init
npm i pandora-express
npm install -g parcel-bundler
2. Next, you need to install the SDK and run it in the terminal.
3. Then build a UI and make an index.html file to paste the following codes mentioned below.
Now, you need to run the app with the liver server.
After pasting all the codes, your NFT-Ticket Booking Dapp will look something like this:
4. Finally, you’re here. The only step left is to get the function parameters using javascript DOM and then paste the below-mentioned codes to the main.js.
const { createPandoraExpressSDK } = require(“pandora-express”);init = async () => { if (window.ethereum) { window.web3 = new Web3(window.ethereum); await window.ethereum.enable(); console.log(“Connected”); } else { alert(“Metamask not found”); } };createCollection = async () => { let ExpressSDK = createPandoraExpressSDK(); const accounts = await web3.eth.getAccounts(); const chainId = await web3.eth.net.getId(); console.log(chainId); const result = await ExpressSDK.erc1155.collection.createCollection( web3, chainId, accounts[0], collectionURI.value, collectionDescription.value, [[accounts[0], collectionRoyalties.value]] );console.log(result); };mintInCollection = async () => { let ExpressSDK = createPandoraExpressSDK(); const accounts = await web3.eth.getAccounts(); const chainId = await web3.eth.net.getId(); console.log(chainId); const result = await ExpressSDK.erc1155.collection.mint( web3, collectionAddress.value, tokenID.value, itemColNumber.value, tokenURI.value, accounts[0] ); console.log(result) };sellInCollection = async () => { let ExpressSDK = createPandoraExpressSDK(); const accounts = await web3.eth.getAccounts(); const chainId = await web3.eth.net.getId(); console.log(chainId); const result = await ExpressSDK.erc1155.collection.sellNFT( web3, chainId, sellCollectionAddress.value, sellTokenId.value, sellPrice.value, accounts[0], itemSellNumber.value ); console.log(result) };const collectionURI = document.getElementById(“collection1155Uri”); const collectionDescription = document.getElementById(“collection1155Description”); const collectionRoyalties = document.getElementById(“collection1155Royalties”); const CollectionButton = document.getElementById(“btnCreateCollection1155”); CollectionButton.onclick = createCollection;const collectionAddress = document.getElementById(“collection1155Address”); const tokenURI = document.getElementById(“token1155URI”); const tokenID = document.getElementById(“token1155Id”); const itemColNumber = document.getElementById(“numMintInCol1155Amount”); const btnMintInCollection = document.getElementById(“btnMintInCollection1155”); btnMintInCollection.onclick = mintInCollection;const sellCollectionAddress = document.getElementById(“sellCollection1155Address”); const sellTokenId = document.getElementById(“sell1155TokenId”); const sellPrice = document.getElementById(“sell1155Price”); const itemSellNumber = document.getElementById(“numSellInCol1155Amount”); const btnSellInCollection = document.getElementById(“btnSellInCollection1155”); btnSellInCollection.onclick = sellInCollection;init();
Now run in terminal
parcel index.html
Congratulations! You’ve successfully created your first NFT-Ticket Booking Dapp with Express SDK. Now, you can simply trade your NFT-Tickets on the cross-chain network of Express and enjoy the benefits of increased liquidity. And if you need more information regarding the development process, then visit Express Protocol.