Will that cross-chain Gh0stlyGh0sts be the next Azuki?

This article involves a relatively large amount of code and may be a little boring. Please read it patiently to understand the principle.

In the past few days, various groups have been spreading a project called Gh0stlyGh0sts. As a free mint project, it has achieved a 100-fold increase in a single day. The main reason behind this is that everyone is hotly discussing that it can achieve cross-chain technological innovation.

Remember who the blue chips were after the last technological innovation? Azuki, it brought the ERC721A on fire. For details, you can read the previous article The world of web3 is wild-detailed explanation of ERC721A.

In previous articles, it has been mentioned many times that web3 is a field that is extremely dependent on technological innovation. On the one hand, it can release more upper-level application potential. It will be directly regarded as willing to do things for a long time, thus generating a fomo mood, so from the point of view of technological innovation, Gh0stlyGh0sts may have Azuki genes.

But after research, I think that its operations are not reproducible, it is very heavy compared to ERC721A, and the benefits are limited, so I don’t think it will become the next Azuki, or this solution is difficult to be like ERC721A For large-scale use, please read down patiently for the specific reasons, which will be mentioned at the end of the article, but please note that this article does not provide any investment advice.

When everyone is shouting that this project is awesome and can cross-chain black technology, our official account is committed to helping everyone understand the essence of the principle more deeply, so this article will analyze the cross-chain of Gh0stlyGh0sts for everyone and what is going on.

We can see from its twitter that it claims to be the world’s first omnichain full-chain NFT project.

Will that cross-chain Gh0stlyGh0sts be the next Azuki?

Let’s take a look at their first and most important four tweets in a timeline.

It says that it is the first native full-chain NFT. It can mint and transfer on any chain. The original chain (ie mint chain) and the current chain are two factors that will affect the background color and border color of the NFT respectively. , so you can see the past and present life of this NFT at a glance, and our common way of implementing cross-chain bridges such as Wormhole is to mint on one chain first, then lock it in the contract of the cross-chain bridge, and then in another chain. On the mint, a new one came out to flow, so it emphasized the difference between itself and the traditional cross-chain bridge.

Therefore, the difference between him and the traditional cross-chain bridge lies in three points:

  • Can mint on either chain instead of mint on a chain first
  • Can achieve true “transfer” instead of locking one and then copying one
  • Original chain and current chain affect NFT style

Will that cross-chain Gh0stlyGh0sts be the next Azuki?

It can be seen that the background and borders are different because of their past and present lives.

Will that cross-chain Gh0stlyGh0sts be the next Azuki?

Turning forward again, when an NFT is transferred, it will first burn the NFT on this chain and mint a new one in another chain, then this is its principle, just from this point of view, it seems to be Compared with the traditional cross-chain bridge that changed the locking action to burn, we continue to study to see if there is anything.

Will that cross-chain Gh0stlyGh0sts be the next Azuki?

Here he said that the Layer Zero protocol was used to achieve cross-chain, um.. That means the key point is this Layer Zero.

Will that cross-chain Gh0stlyGh0sts be the next Azuki?

The context is clear, and we start to analyze, which starts with this Layer Zero.

First of all, it is self-evident why cross-chain is important. You can use each chain as a bank. If the bank cannot transfer money across banks, your asset liquidity and efficiency will be greatly weakened. LayerZero has just completed investments in A16Z, Sequoia Capital, etc. It can be seen that the operation of cross-chain is at least very popular with capital.

The reason why Layer Zero is called Zero is that it is not in the same latitude as Layer1 such as Ethereum and Solana. The principle of the cross-chain bridge built on these Layer1s is basically the same as the above. Another chain generates assets, and the process of locking assets is these cross-chain bridges hosting assets, which is why cross-chain bridges are often attacked by hackers, so people are increasingly distrustful of trusting assets to cross-chain bridges. In addition to security, the operation of cross-chain bridges is also very cumbersome, requiring multiple transfers and paying multiple gas fees, while Layer Zero does not lock escrow assets. Layer Zero is a lower-level communication protocol that directly communicates between the two chains. In fact, the simple and rough understanding is that Layer Zero deploys its own nodes between multiple chains. These nodes help you communicate between the two chains. For example, if you call the node of chain B in the contract of chain A, Tell it that you want to transfer an NFT, so the node helps you create a new NFT between B, and these two nodes undertake the task of communication, so the principle is still very simple.

Let’s take a look at the Gh0stlyGh0sts contract code. The function traverseChains performs cross-chain operations. Two parameters, chainId, chain id and tokenId, need to be input.

Will that cross-chain Gh0stlyGh0sts be the next Azuki?

First verify the holder, and then pass the chainId into a trustedRemoteLookup array to verify whether its length is greater than 0. What is this operation for?

We saw in Layer Zero’s documentation that each chain of the protocol corresponds to an id, so the incoming chainId represents which chain you want to transfer the NFT to, so this trustedRemoteLookup should store the contract addresses of different chains. Check here whether there is a corresponding contract on the target chain you want to transfer.

Will that cross-chain Gh0stlyGh0sts be the next Azuki?

We entered the id2 of Binance Chain and tried it, and it did return the corresponding contract address.

Will that cross-chain Gh0stlyGh0sts be the next Azuki?

Then execute the burn operation to destroy your NFT. Burn first obtains the holder of the NFT, and then executes _beforeTokenTransfer. This function needs to pass in three parameters, from, to and tokenid. When from is 0, it means For casting, when from and to are not 0, it means transfer, when from is not 0 but to is 0, it means destruction, so here to pass in 0 for destruction, and execute approve to cancel all authorizations of the tokenid, and then Decrease the original holder’s balance by 1, and delete the association between the holder and the tokenid in the mapping holding relationship.

Will that cross-chain Gh0stlyGh0sts be the next Azuki?

The endpoint calls the Layer Zero interface and passes in the target chain chainId to be transferred, the contract address of the target chain trustedRemoteLookup[_chainId] and other information, where the payload parameter represents the information you want to transmit to the target chain, which can be seen in the code It transmits two parameters, the current user contract address msg.sender and tokenId, so we can guess that the target chain must have a mint function that uses these two parameters to mint a new NFT.

Will that cross-chain Gh0stlyGh0sts be the next Azuki?

After the send message of Layer Zero is captured by the target link, the lzReceive function will be executed. We follow the vines layer by layer. We can see that lzReceive first decodes the passed payload information, and then executes the _safeMint function to newly cast the corresponding NFT. .

Will that cross-chain Gh0stlyGh0sts be the next Azuki?

We understand how to transfer between various chains. Next, let’s see how it can be mint in different chains. When I first saw this ability, the first thing that came to my mind was how to do it. Because mint is incremented according to tokenid, for example, I mint #1 in Ethereum, then polygon must start mint from #2, so many chains back and forth mint is not messy, when I saw their solution a little fun..

The left and right sides of the figure below are the contract codes on two different chains. The two parameters are set as the start and end tokenids, that is, I can only mint the 0th to 3084th in Ethereum, and I can only mint the first in arbitrum. 6476 to 7092, so which chains you can mint on are all written in advance. People outside don’t know and think they are smart, but in fact they use it in a rude way.

Will that cross-chain Gh0stlyGh0sts be the next Azuki?

Don’t forget that it has another feature, that is, the background color of different chains is different, and the color of the border after cross-chain is also different. As shown below, I opened an NFT that crossed to Ethereum, showing that its birth chain is Polygon, It is indeed traced back, which is amazing, right?

Will that cross-chain Gh0stlyGh0sts be the next Azuki?

After I finish my research, it really hits me, and I will listen and analyze slowly.

When I heard about this feature, the first thing I thought was how to “dynamically” identify the token after cross-chain and automatically change the baseURI? Everyone knows that each token corresponds to a link stored on ipfs. This link stores its attributes and pictures. For example, my NFT was originally in the A chain. At this time, I crossed it to the B chain. Then first There must be a piece of code to automatically generate a json file that stores the attributes before and after the cross-chain, and automatically generate the image, and then transfer it to ipfs, replace the old link, and map it to the token, but ipfs is not allowed to change it , which didn’t work, and while I was at my wits end, I opened their ipfs file.

It can be seen that it uses a large folder to pack 7 chain subfolders, and the subfolders are corresponding json files, and then each subfolder has the same size of 4.2M.

Will that cross-chain Gh0stlyGh0sts be the next Azuki?

Then I spent nearly half an hour constantly understanding the reason, what does this mean? Finally, I finally understood that it exhausted all the possibilities in advance.

I still remember that the above mentioned that the number interval that each chain can be mint is hardcoded in the code in advance, and then it first generates 10,000 json files of all NFTs, and sets its birth chain and background image according to the interval. , for example, set the birth chain of the 6000th NFT as polygon and the background color as purple. At this time, there is no border, so if #6000NFT has not crossed the chain, it will be indexed by the poly in the above figure.

Then it copied the json files of the 10,000 NFTs 7 times, and then added a border of the chain to the NFTs that did not belong to the chain. For example, I just mentioned that the birth chain of #6000 is a polygon, so in the eth folder The picture of #6000 will have a gray border, and similarly #6000NFT of Binance Chain will have a blue border.

I never thought of this operation. At first I thought it was a very advanced technique, so I kept looking at the code to find out the business logic of changing the baseURI. this way of operation.

The above is how Gh0stlyGh0sts achieves the effect of cross-chain + multi-chain mint + front and rear chain change styles. On the whole, this solution does not have any universality, and the operation is cumbersome and complex, far less simple and profitable than ERC721A. High effect, I admire the serious efforts of the Gh0stlyGh0sts project team, but I personally think that the gimmick of this project is greater than the practical significance, at least according to the current solution.

Posted by:CoinYuppie,Reprinted with attribution to:https://coinyuppie.com/will-that-cross-chain-gh0stlygh0sts-be-the-next-azuki/
Coinyuppie is an open information publishing platform, all information provided is not related to the views and positions of coinyuppie, and does not constitute any investment and financial advice. Users are expected to carefully screen and prevent risks.

Like (0)
Donate Buy me a coffee Buy me a coffee
Previous 2022-04-07 10:37
Next 2022-04-07 10:38

Related articles