Bridging Secret NFTs
between Secret Network and
public chains: the challenge
Bridging Secret NFTs between Secret Network and public chains: the challenge of privacy
While integrating Secret Network, the team of XP.NETWORK had to solve an interesting issue: how do you transfer an NFT containing private data that only those with a special viewing key can see?scrt.network
What is Secret Network?
Secret Network (SCRT) is a privacy-focused blockchain built using the Cosmos protocol. It’s part of the same ecosystem as Cosmos itself, Osmosis, Juno, Stargaze, etc.
What makes Secret Network special is customizable privacy. On public blockchains, the full details of smart contract interactions are viewable by anyone. But on Secret Network, a user needs access rights to view the contents of a transaction. Smart contracts are able to have encrypted inputs, outputs, and state. For this reason, the network uses the term “Secret contracts”.
Secret Network has its own token standard: SNIP-20, or Secret Token. Any token (ETH, USDT, etc.) can be converted into SNIP-20 and basically made invisible to everyone except for users to whom you give access rights. Nobody else will be able to track the movements of these tokens. Secret Network has a set of bridges to transfer tokens from other chains (like Ethereum) and turn them into Secret tokens.
And in case you are wondering if there are also Secret NFTs , the answer is yes. Secret Network does have an innovative NFT standard (SNIP-721) that splits metadata into a public and a private part. Just like with SNIP-20, you need a special viewing key to access the private section, which can contain encrypted on-chain data like text, images, audio, video, and links to off-chain data. `
Here are some of the use cases for these privacy features:
- Frontrunning-resistant DEXs: bots can’t view the swap transactions in the mempool and can’t execute a sandwich attack (insert their own swaps before and after someone else’s to profit from the price movements)
- dApps that handle sensitive user data using NFTs, such as health records, decentralized identity, real estate property rights, etc.
- Private NFT auctions
- Transactions with large sums of money and valuable NFTs. On other chains, users often become a target for hackers because of their expensive portfolio, but on Secret Network, you can let everyone see your collection without disclosing your address
- Protecting NFTs from scammers: someone can copy the public metadata (picture, description), but they won’t be able to copy the private part.
- Fully random outcomes in games – something that is difficult to achieve on-chain.
Blockchains with transactional privacy have existed for many years: good examples are Monero and zCash. However, these chains do not support smart contracts, so their privacy protections are limited to sending and receiving cryptocurrency. Secret Network was the first blockchain to also provide computational privacy, which means that you can build private dApps on it
NFTs on Secret Network
The NFT market on Secret Network is only just emerging, which makes it an ideal integration partner for XP.NETWORK. We prefer working with disruptive emerging chains where we can make an impact on the formation of the ecosystem at the earliest stage.
There is one marketplace so far: Stashh. Launched back in 2021. It has over 300,000 NFTs issued on Secret Network, plus 12,000 on Ethereum, almost 40,000 on Polygon, and over 2,000 on Solana.
On Stashh, you’ll find collections like Anons, Secret Dogs, Secret Punks, Secret Girlfriends, and Mystic Punks. The recommended wallet to use with Stashh is Keplr, which also supports other Cosmos-based chains.
A great example of Secret NFTs is the recent drop by Quentin Tarantino himself. The private part of each of these 7 NFTs holds hand-written scripts for scenes from Pulp Fiction, together with exclusive audio commentary by Tarantino. Only the owners can access this content.
Another famous director to drop a Secret NFT collection is Kevin Smith. The 5,555 items celebrate his new horror movie Killroy Was Here and include hidden content and commentary.
How we implemented Secret NFT bridging
Perhaps you can already see the challenge that the XP.NETWORK team (led by our tireless CTO, Dima Brook) faced during this integration.
Our powerful NFT bridge supports over 25 chains, and they are all public. By default, we map smart contracts in such a way that all contract logic and metadata are bridged correctly: token IDs, royalties, etc. Often, NFTs bridged with XP.NETWORK display the message “Bridged from (chain name)” when they are listed on the destination chain, to avoid scams.
But what do you do when an NFT contains metadata that is designed to be visible only to the owner, and whoever they choose to share it with? If we were to preserve the full metadata for a SNIP-721 asset on the destination chain, it would expose sensitive information to everybody - like those Pulp Fiction scenes hand-written by Tarantino. On the other hand, other blockchains don’t have the necessary technology and NFT standards to support the private/public metadata split.
As always, we found a solution. According to our agreement with Stashh, XP.NETWORK transfers only the public part of an NFT’s metadata. On the destination chain, any NFT bridged from Secret Network will have a field called Private Metadata, always with the same text: “Bridge to Secret Network to view (bridge.xp.network)". You can find an example here .
This message makes it clear that:
1) The NFT was bridged from Secret Network;
2) It contains private information that you can’t view on the destination chain (Ethereum, Polygon, etc.);
3) You will, however, be able to view that private information once you transfer the asset back to Secret Network (as you are the holder and thus have viewing rights by default).
We see great potential in SNIP-721 and would like more people to discover Secret NFTs. XP.NETWORK bridge will act as an awareness vehicle of sorts: as users on other chains see Secret NFTs on marketplaces, they will be intrigued and motivated to buy and bridge them back to see what surprises they hide inside.