Mirroring: Trade on L1 // Play on L2/L3

Pirate Nation
5 min readMar 30, 2023

--

To protect the integrity of the Founder’s Pirate collection as part of our launch on our custom L3 networks, we launched Mirroring: new onchain tech enabling a huge step forward in adoption-readiness for web3 gaming.

When we launched Pirate Nation, building something fully onchain was essential to our vision. Due to the differing constraints and capabilities of different chains, we needed to build the game to operate across multiple chains so we could minimize the technical tradeoffs of each chain and eliminate the risks associated with bridging. In other words, we wanted to have our onchain cake and eat it, too.

To solve this conundrum, we launched Mirroring, a paradigm shift for how onchain games are built. Mirroring further enables us to have assets on the chains with sufficient liquidity and games on the chains that are best suited to scalability, frictionless player experiences, and manageable operating costs.

Previously, playing Pirate Nation required bridging Founder’s Pirate NFTs to Polygon. With Mirroring, players can keep their Founder’s Pirates on Ethereum and access the game on the Apex and Boss chains seamlessly.

Mirroring opens up some distinct advantages of us over a bridging model, but with some interesting trade-offs. Some of the advantages we have are:

  • NFTs remain tradable on a blockchain with substantial liquidity
  • Streamlined purchasing for flagship NFTs
  • Less friction (read: no bridging) to for players to start engaging immediately

Altogether, this represents a massive step forward in on-chain gaming moving towards wider adoption, and mainstream-readiness.

So how does mirroring work?

When you purchase a NFT on Ethereum (L1), we monitor the L1 Token contract looking for any Transfer event. When a transfer event occurs, we have a similar, yet different contract on our L3s that is only tradable by us. This contract is used by the gameplay contracts on L3 to verify you are actually the owner of your particular NFT.

When you make a purchase on Ethereum, we watch all the token transfer events of our token and use our mirroring system to react in a 3 step process.

The first step moves the token to a temporary address that restricts the usage of the token in L3. For Pirate Nation, this is the Sea address (0x5EA) to be able to tell users how long it will generally take for their Pirates to come on board into the game and be ready to play.

Once we’re satisfied that the block is going to be confirmed, we move the token to the new owner.

Finally, we verify that everything processed correctly and the block has been locked in.

We also have a separate task that scans for finalized transactions and that is equipped to handle issues such as downtime of the Mirroring system or catching re-orgs. This process will scan through ownership values and put them in their appropriate places.

The impacts of opening up trade.

One of the downsides to this approach is that we place a restriction on our game design. Since it takes time to travel across the sea to the new owner, if the NFT was involved in a long gameplay action that was triggered between the user buying and the NFT moving, the new owner could end up with a different outcome than expected. As the current gameplay of Pirate Nation is very safe, the worst thing that could happen is you end up with a little less energy or fewer resources than you have planned.

To supplement this, Tokens that will have negative impacts associated with them will be required to have appropriate two-step cooldowns to allow for this. This will allow the buyer to be able to see what is happening and gamble on the outcome.

NFTs and bridges are not a match made in heaven.

One of the biggest advantages of this approach over using a traditional bridge is that when a bridge typically owns the asset on the other network. In our previous implementation of bridging, this was certainly the case. For our original contract, the Polygon bridge owned a significant amount of Pirate NFTs.

This creates a massive dependency for your assets. If the bridge goes down at some point, you don’t actually own the token on the other network anymore as you bridged it. While this is no problem for things like ERC20 tokens or even ERC1155 tokens where the tokens are not unique and have a larger supply, it is more of a nightmare for ERC721s.

If there was a bad actor in the bridge, it would be very difficult to get that asset back as you can’t just mint back a 1/1.

Ownership is key here.

To solve the above solution, the key is to never have the ownership on L1 be compromised. By ensuring the player always holds the L1 token, they will always own the token. Ownership matters.

Layer 2 and portability.

Mirroring brings portability here, enabling a multichain experience that protects against any hiccups a given L2 or L3 might encounter. If for some reason there was downtime, we could easily look up the Layer 1 for ownership properties and continue on another chain.

Interoperability.

Some major advantages of mirroring over bridging or even using L1 → L2 messaging is that you can work with any existing NFT as long as it supports the ERC721Spec. This means our L3 games can use any existing NFT to play games, which can allow some pretty nice interoperability between different games.

Additionally, because there are no changes needed on the L1 side, the L1 can be gas optimized for transfers. This means you can make your L1 contracts specific to your use case. In the case of minting the PirateNFTL1 again, we considered various contracts (ERC721, ERC721A, TinyERC721 and ERC721Enumerable) and landed on using ERC721 without enumerable, as it was the most gas efficient for our existing ownership distribution.

Mirror, mirror on the wall.

Mirroring has worked incredibly well for Pirate Nation across 3 blockchains thus far. We’re incredibly excited to share Mirroring with other apps and games looking for useful interoperability!

Interested in trying Proof of Play Mirroring? Let us know using this form.

Onward!
Proof of Play Team

--

--

Pirate Nation
Pirate Nation

Written by Pirate Nation

A new type of game, filled with high seas adventure, treasure, fun, and unexpected surprises

No responses yet