Optimism Bridge - Distinct Wallets
How many distinct wallets have deposited or withdrawn ETH to Optimism via the native bridge in the last 60 days? Visualize your findings.
OPTIMISM
-
Optimism is an Optimistic Rollup. Optimistic rollups can process transactions for a much lower price than Ethereum Mainnet (also known as layer 1 or L1) because transactions are only processed by a few nodes, instead of every node on the network. At the same time, the data is all written to L1 so everything can be proved and reconstructed with all the integrity and availability guarantees of Mainnet.
-
To use L1 assets on Optimism (or any other L2), the assets need to be bridged. One way to achieve this is for users to lock assets (ETH and ERC-20 tokens are the most common ones) on L1, and receive equivalent assets to use on L2. Eventually, whoever ends up with them might want to bridge them back to L1. When doing this, the assets are burned on L2 and then released back to the user on L1.
-
This is the way the Optimism standard bridge works. In this article we go over the source code for that bridge to see how it works and study it as an example of well written Solidity code.
CONTROL FLOWS
-
The bridge has two main flows:
- Deposit (from L1 to L2)
- Withdrawal (from L2 to L1)
Deposit flow
- Layer 1
- If depositing an ERC-20, the depositor gives the bridge an allowance to spend the amount being deposited
- The depositor calls the L1 bridge (depositERC20, depositERC20To, depositETH, or depositETHTo)
- The L1 bridge takes possession of the bridged asset
- ETH: The asset is transferred by the depositor as part of the call
- ERC-20: The asset is transferred by the bridge to itself using the allowance provided by the depositor
- The L1 bridge uses the cross-domain message mechanism to call finalizeDeposit on the L2 bridge
- Layer 2
- The L2 bridge verifies the call to finalizeDeposit is legitimate:
- Came from the cross domain message contract
- Was originally from the bridge on L1
- The L2 bridge checks if the ERC-20 token contract on L2 is the correct one:
- The L2 contract reports that its L1 counterpart is the same as the one the tokens came from on L1
- The L2 contract reports that it supports the correct interface (using ERC-165).
- If the L2 contract is the correct one, call it to mint the appropriate number of tokens to the appropriate address. If not, start a withdrawal process to allow the user to claim the tokens on L1.
- The L2 bridge verifies the call to finalizeDeposit is legitimate:
Withdrawal flow
-
Layer 2
- The withdrawer calls the L2 bridge (withdraw or withdrawTo)
- The L2 bridge burns the appropriate number of tokens belonging to msg.sender
- The L2 bridge uses the cross-domain message mechanism to call finalizeETHWithdrawal or finalizeERC20Withdrawal on the L1 bridge
-
Layer 1
- The L1 bridge verifies the call to finalizeETHWithdrawal or finalizeERC20Withdrawal is legitimate:
- Came from the cross domain message mechanism
- Was originally from the bridge on L2
- The L1 bridge transfers the appropriate asset (ETH or ERC-20) to the appropriate address
Description of work:
Many blockchain bridges exist allowing users to move assets between different blockchains. One of the blockchains currently receiving a lot of bridge volume is Optimism. There are several bridges you can use to move tokens to Optimism, but for this bounty we are particularly interested in Optimism’s bridge. In this Bounties we want to check the following:
- How many distinct wallets have Deposited / Withdrawn ETH to Optimism via the native bridge in the last 60 days?
Note:
- We use the
[ethereum.core]
schema and[ez_eth_transfers]
table - The Optimism native bridge deposit contract address is
0x99c9fc46f92e8a1c0dec1b1747d010903e884be1
and0x52ec2f3d7c5977a8e558c8d9c6000b615098e8fc
for deposit ---> etherscan - The Optimism native bridge withdraw contract address is
0x25ace71c97b33cc4729cf772ae268934f7ab5fa1
for withdraw ---> etherscan
According to the results, it is clear that:
- The number of distinct addresses of wallets that have deposit to Optimism is more than withdraw, and most users deposit to Optimism.
According to the results, it is clear that:
- The number of distinct addresses of wallets that deposit to Optimism on a daily basis is much more than withdraw, and most users deposit to Optimism.
- On June 1 and May 31, the highest number of distinct wallet that have deposits to Optimism is observed
- In late April and early May, the highest number of distinct wallet that have deposits to Optimism is observed daily during the month
According to the results, it is clear that:
- From the top 10 unique wallets that deposit and withdraw to Optimism, it is clear that those who deposit have more transactions than withdraw.
- Address
0x428ab2ba90eba0a4be7af34c9ac451ab061ac010
had the highest number of withdraws (10.7% of total withdraw by distinct wallet) - Address
0xc716143aa602252fe734ad7e96d9b4464f5eb61e
has the largest number of deposits