Withdraw from Loopring 3.1 — the First-Ever Experiment of Shutting Down a zkRollup

Daniel Wang
Loopring Protocol
Published in
6 min readFeb 7, 2021

zkRollup is the most secure and practical solution to scale Ethereum before Eth2 is fully rolled out (and potentially even after). As we have shut down Loopring protocol 3.1, the very first Ethereum zkRollup (on which Loopring Exchange v1 was based), it’s now time for the Ethereum community to verify and witness that all remaining user assets on Loopring L2 are secure as expected, even when we as operators are no longer processing any user requests.

Below you will find how to withdraw your outstanding balance from Loopring 3.1.

As mentioned in mid-December, with the launch of Loopring protocol 3.6, Loopring 3.1 has become deprecated, and as of February 1st, the v1 DEX UI is down, and no withdrawals (or any other operations) are being processed by the operator (aka relayer). As a zkRollup, though, users do not need to rely on Loopring to get their assets back. All that needs to exist is Ethereum.

About Withdrawal Mode

You’ll have to wait for about two weeks (Feb 20th) so the zkRollup can enter Withdrawal Mode which disables all operators from being able to process any requests or modifying the zkRollup’s state root.

You can see above that the zkRollup deposit contract is not yet in withdrawal mode https://etherscan.io/address/0x944644Ea989Ec64c2Ab9eF341D383cEf586A5777

Withdrawal mode basically means the exchange is dead. The exchange can no longer operate, and all that is possible is users reclaiming their funds. The reason there is a two week delay is because, if in other circumstances the exchange did not mean to stop operating (i.e., maybe a natural disaster wiped out its servers, and it was temporarily unable to process txs & generate the ZK proofs), it would be good if they had time to get back up and running before their business is shut down. Two weeks may be a bit long, but since this was the first ever live rollup on Ethereum, a longer window was used. In future, we could use shorter ones, like a few days or so.

How to withdraw

1. Find your account ID and token IDs

You will need to know your account ID. Your account ID is mapped to your Ethereum address. We have exported all users’ account IDs here: https://gist.github.com/dong77/a694dff3a3238fb760a5680e9acd4a84

So just search for your Ethereum address in that file, and see your corresponding account ID.

You can also query your account ID using on the Loopring Exchange v1 contract on Etherescan.io [function #31 ‘getAccount’]. Just fill in your Ethereum address and hit query.

https://etherscan.io/address/0x944644Ea989Ec64c2Ab9eF341D383cEf586A5777

The list of tokens and their IDs supported by Loopring 3.1 can be found here: https://gist.github.com/dong77/354fd722ba5dc8474097f896267f0642

2. Get your Merkle proofs

For each token you’d like to withdraw, you’ll need a Merkle proof. All Merkle proofs are available in this single file: https://gist.github.com/dong77/dc3c662a97c54166ed91089e95ab95bb

So when you see your account ID in that file, check which token ID corresponds to which token in the prior step.

[This basically shows a proof of a token balance per account, per token. We generated these proofs to make users’ lives easier, but if we weren’t around (say we ran away or were incapacitated), all the data is on Ethereum, so you could have generated these proofs yourself, or some community member could have done it for everyone.]

3. Validate your proofs

To verify your proofs, please go to the same contract on Etherscan.io and use the isAccountBalanceCorrect function [#30]. Make sure it returns true before your withdrawal attempts. If your proof is invalid, please let us know on Discord and we will help.

The Merkle root is finalized as: 0x1676dedf62946863e1dfc2160807f69d370343bc95ee00af0a27f559f7a22e64
[This represents the last state of the zkRollup, the last checkpoint put on Ethereum.]

https://etherscan.io/address/0x944644Ea989Ec64c2Ab9eF341D383cEf586A5777#readProxyContract

Here’s an example of the information filled in for account ID 1, token ID 2:

As mentioned, the Merkle root is always: 0x1676dedf62946863e1dfc2160807f69d370343bc95ee00af0a27f559f7a22e64, and then find all the other information for your account ID in this file: https://gist.github.com/dong77/dc3c662a97c54166ed91089e95ab95bb

So from the above filled in example, you see I got the info from the file as such:

You can see this account (ID 1) has two tokens remaining in the zkRollup (token IDs 2 & 3), which correspond to LRC and USDT, so this account will have to make two withdrawals.

Also remember that your token balance often has 18 decimals spots, but not always. In the example above, token ID 2 is LRC, which does have 18 decimals, so the above amount is 0.024 LRC. It may not always be worth withdrawing if the amount is worth less than the gas cost to withdraw. Check the amount of decimals your tokens have on the respective token contract in Etherscan. For example, here is LRC token contract, where you see 18 decimals.

4. Make withdrawals

To make witdrawals, connect your Ethereum wallet, then invoke the withdrawFromMerkleTree function [#8]. You’ll get your tokens back immediately after the transaction is confirmed on-chain.

Connect your wallet
https://etherscan.io/address/0x944644Ea989Ec64c2Ab9eF341D383cEf586A5777

You fill in all the same information you did in the prior step where you confirmed that the balance is true.

Gas cost per Merkle proof withdrawal is about ~1.3m gas, but it differs per token and can be lower or higher. [You may see a higher gas limit estimate for your tx, but not all will be used, just like always.]

That’s it. In this way, you can remove all your assets from Loopring zkRollup now, or at any time in the future. As long as Ethereum exists, you can interact with the rollup contract and claim what is yours, and you don’t need to rely on anyone. We know this is not the easiest process in the world, but it should only take a few minutes, and the important point is that you are always in control of your assets, not relying on Loopring or anyone else. We can’t be evil, even if we tried. This is why zkRollups will be the L2 scaling solution of choice for Ethereum going forward: complete Ethereum security guarantees over your assets, with 1000x greater scalability.

Once your funds are off Loopring 3.1, you may want to consider depositing them to Loopring 3.6 (exchange.loopring.io), a much more powerful, efficient and useful protocol. You can do high-speed, gas-free trades, swaps, add liquidity to AMM pools, and transfers.

About Loopring

Loopring is an Ethereum zkRollup protocol for scalable, secure exchanges & payments. Loopring builds non-custodial, high-performance products atop our Layer-2 protocol, including the Loopring Wallet — a mobile Ethereum smart wallet, and the Loopring Exchange — orderbook and AMM DEX with no gas fees for trades. To learn more, you can sign up for our Monthly Update or see Loopring.org.

TwitterDiscordRedditGitHubDocsYouTubeWeibo

--

--