Why bridge?

StarkNet is a general-purpose Layer 2 rollup, extending Ethereum and inheriting its security benefits. Trustless bridging of assets between layers is an important piece of the puzzle for L2s to facilitate the interoperable future of blockchain applications.

Design

This is an initial design of an NFT bridging protocol from L1 Ethereum to L2 StarkNet with room for iteration and improvement. The bridge is initially designed for the most simple use case of projects wishing to bridge their L1 Ethereum NFT collections to L2 StarkNet. In the future, we may explore additional primitives and extensions such as bridging L2 native assets to L1 or supporting more networks.

  • Bridge Registry (L1)
  • ERC721 Escrow (L1)
  • ERC721 Bridge (L1)
  • ERC721 Bridge (L2)

IERC721_Bridgeable

For StarkNet token contracts to be compatible with the ERC721 bridge, they must implement IERC721_Bridgeable in their ERC721 contracts. The interface specifies permissionedMint and permissionedBurn functions, which should be access limited to only the bridge and can control the supply (minting and burning) of the tokens on StarkNet. Upon depositing tokens from L1, the bridge will mint tokens to the recipient on L2, and similarly burn tokens upon withdrawing tokens to L1 from L2. The interface is inspired by StarkWare’s fungible token bridge StarkGate and its interfaces for L2 bridgeable (fungible) tokens.

User flows

Registration

When the token bridge is deployed, project owners will be able to register their L1 and L2 token contract pairs to make their assets bridgeable by reaching out to Immutable for manual contract registration. On our Goerli testnet deployment, users can register their contracts permissionlessly. We will be looking into ways to make the entire mainnet registration process permissionless and frictionless in the future.

Deposits from L1 to L2

NFT deposits from Ethereum to StarkNet follow a standard ‘lockbox’ system where the deposited assets are held in an escrow contract (ERC721 Escrow) on L1 while being minted and used on L2. This can be framed as a ‘wrapping’ operation where the wrapped asset is freely tradable and can be redeemed for the base asset at any time. Deposits require that the L1 <> L2 token contract pair has already been registered in the bridge registry as above, and also require an additional step from users to approve the bridge address for transferring the tokens they wish to deposit. After token approval, only one transaction on L1 is required to deposit, which automatically triggers the handler on the L2 bridge to mint the corresponding NFT(s) when the L1 message is received.

Withdrawals

Only the owner of the L2 equivalent asset will be able to initiate the withdrawal and retrieve the NFT from escrow, at which point the token will be burned on L2 and the details of the withdrawal will be sent in a message to the L1 bridge contract. Unlike in the L1->L2 flow, we can’t automatically trigger transactions upon the receipt of L2 messages so the withdrawal process requires a second step from the user to complete the withdrawal on L1. The initial implementation of the bridge only supports withdrawals of L1-deposited tokens, not L2-native tokens, but this is also a use case we are exploring.

What’s next?

Feel free to experiment with bridging your assets through our Goerli testnet deployment now! Visit our Github for information on our contract deployments and how you can get started.

  • Decentralization — let projects or users permissionlessly bridge their assets without the need for a trusted third party to register with the bridge
  • Automatic StarkNet contract deployments — reduce bridging friction for developers and users by auto-deploying a standard ERC721 contract upon bridging an asset for the first time
  • Support withdrawal of L2 native assets — providing an off-ramp to Ethereum for StarkNet native projects gives users more flexibility and a stronger guarantee for their assets
  • Multi-chain — the bridge design can be extended to include multiple chains and rollups, including our existing Immutable X StarkEx ecosystem, to facilitate more StarkNet interoperability

Socials

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store