NFT Trader

NFT Trader Whitepaper

This section contains NFT Trader Whitepaper


NFT Trader The revolutionary trustless P2P OTC NFT trading protocol

NFT Trader Team - Version 1.0.0 - May 25, 2021
The worlds of digital art and gaming have developed extensively in the last few years in credit to their adoption of blockchain technology. Subsequently, many marketplaces have emerged where people can buy and sell their blockchain based digital game or art assets, called Non-Fungible Tokens or NFTs. These marketplaces unfortunately have been characterized to have high transaction fees that are applied to the users of the platform.
To improve the mass adoption of NFTs and to encourage people to join in on the NFT movement, our team has developed NFT Trader, an innovative, peer-to-peer trading platform allowing people to exchange NFTs without the risk of fraudulent activity and without the need to pay large transaction fees. Our platform acts as a trusted-third-party for the swap of an NFT: when a user decides to swap an NFT with another person, both users know exactly which items will be swapped and no party can defraud the other by sending unwanted items. Finally, in the case if a counterpart abandons a swap, at any time the person that created the original swap can withdraw their NFTs. This Whitepaper introduces the concepts of blockchain and Non-fungible tokens, describing in depth the solution we have implemented for regulating the swap of NFTs.
When talking about blockchain technology today, the majority of people will automatically assume it is related to Bitcoin and other digital currencies. But this is only scratching the surface of what this technology offers. As a whole, blockchain allows users to create tamper-proof, fully verifiable, decentralized and public records of transactions. Decentralization provides for the democratizing of a blockchain; so users joining a blockchain network are be able to guarantee the certainty of the transactions made by other unknown people in the network. In this way, anyone can safely transfer money to a counterpart without the intervention of a trusted authority like a bank that certifies the operations.
In the blockchain world, a new type of digital asset, the NFT has been produced. NFTs or Non-Fungible Tokens, are crypto-assets based on blockchain technology whose ownership can be verified at every instance. Similarly to crypto-currencies, the owner of a NFT can be identified as the owner of a digital wallet to which the NFT is associated to. Moreover, the owner of a NFT is unique and verifiable but because NFTs can be swapped, bought or sold, the owner can also change over time. There exists an important difference between an NFT and a traditional cryptocurrency: NFTs are characterized by the property of digital scarcity, i.e. every NFT is unique or distributed in a limited edition, making every NFT a potentially highly valuable item. This digital scarcity property is the main pillar in today’s most popular applications of NFTs: digital collectibles, digital art and gaming.
There exists many blockchain projects based on NFTs and we want to mention some of them as an example of how digital assets can be used to develop new applications or to help make for transparent and verifiable already existing applications. The Sorare [1] digital football card game is one of the most promising trading card games based on NFTs. People can buy, sell and trade digital cards of football players. In addition people can create their own unique football teams and compete in different leagues [2]. Sorare trading cards are based on NFTs in order to help players verify if a card is a rare or not and can certify that it is not a counterfeit. Continuing with the gaming industry it is important also to mention the BlockPegnio project and its adoption of Governance NFTs for their upcoming PlayStation 5 game The Six Dragons [3]. This provides some validation that the NFT space will grow in future years to come and should become the de-facto standard for digitizing assets. A primary advantage for the adoption of NFTs in video games is the possibility for the gamers to withdraw in-game items which then can be swapped or sold in third party digital asset marketplaces, allowing for the interoperability and interaction of gamers coming from different platforms thus boosting the appeal of the gaming industry even further.
This concludes a brief introduction to the world of NFTs. In the remaining parts of the paper, we describe in more detail the technical aspects on our implementation and how our NFT Trader platform can improve the mass adoption and usage for NFTs.
As mentioned in the previous paragraphs, the NFT Trader platform allows anonymous users to swap their NFTs securely and confidently. In addition, NFT Trader has been developed by following many other important principles which we will briefly describe in the following information.
Security: Users can confidently trade their assets with anonymous counterparts avoiding any deception and risk of fraudulent activity. All the operations are executed on-chain ensuring the highest levels of trust.
Simplicity: The trade process comprises of a very simple three step method that will be described in more detail in the next section of the paper.
Decentralized: Users can trade their NFTs without the intervention of a central authority. It is based on a peer-to-peer paradigm.
Transparency: Anyone can verify which tokens will be traded before executing the trade itself.
Freedom: As long as the trade operations are not completed, people can decide at any time to revoke pending trade requests.
Interoperability / Universality: NFT Trader will support the majority of NFT based applications and protocols (Native token like ETH, ERC-20, ERC-721, ERC-1155) and future cross chains.
Economical: NFT Trader users will pay very low fees to swap their digital assets.
This section describes the operations and the steps necessary to execute a trade. Two anonymous users, Alice and Bob would like to easily swap their digital assets without having to pay a high amount of fees on secondary markets and avoid the longer process of buying and selling in order to complete a simple trade. Because they do not know each other, they can proceed in two manners. They can send the counterpart their NFT without any warranty that the counterpart is not a scammer, or they can use NFT Trader to securely swap their digital assets. The trading process is very simple and safe, and the possibility of being scammed is removed. The process is composed of a few very simple steps:
• Alice opens the website [4], connects its Ethereum wallet to which the NFT is associated to and starts a trade. To do so she has to know the type of assets (native token like ETH / ERC-20 / ERC721 / ERC-1155) she wants to receive (e.g. a Sorare card) and the Ethereum address of Bob’s wallet. Those assets are public and verifiable, so Alice is able to verify which tokens she is going to swap with Bob. Once ready, Alice accesses her wallet and confirms the creation of the swap by paying the gas of the transaction and an Ethereum flat fee.
• When the blockchain confirms Alice’s transaction, her assets are temporarily moved to the NFT Trader smart- contract and Alice receives an URL containing all the information Bob needs to conclude the swap. Alice sends the link to Bob.
• Bob browses the URL, verifies which tokens Alice is sending, checks which tokens Alice expects to receive and, finally, he can decide to confirm or not the swap operation. To confirm the swap, Bob accesses its wallet and signs the transaction, paying the gas of the transaction and an Ethereum flat fee.
• When the blockchain confirms the transaction, the tokens go automatically to the new owners. The swap is concluded and the Ethereum flat fee are sent to the BatchVault smart contract.
• The Ethereum flat fee could be setup by the owner of the smart contract trought the setPayment function. The params needed to use this function are a boolean that enable/disable the Ethereum flat fees plus the value in WEI of the fee.
• For any reason, Bob could decide to reject the trade request. In such a case, he can can simply ignore the URL sent by Alice. As long as the trade is not confirmed by Bob, Alice can get back her assets and the Ethereum flat fee by connecting to the NFT Trader and by cancelling the trade request.
Before diving into the technical implementation details for the NFT Trader platform, it is important to explain the important characteristics of what is an NFT.
Every NFT is identified by:
• the Ethereum address of the smart contract to which the NFT is associated to (i.e. the application smart contract for DApps like Cryptokitties, Sorare, vNFT, etc.)
• the tokenID, a number that allows to identify uniquely the NFT of an application
• the Ethereum address of the owner of the NFT (only the owner of the NFT can send it to a new user)
Many NFT based applications utilize the ERC-721 standard interface, which defines standard methods for ownership management, like the transferring of NFTs or identifying the owner of an NFT, plus a set of events are emitted when certain operations succeed, for example when an NFT is transferred to a new address. The NFT Trader platform is based on the following ERC-721 functions:
• approve: this function allows the owner of an NFT to delegate another address for managing the NFT. This functions receives as parameters the TokenID and the address the user wants to delegate.
• safeTransferFrom: this function allows to transfer ownership of an NFT. It receives three parameters, the address of the current owner of the NFT, the destination address and the TokenID.
The other two standards handled by the NFT Trader smart contracts are the multitoken (ERC-1155) and fungible token (ERC-20).
The ERC-1155 are similar to the ERC-721 but they could be multitoken. This means that the asset is identified by a TokenID and a balance. If the balance is 1 could be considered an NFT, but if the balance is higher than one, it could be a multitoken. An example of a multitoken could be an in-game assets like a potion that, once used, the balance would be reduced by 1.
The NFT Trader platform is based on the following ERC-1155 functions:
• setApprovalForAll: this function allows the owner of an NFT to delegate another address for managing the NFT. This functions receives as parameters the address the user wants to delegate and a boolean if the delegated addres could handle or not the assets.
• safeBatchTransferFrom: this function allows to transfer ownership of an NFT. It receives four parameters, the address of the current owner of the NFT, the destination address an array of TokenID and an array of balances that contain the amount of token traded.
The last standard handled is the ERC-20, the fungible token.
The NFT Trader platform is based on the following ERC-20 functions:
• approve: this function allows the owner of an ERC-20 to delegate another address for managing the asset. This functions receives as parameters the address the user wants to delegate and the amount of token that could handle.
• transfer: This functions receives as parameters the address the user that will receive the ERC-20 and the amount of token that would receive.
The NFT Trader platform is based on two smart contracts called BatchSwap and BatchVault. The BatchSwap is used by the NFT Trader team to register the smart contract addresses of the ERC--20/ERC-721/ERC-1155 applications supported by the platform and it allows the interactions between the contract and the smart contracts of the NFT applications. The list of supported applications is stored on-chain and publicly accessible via the BatchSwap getWhitelist function, but can be updated over time only by the NFT Trader team. By registering the smart contract addresses of the NFTs, the Batchswap can act as a bridge with the smart contracts of the other digial assets (ERC-20/ERC-721/ERC-1155). The users of the platform directly interacts only with the BatchSwap smart contract; the BatchSwap functionalities would call the ERC-20/ERC-721/ERC-1155 interface functions on the smart contracts of the digital assets, in a totally transparent way.
In fact, when an user wants to begin a swap, he has to click on the ”Approve” button of the web application. By confirming the transaction, the approve function of the BatchSwap contract is called, the BatchSwap calls the approve function on the smart contract of the digital assets (ERC-20 / ERC-721 / ERC-1155), specifying the parameters needed to get the delegations. At the end of this first step, the BatchSwap contract becomes the address delegated to manage the digital assets (ERC-20 / ERC-721 / ERC-1155). At this point, the initiator of the swap can proceed by calling the ”Pay now” button. By confirming this second transaction, it is called the createSwapIntent function on the BatchSwap contract. This function receives as parameters the addresses of the smart contracts and the digital assets infos (tokenId for ERC-721 or balances for ERC-20 / ERC-1155) that are to be traded, then transfers the NFT of the trade initiator to the BatchSwap smart contract and returns the SwapID, i.e. an identifier of the swap. It is important to notice that the NFT has not been transferred yet to the new owner but to the BatchSwap contract, making possible for the user to reclaim the NFT at any time. When the transaction is confirmed, the initiator of the swap receives a notification with a URL containing its address and the SwapID, the pair of information that are necessaries for the counterpart to conclude the swap. This URL must be shared with the swap counterpart in order to give him all the information that is necessary to conclude the swap. When the counterpart receives the URL containing a swap request, he must in turn click the ”Approve” button to make the BatchSwap address the approved address for the second NFT of the swap. Finally, to conclude the swap, the second user clicks ”Pay now” and confirms the blockchain transaction. At this point the BatchSwap closeSwapIntent function is called by specifying as parameters the address of the creator of the swap and the SwapID. The SwapID permits to the smart contract function to retrieve all the information of the swap and to call all the asset transfer functions (transfer for native tokens like ETH and ERC-20 assets, safeTransferFrom for the ERC-721 assets and safeBatchTransferFrom for ERC-1155 assets), the first time to transfer the NFT of the initiator of the swap to the recipients and the second to transfer the NFT of the swap counterpart to the swap initiator.
To conclude the implementation description it is fundamental to specify the possibility to quit the swap process without having finalized it yet. Therefore, if the receiver of the swap proposal decides to give up the swap, he simply ignores the request. On the other end, the initiator of the swap can relinquish the swap by calling the appropriate BatchSwap cancelSwapIntent function. By doing this, the assets are transferred back to its original owner, the swap proposal is canceled and the counterpart can no longer close the swap.
The NFT Trader smart contracts allows to handle a cross-asset swaps (ERC-20 / ERC-721 / ERC-1155 and native tokens like ETH) in a peer-2-peer, trustless and secure way.
The NFT Trader team never owns the assets involved in the deal and will never be able to change the ownership of the assets of the initiator that would be owned by the BatchSwap smart contract during the createSwapIntent phase. This solution was applied since we handle native token like ETH or CryptoPunks NFTs that are not ERC721 fully compliant.
The NFT Trader BatchSwap smart contract apply an ETH flat fee on both the counterparties involved, it doesn't matter the amount of the ERC-20 / ERC-721 / ERC-1155 or native token involved in the swap and the NFT Trader team is able to edit / remove the ETH flat fee applied. Those flat fees are sent to the BatchVault smart contract only if the deal is closed. If Alice create a deal and Bob decides to refuse the prosal, Alice will be able to recover all the assets, also the Ethereum flat fee applied.
The NFT Trader team have released his own ERC-721 / NFT called Trade Squads. If kept inside the Ethereum wallet would remove the flat fee applied to the owner of the asset involved in the deal.
The NFT Trader platform will revolutionize peer-to-peer NFT trading operations by making them, secure, quick, and interoperable across DApps and between users. The use of the smart contract acting as the trusted third party by managing the NFTs and the possibility for users to swap NFTs from across different decentralized applications, highlights the most important pillars of our platform. The features of decentralization, interoperability, and security which we offer for P2P NFT swaps through our platform will be a potential game changer in the world of NFTs!
  1. 1.
    [1] “Sorare,”
  2. 2.
    [2] “Sorare,”
  3. 3.
    [3] Six Dragons Blog, “Blockpegnio, playstation partner, will enable
    governance nfts for the six dragons,” dragons/blockpegnio-playstation-partner-will-enable-governance-nfts- for-the-six-dragons-919f36da0c91, 2020, [Online: accessed December 2020].
  4. 4.
    [4] Different Kinds of Tokens, OpenZeppelin Docs ""
  5. 5.
    [5] NFT Trader Team,