Table of Links
V. Limitations and Future Work, Conclusion, and References
II. DESIGN AND IMPLEMENTATION
The development process of our NFT Marketplace dApp involved several key stages, including designing the user interface, implementing smart contracts on the blockchain, integrating with third-party APIs, and conducting testing and evaluation. In this section, we provide a detailed overview of each stage, including the tools and technologies used, the challenges encountered, and the solutions developed. Additionally, we describe the methodologies used for connecting users’ wallets securely, generating unique NFTs using deep learning models, minting NFTs on the blockchain, developing the marketplace for trading NFTs, and creating user profiles to manage NFT collections. By providing a comprehensive account of our development process, we aim to provide insights and best practices for building user-friendly and secure dApps for managing and trading digital assets on the blockchain.
A. Wallet Connect
The Wallet Connect feature is a critical component of the NFT Marketplace dApp as it enables users to securely connect their cryptocurrency wallets to the dApp without exposing their private keys. This is achieved through the use of Metamask [11], a popular browser extension that acts as a bridge between the user’s browser and their cryptocurrency wallet.
When a user accesses the NFT Marketplace dApp, they are prompted to connect their wallet through Metamask. Once connected, the user can interact with the dApp’s features, such as generating and minting NFTs, without having to manually input their private keys. This eliminates the risk of key theft or unauthorized access to the user’s digital assets.
To enable secure and user-friendly interaction with the NFT Marketplace dApp, we utilized React.js [6] with Ether.js[7], a popular library for interacting with Ethereum-based networks. This library allowed us to connect the dApp with users’ cryptocurrency wallets through the Metamask browser extension. The Ether.js library provided a simple and intuitive API for sending and receiving data from the blockchain, making it easy for us to integrate the dApp with the Ethereum [5] network.
B. NFT Generation
NFT generation is a crucial aspect of our application that involves using a deep learning model to create unique NFT images based on user input. To implement this feature, we utilized the OpenAI API [4], which provides access to a pretrained DALL·E model capable of generating images from text prompts.
To generate an NFT, a user inputs a set of seed words or phrases that describe the desired characteristics of the NFT. These inputs are passed through our backend Express[8] server that communicates with the OpenAI API, which generates a unique image using the DALL·E model. This model is trained on a massive dataset of images and text prompts, which enables it to generate high-quality and diverse NFT images based on user input. The use of a deep learning model also allows for the creation of personalized and unique NFTs that cannot be easily replicated.
The integration of blockchain technology and deep learning in the NFT generation process allows for the creation of valuable and distinctive digital assets. By leveraging the power of these technologies, the NFT Marketplace dApp provides a unique and exciting way for users to create, own, and trade NFTs.
C. NFT Minting
NFT minting feature enables users to create and sell unique digital assets on the blockchain. To implement this feature, we utilized a combination of the OpenAI API, IPFS, and the Ethereum [5] blockchain.
To mint an NFT, the user first generates an image using the OpenAI API. Once the image is generated, the user clicks the ”List NFT” button, which initiates the minting process.
At this point, a JSON object is created containing the NFT’s name, description, price, and the image URL provided by the OpenAI API. This JSON file is then pinned to IPFS using the Pinata API’s pinJSONToIPFS method [10], which returns an IPFS hash that serves as the metadata URI for the NFT.
The mint function in the smart contract is then called, which creates a new token on the Ethereum blockchain and sets its URI to the IPFS hash returned by the Pinata API. The smart contract also specifies the characteristics of the token, such as its name, symbol, and the total number of tokens in existence. Once the function is executed, the NFT is officially minted and can be viewed in the Marketplace. The metadata URI stored on IPFS allows anyone to view the NFT’s name, description, price, and image. The token ID on the blockchain ensures that the NFT is unique and can be transferred between users.
By linking the NFT token to the IPFS hash, we ensure that the NFT’s metadata is decentralized and tamper-proof. Additionally, the use of a smart contract on the Ethereum blockchain enables users to securely and transparently transfer ownership of their NFTs, as ownership information is stored immutably on the blockchain.
D. Marketplace
The Marketplace functionality of this application enables users to browse and purchase NFTs created by other users. The feature is built on the Ethereum blockchain, utilizing the Goerli testnet[3], and allows users to interact with the smart contract that handles the creation, storage, and transfer of NFTs.
The marketplace displays all available NFTs stored on the contract, allowing users to browse through them and view their associated metadata, such as name, description, and price. The metadata is stored on IPFS, ensuring decentralization and tamper-proofing.
To purchase an NFT, a user clicks on the ”Buy” button associated with the desired NFT, triggering a call to the smart contract’s buyToken function. The function transfers ownership of the NFT to the user and updates the smart contract’s storage to reflect the new ownership. The transaction is then recorded on the blockchain, providing an immutable record of the transfer.
The dApp is designed with a user-friendly interface that includes clear instructions and intuitive buttons for browsing, purchasing, and selling NFTs. The use of blockchain technology and IPFS ensures the security and integrity of the NFT transactions and metadata, providing a seamless user experience.
E. User Profile
The UserProfile page is a key component of the NFT Marketplace dApp, providing users with an overview of their account’s NFT ownership and value. The Ethereum blockchain’s smart contract capabilities are integrated into the dApp’s interface to implement this feature.
When a user accesses their UserProfile page, the dApp retrieves data that relates to the user’s account. This data includes the user’s wallet address, the total number of NFTs owned, and the total value of the NFTs in the user’s possession. The dApp displays this information in a user-friendly format on the UserProfile page. This page page also displays all
NFTs owned by the user. The dApp queries the Ethereum blockchain’s smart contract to retrieve the list of NFTs owned and fetches the NFT metadata from IPFS using the metadata URI associated with each NFT token ID. The information is displayed in a visually appealing and easy-to-navigate format.
The integration of smart contracts into the UserProfile page enables users to securely and transparently view their NFT ownership and value on the blockchain.
F. Team Work and Contributions
Our project was a collaborative effort all three among team members. Each team member was assigned different tasks based on their strengths and areas of expertise. We followed an agile methodology to ensure that each task was completed within the given timeline.
The table below shows the breakdown of tasks assigned to each team member:
Authors:
(1) Piyush Batra, Department of Computing Science, University of Alberta ([email protected]);
(2) Gagan Raj Singh, Department of Computing Science, University of Alberta ([email protected]);
(3) Ritik Gandhi, Department of Computing Science, University of Alberta ([email protected]).
This paper is