How do I use the Starknet Bridge?

The StarkGate (often mistakenly called Stargate) bridge connects Starknet and Ethereum, and its latest upgrade will support a plethora of Ethereum wallets. Bridging on Starknet is a bit more nuanced than some other crypto bridges, but don’t worry - we’ll explain everything.
Starknet
• Aug 11, 2023
7 min read
How do I use the Starknet Bridge?

First off: Can I use my Ethereum wallet on the Starknet bridge?

No. Starknet has a unique address format, which means you cannot use your existing Ethereum wallet (for example, your MetaMask) on both sides of the Starknet bridge. 

However, you can connect both your Ethereum and Starknet wallets to StarkGate and it facilitates the transfer of your funds.

In this post, we’ll explain:

  • The role of the StarkGate/Stargate bridge on Starknet.
  • A step-by-step guide on how to use it.
  • A couple of questions that our users have fed back after bridging their own funds, primarily how to withdraw from Starknet.

Ok, so how does bridging work in crypto?

Bridging allows you to seamlessly transfer your assets between chains, so you can explore opportunities when they’re brand-new.

Blockchains were not built to communicate with one another, as each chain has its own rules and consensus mechanism. This is good for security but it poses interoperability challenges, particularly as we move further into the realm of multi-chain DeFi.

Bridges provide a way for two chains to talk to one another, so users can move their funds to different ecosystems and seize:

  • New trading opportunities (for example, the chance to acquire an emerging token on its native chain).
  • Yield and investment promotions with an attractive APR.
  • NFTs that are limited to a particular ecosystem.

And in the case of layer-2s, users benefit from higher throughput and significantly lower gas fees.

This video, from the Ethereum foundation, sets out the goals of bridges in more detail.

https://www.youtube.com/watch?v=X_GE6VrmDvM

The bridging process is usually fairly simple: you deposit your tokens on one side of the bridge and receive an equivalent amount of tokens on the other.

The tokens are locked on one side of the bridge and the new tokens are minted on the other (the system is known as ‘lock-and-mint’ for this reason).

The StarkGate bridge works on this basis, too. 

So, what is unique about the Starknet bridge?

There are two major points that make bridging on Starknet different, and mean you can’t use the same address on both sides.

  1. Starknet does not have the same address space as Ethereum. 

Starknet is written in Cairo while Ethereum is written in Solidity. This means that, while Ethereum account addresses contain 40 hexadecimal characters, Starknet account addresses contain 63.

  1. Starknet is based on the concept of account abstraction.

Account abstraction splits wallets into two parts: the surface-level interface and a smart contract underneath, which allows us to add multi-factor verification and loads of other advanced features.

However, it also means that every wallet on Starknet is a smart contract wallet, and every transaction on Starknet has to go through the account smart contract before it can interact with any other contract on-chain. 

Why is the Starknet bridge safer than regular bridges?

We all know bridges get hacked. In fact, bridges are one of the most obvious points of failure in crypto. 

There are two reasons for this:

  1. Bridges are only as strong as their weakest link. If one side of the bridge gets hacked, funds are lost.
  2. Bridges usually have a centralized control system in the form of multisig wallets. Often, individual wallets (signers) are targeted and compromised, which means an attacker can gain control over the entire bridge.

However Starknet, and other ZK rollups, inherit the security of the Layer 1 Ethereum blockchain. Furthermore, the bridge operations (in this case, StarkGate) are verified by the verifier contract on Ethereum L1. 

Other bridges rely on validators (humans), who are required to stake money in a form of game theory – if you’ve got skin in the game, you won’t commit foul play, or so the thinking goes. However, Starknet’s bridge uses incorruptible math, not validators.

How does StarkGate solve the Starknet address issue?

StarkGate allows you to connect both your Ethereum wallet and your Starknet wallet.

With StarkGate, each supported token is associated with separate L1 and L2 bridge contracts, which communicate with one another via the Starknet messaging system. 

Starknet has provided a technical guide to how the bridge works, but here’s a basic overview of the process.

  1. The user initiates the deposit by supplying the recipient address and the amount to transfer. The deposit function then checks whether the funds are within the bridge limits, transfers the funds to the StarkGate bridge, and sends a message to the relevant L2 side of the bridge with the amount to be transferred and the recipient address. At the end of this step, the deposit transaction is known to Starknet’s sequencer.
  2. Once enough L1 block confirmations are received, the sequencer may trigger the handle_deposit function, which calls to the relevant ERC-20 contract and mints the tokens for the user.
  3. Finally, Starknet’s prover will prove its validity and submit a state update to L1.

Ok, so how do I actually use StarkGate?

You can find the StarkGate bridge here. If you prefer to use the bridge in testnet (in other words, use simulation tokens so you can get to grips with the bridge before you cross for real) visit the Goerli version.

Now we’ll give you a step-by-step tutorial. 

First, log into both your Braavos wallet, and the wallet you use on Ethereum (we’re going to use MetaMask for this demo). If you’re using the mainnet bridge rather than the testnet version, make sure the network of your Layer 1 wallet is set to Ethereum and your Braavos wallet is set to Starknet Mainnet. 

Now, go to the StarkGate site. Please pay attention to the warning in the bottom right-hand corner: Starknet is still in alpha, so the bridge may be susceptible to delays and bugs.

Pay attention to the warning provided by the Starknet bridge.

When you’re ready, connect both your Ethereum and Starknet wallets. You can do this in either order, but we’re going to start with our Ethereum (MetaMask) wallet.

To bridge with Starknet, you first need to connect your MetaMask.
Many users will use MetaMask when crossing the bridge.

Once you’ve connected your Ethereum wallet, you’ll be prompted to connect your Starknet wallet. Again, it’s a very simple process. And, of course, we’re going to be using Braavos.

You'll need to connect your Starknet wallet to the Starknet bridge.
The Starknet wallet currently supports Braavos and Argent X.

Now, enter the amount of tokens you wish to bridge, and whether you want to deposit or withdraw from Ethereum or Starknet. 

We’re going to go from Ethereum for this demo.

To use the bridge, you'll need to enter the amount of tokens you wish to transfer.

Once you’ve clicked ‘Transfer’, your L1 wallet will ask you to confirm the transaction. Be sure to check the gas fee before you give your consent.

Be sure to check the gas before confirming your Starknet bridge transfer.

And… you’re done.

Now your bridge transfer is complete.

Here is how to bridge funds with Starkgate in 5 steps:

  1. Log into both your Braavos wallet and the wallet you use on Ethereum like Metamask
  2. Connect both your Ethereum and Starknet wallets
  3. Enter the amount of tokens you wish to bridge
  4. Select whether you want to deposit or withdraw from Ethereum or Starknet
  5. Clicked ‘Transfer’, and confirm the transaction on your L1 wallet

A transaction confirmation pop-up will appear, assuring you that your transaction has been successfully processed.

What are the common issues users face with StarkGate?

Our users report two common issues when using the official Starknet bridge.

Withdrawing to Ethereum

When you transfer funds from Ethereum to Starknet, it all happens in a single transaction.

However, if you want to take the bridge from Starknet back to Ethereum, you need two separate transactions. Users often forget the second step, as it is relevant only once your funds are actually moved to L1, sometimes hours after you initiated your transaction. 

First you initiate the withdrawal on layer-2 with your Starknet wallet, then you need to wait till the block containing the transaction has been proved and verified by the Starknet verifier smart contract on Ethereum L1. This can take a few hours. 

Then you will need to connect again with your Ethereum wallet to StarkGate and issue a withdraw transaction, withdrawing the funds from the Ethereum side of the bridge. 

Until you do this, the funds will remain in the L1 side of the bridge and won’t go through to your L1 wallet.

SpaceShard has been working together with StarkGate to simplify this process and offer a service (a.k.a Keeper) that carries out the withdrawal for you in exchange for a small fee. 

You can take advantage of this feature by checking the “Use the automatic withdrawal service by SpaceShard” box.

SpaceShard simplifies the process of bridging with Starknet.

You can read more about it here.

The Starknet Pro Score

A lot of people ask us if the Starknet bridge transaction counts towards their Pro Score, which tracks their progress on Starknet.

Well, if you take the bridge from Ethereum to Starknet it doesn’t count, because the transaction was initiated from your MetaMask or other Ethereum wallet.

However, if you go the other way (i.e. Starknet from Ethereum) it counts. The Pro Score tracks all the transactions you make from Braavos wallet, and a transfer from the Starknet side falls into this category.

 

If you want to discuss StarkGate, bridging on Starknet or any of the other points raised by this article, we’re always happy to chat via Twitter or Discord.

And if you need a Starknet address to bridge funds from Ethereum, you can create one by downloading Braavos.

Braavos on Starknet

Braavos on Starknet

Be The First To Know

Subscribe now and receive monthly updates and interesting news about Braavos and Starknet ecosystem.