Let’s get technical

This is our first blog post focused on the technical, not product, aspect of the UNQ.Club. For those who haven’t read previous parts — here is the intro, and here is the club functionality.

Intro

UNQ.Club is a blockchain platform focused on collecting NFTs.

Before we start, let’s agree on basic terminology.

NFT — or non-fungible token. Essentially a token that represents a unique asset, digital or physical. For example, every bitcoin is essentially absolutely the same as any other bitcoin. You can create a series of 1000 NFTs, and each of them will be unique, with its own unique history that can be traced back. Technically, NFTs can be (and are) created on many blockchains and standards, for example: Ethereum, Binance Smart Chain, Flow, Tezos, Tron, Enjin, Wex, EOS — and potentially many more to come as NFTs are becoming more popular.

You can imagine that it causes a problem for users, since they have to use all the different interfaces and wallets. The need for cross-chain solution appears. Simply put, it’s a way to transfer information and value (because blockchains, especially public, are all about value) from one chain to another. Ideally, that means that the value becomes independent from the platform. There are different ways to do that, but the most popular one is destroying (or locking) an asset on originating blockchain, and minting (creating) it on another blockchain. It’s a pretty straightforward approach, but also quite secure. And it works quite well for tokens. In most cases that would be known as a bridge.

But NFTs are quite a different story. They are more flexible, content-rich, can be programmable, and so on. And that’s just the beginning, the industry is evolving at a great pace. So moving NFTs from one bridge to another becomes incredibly complicated. There is definitely a room for alternative solutions, and we’ve come up with one.

What if we keep NFTs where they are? We don’t necessarily need to move all of them to one chain in order to build the collection. What we need to have is an ability to create transactions with those NFTs in a trustless manner. If we can buy and sell an NFT on Ethereum, BSC, Tron and other chains using a single interface that is running on blockchain — that might be just the solution.

But to do that we need a blockchain that is really fast, low-cost, and with a guaranteed performance. After a thorough research, we decided to go with Solana, and use Solana Seasons hackathon as an opportunity to create a prototype of the system.

Here we will only focus on transacting with NFTs, all other aspects will be covered in other posts.

Implementation

Again, some terminology. Club is a DAO running on Solana. Curator is a person that is a club administrator, he can buy and sell NFTs. To do that, he has two main tools. Treasury is a storage of “money” tokens (SOL, USDC, ETH), and Vault is a storage of NFTs.

We will look at an example where a curator wants to purchase a new NFT for the club. Essentially, the opposite operation (selling an NFT) is quite similar, so we will not focus on it.

We will be using Ethereum as a second blockchain in this example.

The curator finds some NFT he wants to purchase. Now he needs an ID of that token. We will support a number of different inputs, for example, an Etherescan URL of the token

https://etherscan.io/token/0x85f0e02cb992aa1f9f47112f815f519ef1a59e2d?a=1000813129#inventory

The curator pastes this link, plus the price he is willing to pay, plus additional information (for example, a different payout address). Now, the Solana based application checks several things. First of all, is this person eligible to perform such operations on behalf of this club? Does the club treasury have enough funds? Is this amount below the threshold for this club, or there is a need for additional voting?

Once all the checks are passed, Solana application calls a server that generates a specific transaction on Ethereum that expects a signature from both buyer (curator) and seller.

To optimise user experience and overall performance, we have decided to go with a common account for all clubs on other chains. So, clubs will not have their addresses on Ethereum, for example. UNQ will have one address, that stores all the tokens (ERC-20 and NFTs). At the same time, a ledger on Solana will at all times hold records (updated in real time) of both Treasury and Vault state of every single club. That actually creates additional benefits — for example, if a trade occurs between two clubs, we don’t need to move anything on Ethereum at all, and instead update records on Solana, which makes the transaction effectively costless. Also that allows to perform certain transactions in batches, further optimising the cost.

But since we want to maintain decentralisation, we need to handle private keys for that Ethereum address in a specific manner. Here, Level 3 clubs (which are legal entities) will become validators, meaning they will check the transactions and hold shards of the private keys to all other blockchains where such applications are deployed. And once the request for an operation is confirmed, the key will be re-created, transaction signed from buyer’s side.

At this point the curator receives a URL for trade request he can provide to the seller. Seller opens it, checks all the trade parameters, and signs the transaction using corresponding tools.

The transaction goes through. Meaning, UNQ address on Ethereum pays the requested amount of ETH, and Club’s Treasury on Solana is updated to reflect that now it has less money. The purchased NFT arrives to UNQ address on Ethereum, and Club’s Vault on Solana is updated to reflect that the Club now owns said NFT. The curator now can put it up in club’s gallery.

Conclusion

This is, of course, a work in progress. We are working out details of the implementation, and depending on the results we can change some aspects described above, but the goal is clear.

We believe that such an approach can be beneficial not only for us, but for the blockchain community in general. That’s why we will be developing it in an open source manner and keep the results available for anyone to use and improve freely.

Building a platform for unique people collecting unique items. Join our Telegram group https://t.me/unq_community