web3 - Thriftysoft https://www.thriftysoft.tech We build Attractive, scalable, and secure mobile and web applications|| Building Web3 Products Thu, 09 Jun 2022 12:43:12 +0000 en-US hourly 1 https://wordpress.org/?v=5.8.8 https://www.thriftysoft.tech/wp-content/uploads/2022/06/cropped-logo_favicon-32x32.png web3 - Thriftysoft https://www.thriftysoft.tech 32 32 Understanding the Architecture behind NFT Marketplace https://www.thriftysoft.tech/understanding-the-architecture-behind-nft-marketplace/?utm_source=rss&utm_medium=rss&utm_campaign=understanding-the-architecture-behind-nft-marketplace https://www.thriftysoft.tech/understanding-the-architecture-behind-nft-marketplace/#respond Thu, 09 Jun 2022 12:38:02 +0000 https://www.thriftysoft.tech/?p=5708 This is Mayank, from Thrifty software, again with a new post about the Most hyped product these days, i,e NFT Marketplace. people are crazy about the NFT Marketplace and they want to launch their own for different use cases and themes like Real […]

The post Understanding the Architecture behind NFT Marketplace first appeared on Thriftysoft.

]]>
This is Mayank, from Thrifty software, again with a new post about the Most hyped product these days, i,e NFT Marketplace. people are crazy about the NFT Marketplace and they want to launch their own for different use cases and themes like Real estate, Art galleries, Gaming, etc.

But When it came to development, it is essential that they know about the Actual design & Architecture behind this Marketplace before they start development. Again like my previous post on developing Custodial Wallet, I won’t be teaching how to develop an NFT marketplace but will be discussing some concepts & Flow behind it.

What is a Non-Fungible Token (NFT)?

NFT stands for non-fungible token. An NFT transforms a digital file ( Image, Audio, gif, Video, PDF) into a digital asset. An NFT token is created and stored on a blockchain, serving as proof of ownership and provenance of a specific item. It works like a digital certificate of authenticity that can be easily verified by anyone anywhere in the world on a blockchain.

Question: Does NFT is only for Artworks (Images, Video, Gifts)?
Answer: Definitely! no NFT for Artworks is just one use case of NFT, but there can be several use cases, like NFT in ticketing, etc.

What is an NFT Marketplace?

NFT marketplace is a marketplace, which allows artists to showcase and list their Artwork in the form of digital tokens( NFT), and buyers/investors can purchase that Artwork. It is very similar to buying & selling products on an eCommerce marketplace like amazon. An Artist can choose various ways of selling their Artwork. They can choose to sell it for a Fixed price, or can put the Artwork in the Auction, open for bidding, where the highest bidder gets to own the NFT.

Different Types of NFT Marketplace

There are basically two types of NFT Marketplaces,

  1. Primary Marketplace: Primary NFT marketplace is the place, where a creator ( Artist) can mint an NFT token ( Create Artwork in the form of a digital token), and list them for sale.
  2. Secondary Marketplace: Secondary NFT marketplace is the place, where a collector, who has bought an NFT, can resell, or relist their NFTs.

While the “primary market” refers to the first sale of an artwork, the “secondary market” encompasses all subsequent resales of the work.

In this post, I will be focusing on building a Primary NFT Marketplace.

Understanding the Main Logic Behind the NFT Marketplace

Here are some functions & demonstrations, going through which you will get a complete Idea, of how an NFT marketplace works.

1. Authentication :
Authentication is required, to perform actions in the platform. Although browse functions( Browse NFTs, Browse User, Browse Collection) should be open ( unAuthenticated), but some features like Create Profile, Edit Profile, Like NFT, Create collection, and Delete Collection, need authentication to identify the user.

You can use normal Email / Password or Social Login based Authentication and generate a JWT token, or else if you don’t want to use this Authentication, you can also do using Web3 Wallets like Metamask, Coinbase, etc. Refer to the Article Here.

2. Profiling :
We show the user Profile in the Marketplace, associated with each NFT CardLeaderboardCollectionBidder List, and other places. So we need a maintain the Profile of the user which may include the user’s fullname, username, bio, cover image, avatar & other users’ public information. This information we can keep in our database

3. KYC ( Optional) :
This is Completely Optional. In case you need to build a controlled NFT Marketplace ( Depending on the Legal compliances of your Country), you need to know your customer ( user), for that purpose you need a KYC Module. KYC you can implement in two ways :

  1. Manual KYC: Either you create your Customer KYC Module, where you collect data from users and verify it from the Admin panel
  2. 3rd Party API: Or you can use any 3rd Party API like https://onfido.com/ which will do the collection & verification for you.

You can also restrict users from buying/selling in the Platform until the KYC is completed.

4. Create Asset ( Minting) :

NFT Marketplace Asset Minting Diagram
NFT Minting Diagram

Creating a Digital Asset / NFT Artwork on a Marketplace means minting your digital token. Where a user has to upload the Information about the NFT ( Artwork) and mint a new token.

Now, these Include three steps, that are :

  1. Connecting your DApp with a Web3 Wallet: Minting an NFT on a blockchain, requires you to first connect your Dapp with a web3 wallet like Metamask.
  2. Uploading Metadata to IPFS: You need to upload your NFT’s Metadata to IPFS ( InterPlanetary File System), metadata includes the NFT’s Assets ( Image, video, GIf), title, description, and Properties. Since we are building a nonfungible token, we need to make sure this metadata stays forever and is decentralized. Thus storing it in IPFS is the best option. If you upload these files in a centralized database, it is risky for the security of your file. After you upload your NFT’s Metadata to IPFS, you will get a metadata ID ( IPFS key)
  3. Mint your NFT
    Take the metadata ID from the IPFS, use it as tokenURI, and sign the transaction, to mint an NFT.

5. List the NFT on Sale :

NFT Marketplace   - Fixed Price and Auction Sale Diagram
Listing NFT for Fixed Price Sale / Auction

Once the user has Minted an NFT or purchased (owned) one, they can put the NFT for Sale,

Sale Can be of different Types:

  1. Fixed Price sale: Here user will list the NFT for a fixed price, so that other users can directly purchase the NFT, by paying the amount given in the NFT detail.
  2. Auction: Here user will list the NFT for Auction, where the user will specify the minimum Bid Amount and duration of the auction. So users can bid on the NFT. After the Auction is expire, no one will be able to place a bid. Now the Owner can decide to accept/reject the highest bid. In case the user has opted to Accept, The amount will go to the user, and the owner of the NFT will be transferred to the highest bidder.
  3. Hybrid ( Auction & Fixed Price): User can also List their NFTs, in the hybrid model, i.e List them both for Fixed price & Auction. So here the user has to Specify the minimum Bid Amount, duration of the auction, and buy now price. Now user can place bid on the auction, but if user buy the NFT with Buy now price, the NFT will be immediately sold to the buyer and the auction will be closed.

6. Bidding & Buying :

Users can visit the NFT detail page and can Buy or Bid on an NFT, depending on the form of Sale. ( Buy = Fixed Price or Hybrid, Bid = Auction). The Flow is Almost the same, like :

User Select an NFT → Connect Metamask → Call Buytoken or BidToken function → Sign TX & Send to Blockchain → Event will be triggered which will change the owner in the DB

Any user ( owner) of the NFT, can decide to remove it from Sale ( Fixed Price / Auction). Once it is removed from Sale, no one can purchase it / place a bid

7. Collection & Add NFT to Collection
Collections are used to group the NFTs of similar traits, to make it easy for users to browse. An NFT marketplace should have a feature where users can create/update a collection and assign their NFTs ( they owned) to a collection. Collection can exist on the Database, in order to make it easy for the user to browse/search.

8. Other Views :
Although you have to keep the NFTs metadata in the IPFS, but its good to keep a copy in your Database as well, to improve the query & search functionality in the NFT marketplace. Users will find it convenient to browse the NFT Artwork by searching their title, by category, filter by collection, etc. These could be different views to list the NFTs,

  1. Trending NFTs
  2. Browse by Category
  3. Browse by Collection
  4. Browse User Profile
  5. Browse User Created / Owned NFT

Conclusion :

After going through the post, you must have got an idea about the Architecture behind an NFT Marketplace, and you must be excited to build your own NFT Marketplace.

You should Refer to Some tutorials & content, that must be useful for you :

  1. https://www.youtube.com/watch?v=GKJBEEXUha0
  2. https://dev.to/edge-and-node/building-scalable-full-stack-apps-on-ethereum-with-polygon-2cfb
  3. https://github.com/dabit3/polygon-ethereum-nextjs-marketplace/

In case you are looking for an NFT Marketplace, visit https://thriftysoft.tech/ or feel free to get in touch with us at admin@thriftysoft.tech or contact us on Skype. If you just need the UI, shown in the post, buy it here https://codecanyon.net/item/minto-reactjs-nft-marketplace-ui-kit/35888391

We will be happy to help you 😊

The post Understanding the Architecture behind NFT Marketplace first appeared on Thriftysoft.

]]>
https://www.thriftysoft.tech/understanding-the-architecture-behind-nft-marketplace/feed/ 0
How to Develop a Custodial Wallet for Cryptocurrencies?  https://www.thriftysoft.tech/how-to-develop-custodial-wallet-for-cryptocurrencies/?utm_source=rss&utm_medium=rss&utm_campaign=how-to-develop-custodial-wallet-for-cryptocurrencies Sat, 23 Apr 2022 08:27:39 +0000 https://www.thriftysoft.tech/?p=5646 With the increasing hype of blockchain, cryptocurrencies, NFT & metaverse, now startups are moving from web2 towards web3. Thus increasing demand for the Crypto wallet. Still, people are confused between custodial wallet & non-custodial wallets. In this post, I will […]

The post How to Develop a Custodial Wallet for Cryptocurrencies?  first appeared on Thriftysoft.

]]>
With the increasing hype of blockchain, cryptocurrencies, NFT & metaverse, now startups are moving from web2 towards web3. Thus increasing demand for the Crypto wallet. Still, people are confused between custodial wallet & non-custodial wallets.

In this post, I will not be talking about the difference between custodial & non-custodial wallet, if you want to know the difference, read it here

Here I will try to give you a design overview of a custodial wallet,  I will help you to see the architecture behind it, so that you can use this knowledge in building your own Custodial Wallet.

What is Custodial Wallet ?

A Custodial Wallet is defined as a wallet in which the private keys are held by a third party. This means the third party has full control over your funds while you only have to give permission to send or receive payments. 

Why you should choose a Custodial wallet? 

If you are building a mobile or web app, and you want the wallet functionality, so here are the following reason, why you should choose Custodial Wallet over non-custodial wallet.

  1. User Experience: Connecting to an external wallet like metamask, with an application is not straightforward all the time, and it affect the user experience. Also, it’s not easy to connect to an external wallet, with an app. So if you don’t want your user, to connect the app/website with any external wallet, and you still want to use crypto coins , you should use a custodial wallet.
  2. Less Educated Targetted Customer: Not everyone today has knowledge of web3, metamask, trust wallet, And other web3 wallets, so it creates a hindrance for them, to use your application. So if your app user is not that educated in the field of blockchain and crypto and you still want to use crypto technology in the app, then you should use Custodial wallet, where wallet will be connect with their account. ( JWT)
  3. Control: By using a Custodial wallet, the owners of the platform, have control over the usage/deposit & withdrawal. so  If you want to control your user’s wallet, you should use a Custodial wallet.

How to develop a Custodial Wallet?

Here is the overview, about developing a custodial wallet, which will ultimately require you to develop the following functionalities.

  1. Authentication –  there should be an Authentication module. Every user should have their email/password. They should have the ability to Login via email and password or using Social Methods like Google, Facebook, etc.

2. Creating wallet Addresses for each user – If the user Login for FIrst time, Create an address for the user, using the private key, which should be generated considering the security in the mind. You need to do this operation for each blockchain you are using. The syntax can be different for different blockchain

Onsignup trigger diagram of custodial wallet
Onsignup Trigger

3. KYC ( Know your Customer) – There should be a user’s KYC and it should be approved before the user start using the wallet. Although it is not required technically, but it is really necessary because of the legal compliances.

Either you can create your Custom KYC Module, where you collect data from users and Verify it from the Admin panel or use any 3rd Party API like https://onfido.com/, which will do the collection and verification for you.

4. Multifactor Authentication ( MFA) – there should be MFA enabled with the user account, to protect a few critical actions like sending money to any address, deleting an account, etc. it can be done using: 

  • Mobile number & OTP
  • Google Authenticator

5. Coin List – There should be an API to fetch all the supported & currently active coins, in the Platform. You have to create this list from the Admin panel.

6. Fund Balance – There should be an API, to fetch a list of coins, their quantity and the price, the user is holding. If you are using more than one blockchain, you need to query the data from more than one blockchain, concatenate the array and send it to the user. To calculate the price in FIAT currency, you can use any Crypto Exchange API like Coinbase.

Crypto Fund Balance Screen of custodial wallet
Crypto Fund Balance Screen

7. Get Deposit Address – If someone wants to deposit the cryptocurrency in your wallet, they will need a deposit Address or a QR code. So there should be an API, to fetch the user’s deposit address for a given network.

P.S:  Deposit Addresses will be different for different blockchain
Deposit Address of Custodial Wallet
Deposit Address

8. View Transactions – There should be an API to get the transaction of any account(address). You can also add a currency filter, to get a transaction for a specific cryptocurrency.

9. Send Crypto Currency – Now, it is time to create a transaction object, ( if the user wants to send the crypto coin). There should be an API, which will send the transaction. Transaction will be signed in the backend using the private key for user’s wallet.

Custodial Wallet Trasaction flow
Trasaction Flow

Conclusion : 

After going through the post, you must have got an idea about the what is custodial wallet, why & when you should use custodial wallet, and how to build a custodial wallet.

In case you are looking for a Custodial or noncustodial wallet, for your business use case, feel free to get in touch with us at admin@thriftysoft.tech or contact us on Skype

We will be happy to help you 😊

The post How to Develop a Custodial Wallet for Cryptocurrencies?  first appeared on Thriftysoft.

]]>