🚩NfSwap Protocol

ABSTRACT

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 NfSwap Protocol, 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

I. INTRODUCTION

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 NfSwap Protocol can improve the mass adoption and usage for NFTs.

II. NfSwap PROTOCOL PHILOSOPHY

As mentioned in the previous paragraphs, the NfSwap Protocol allows anonymous users to swap their NFTs securely and confidently. In addition, NfSwap Protocol 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: NfSwap Protocol will support the majority of NFT based applications and protocols (Native token like BNB, BEP-20, BEP-721,) and future cross chains.

Economical: NfSwap Protocol users will pay very low fees to swap their digital assets.

III. HOW META SWAP PROTOCOL WORKS

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 NfSwap Protocol 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 www.NfSwap.cc, connects its BSC 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 BNB / BEP-20 / BEP721 ) she wants to receive (e.g. a Sorare card) and the BSC 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 BSC flat fee.

• When the blockchain confirms Alice’s transaction, her assets are temporarily moved to the NfSwap Protocol 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 BSC flat fee.

• When the blockchain confirms the transaction, the tokens go automatically to the new owners. The swap is concluded and the BSC flat fee are sent to the BatchVault smart contract.

• The BSC 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 BSC 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 BSC flat fee by connecting to the NfSwap protocol and by cancelling the trade request.

Before diving into the technical implementation details for the NfSwap protocol platform, it is important to explain the important characteristics of what is an NFT.

Every NFT is identified by:

• the BSC 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 BSC 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 BEP-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 NfSwap protocol platform is based on the following BEP-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 NfSwap protocol smart contracts are the multitoken (BEP-721) and fungible token (BEP-20).

The BEP-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 NfSwap protocol platform is based on the following BEP-821 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 BEP-20, the fungible token.

The NfSwap protocol platform is based on the following BEP-20 functions:

• approve: this function allows the owner of an BEP-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 BEP-20 and the amount of token that would receive.

The NfSwap protocol platform is based on two smart contracts called BatchSwap and BatchVault. The BatchSwap is used by the NfSwap protocol team to register the smart contract addresses of the BEP-20/BEP-721 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 NfSwap protocol 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 (BEP-20/BEP-721). The users of the platform directly interacts only with the BatchSwap smart contract; the BatchSwap functionalities would call the BEP-20/BEP- 721 interface functions on the smart contracts of the digital assets, in a totally transparent way.

Last updated