原文标题:《 那个可以跨链的 Gh0stlyGh0sts 会成为下一个 Azuki 吗? 》
原文作者:今天有更懂这个世界一点了吗
This article is from wechat official account:Did you understand the world a little better today
This article is relatively heavy on code and can be a bit boring, so please bear with me to understand how it works.
These days, all groups are spreading a project called Gh0stlyGh0sts. As a Free Mint project, it has achieved a hundredfold increase in a single day. The main reason behind this is that everyone is talking about the cross-chain technological innovation it can achieve.
Remember who was the blue chip after the last technological innovation? Azuki, it made ERC721A popular. For details, you can read the previous article web3's world is wild.
Article also mentioned many times before web3 is an extremely dependent on the field of technology innovation, on the one hand can release more upper application potential, on the other hand because of soil dog project too much, make the technological innovation project will directly be as willing to do things for a long time, to produce fomo mood, so the technology innovation from the point of view, It is possible for Gh0stlyGh0sts to have Azuki genes.
However, after research, I believe that these operations are not reproducible and are very heavy compared to ERC721A, which brings limited benefits. Therefore, I don't think it will become the next Azuki, or this solution will be difficult to use on a large scale like ERC721A. The specific reasons will be explained at the end of the article, please bear with me. But please note that this article does not offer any investment advice.
When everyone is Shouting that this project can cross the chain of black technology, our public account is committed to help you more deeply understand the nature of the principle, so this article for everyone to throw out Gh0stlyGh0sts cross chain exactly who what is going on.
Its Twitter feed shows what it calls the world's first omnichain full chain NFT project.

Let's take a look at the timeline of their first and most important four tweets.
It says it is the first native full-chain NFT, which can mint and transfer on any chain. The mint and current chains affect the background color and border color of the NFT, respectively, so you can see at a glance the history of the NFT. However, the common cross-chain bridge such as Wormhole is realized by mint on one chain, locking it in the cross-chain bridge contract, and then mint on another chain to flow a new one, thus emphasizing the difference between itself and traditional cross-chain Bridges.
So there are three differences between it and traditional chain Bridges:
- You can mint on any chain instead of first mint on one chain
- It is possible to truly "transfer" instead of locking one and copying another
- Original chain and current chain affect NFT style

As you can see, the background and border are different because of the difference in previous life and present life.

When an NFT is transferred, it will burn the NFT on the chain and mint a new one on the other chain. So that's how it works. From this point of view, it looks like the lock action is changed to burn instead of traditional cross-chain bridge.

Here he says using the Layer Zero protocol to achieve cross-chain, HMM.. That means the key point is at Layer Zero.

Now that the context is clear, let's start parsing, starting with Layer Zero.
First of all, it is self-evident why cross-chain is important. You can regard each chain as a bank. If the bank cannot transfer money between different banks, your asset liquidity and benefit will be greatly weakened.
Here's their paper, if you're interested, read it for yourself:
https://layerzero.network/pdf/LayerZero_Whitepaper_Release.pdf
The reason why Layer Zero is called Zero indicates that it is not in the same latitude as Layer1 such as Ethereum and Solana. The principle of cross-chain bridge built on these Layer1 is basically as mentioned above. Assets are locked in one chain and then generated in another chain. The process of asset locking is the trusteeship of assets of these cross-chain Bridges, which is why it is often exposed that the cross-chain Bridges are attacked by hackers, so people increasingly distrust the trusteeship of assets to the cross-chain Bridges. In addition to security, the operation of the cross-chain Bridges is also very complicated, requiring multiple transfers and gas charges. Layer Zero does not lock managed assets. Layer Zero is a lower level communication protocol that directly transfers information between two chains. In a simple way, Layer Zero deploys nodes between multiple chains to help you communicate between the two chains. For example, if you call the node of chain B in the contract of chain A, and tell it that you want to transfer an NFT, then the node helps you create A new NFT between the two nodes, and these two nodes assume the task of communication, so the principle is very simple.
Let's look at the Gh0stlyGh0sts contract code. The traverseChains function performs cross-chain operations and requires two parameters: chainId chainId and tokenId.

What does holder authentication do, then passing the chainId into a trustedRemoteLookup array to verify that it's greater than zero?
We can see from the document at Layer Zero that each chain of the protocol has an ID, so the incoming chainId represents the chain to which you want to transfer the NFT, so the trustedRemoteLookup should store the contract address of different chains. You need to check here if there is a contract for the target chain you want to transfer.

Let's enter the Binance chain id2 and see if it returns the corresponding contract address.

Burn destroys your NFT. Burn gets the owner of the NFT and then _beforeTokenTransfer. This function requires three arguments, from, to, and tokenID. When from is 0 it represents casting, when neither from nor to is 0 it represents transfer, when from is not 0 but to is 0 it represents destruction, so here we pass to 0 for destruction, At the same time, execute approve to cancel all authorization of the TokenID, then subtract 1 from the balance of the original owner, and delete the association between the owner and the TokenID in the Mapping holding relationship.

The endpoint is the Layer Zero interface that calls the chainId of the target chain to be transferred, the contract address of the target chain trustedRemoteLookup[_chainId], and the payload represents the information that you want to transmit to the target chain. You can see in the code that it passes two arguments, the current user contract address msg.sender and tokenId, so we can assume that the target chain must have a mint function that uses these two arguments to mint to produce a new NFT.

After a Layer Zero send message is captured by the target link, the lzReceive function is executed. We can see that lzReceive decodes the payload first. Then the _safeMint function is executed to cast the corresponding NFT.

Now that we know how to transfer between chains, let's see how it works. Mint works on different chains. When I first saw this capability, my first thought was how to do it because Mint is incrementing by TokenID. Then polygon will have to start from #2 mint, so many chains back and forth mint is no trouble, I was a little bit happy when I saw their solution..
The contract codes on the left and right sides of the following figure are two different chains, respectively set two parameters as the start and end of tokenID, that is, I can only mint 0 ~ 3084 in Ethereum, I can only mint 6476 ~ 7092 in Arbitrum, So you can mint in which chain are written dead in advance, the outside people do not know that still think it is very smart, in fact, the way is very rude.

Don't forget that it has another feature, which is that the background color of different chains is different, and the border color after the chain is different. In the picture below, I opened an NFT that spans ethereum, and it shows that its birth chain is Polygon.

When I finished my study, I was surprised and listened to the analysis.
When I heard about this feature, my first thought was how can I "dynamically" identify the tokens after cross-chain and automatically change baseURI? As we all know, each token corresponds to A link stored in IPFS, which stores its attributes and pictures. For example, my NFT was originally in CHAIN A, but when I crossed it to chain B, I would first need A code to automatically generate A JSON file that stores the attributes before and after the chain. And automatically generate the image, and then upload it to IPFS, replace the old link, and map it to token, but IPFS doesn't allow change, it doesn't work, and when I was scratching my head, I opened their IPFS file.
You can see that it wraps 7 chain folders in a single large folder, with the corresponding JSON files in the subfolders, and then each subfolder is the same size 4.2m.

And then I spent about half an hour trying to figure out why. What does that mean? At last it dawned on him that he had exhausted all possibilities beforehand.
Remember that you hardcoded the mint numbered interval for each chain, and then made it into a JSON file with 10,000 full NFT, and set the birth chain according to the interval, as well as the background image. For example, set the birth chain of the 6,000th NFT to polygon. The background color is purple and there is no border, so if #6000NFT does not cross the chain, the normal one will be indexed by the poly in the figure above.
Then it copied the json file of the 10,000 NFT for 7 times, and added a border to the NFT that did not belong to the chain. For example, the #6000 birth chain was polygon, so the image of #6000 in the eth folder will have an extra gray border. Similarly, #6000NFT in Binance has a blue border.
I never thought of this operation. At first, I thought it was very advanced, so I kept looking at the code to find out the business logic of changing baseURI. After studying for a whole hour, I failed to find out.
Above is how Gh0stlyGh0sts achieves the effect of cross-chain + multi-chain Mint + front and back chain change style. In summary, this scheme does not have any universality, complicated operation and high complexity, which is far from the simple and high-yield effect of ERC721A. I admire the earnest efforts of the Gh0stlyGh0sts project team, but I personally think the gimmick of this project is more than practical significance, at least in terms of the current solution.
The original link
Welcome to join the official BlockBeats community:
Telegram Subscription Group: https://t.me/theblockbeats
Telegram Discussion Group: https://t.me/BlockBeats_App
Official Twitter Account: https://twitter.com/BlockBeatsAsia