Exploring data on ckETH, the digital twin of ETH on ICP

Jennifer Tran
The Internet Computer Review
6 min readDec 21, 2023

--

This article explores data on ckETH, the digital twin of Ether (ETH) on the Internet Computer (ICP). It outlines how ckETH works and how to query data on ckETH using SQL.

How does ckETH work?

ckETH is the digital twin of ETH on ICP. Ethereum holders can acquire ckETH using these four easy steps:

  1. Deposit your ETH: Ethereum holders can deposit Ether to deposit function in the ckETH helper contract on Ethereum and specify their ICP principal or wallet address where they want their minted ckETH to appear.
  2. Mint ckETH: The ICP ckETH canister smart contract will then mint the same amount of ckETH to the indicated ICP principal or wallet address.
  3. Use ckETH: The ICP principal or wallet address can now use ckETH natively on the Internet Computer.
  4. Convert back to ETH any time: When the ICP principal wants to convert ckETH back to ETH, they can request the ckETH canister smart contract with the ETH amount and Ethereum address to which they want to send the ETH.

Check out this DFINITY forum post to learn more about how ckETH works.

Why ckETH?

ckETH exemplifies the following strengths of the Internet Computer blockchain:

  • No need for bridges — HTTPS Outcalls is a feature that enables ICP canister smart contracts to call API requests directly. ckETH bypasses attack vectors by directly calling Ethereum RPCs through HTTPS Outcalls.
  • Lower transaction fees — Ethereum holders can interact with ckETH on the Internet Computer which has significantly lower gas fees than on Ethereum, and then convert back to Ethereum whenever they want to transact on Ethereum.
  • Managing an Ethereum wallet directly in an ICP canister smart contract — ICP canister smart contracts can create and manage an Ethereum wallet address using threshold ECDSA. The ICP ckETH minter canister smart contract generated address 0xb25eA1D493B49a1DeD42aC5B1208cC618f9A9B80 which holds ETH and signs transactions.

ckETH lets you unlock the power of Ethereum on the Internet Computer, enjoying fast and cheap transactions and higher security, while still being able to seamlessly convert back to your ETH anytime.

ckETH is a part of our larger Ethereum integration. To learn more about the Ethereum integration on ICP, check out our website page.

Accessing ckETH Data

In addition to accessing ckETH data using the IC Data Dashboard, you can now query ckETH data using SQL on web3 data provider data platforms such as Dune, Flipside, and Footprint Analytics that support Ethereum transactions.

Example Dashboards

Example dashboards are now available for anyone to view and/or fork to add additional data themselves on both Flipside Crypto and Dune Analytics.

Flipside Crypto — (Data automatically updates every three hours)

Dune Analytics — (Please fork this and run on your account to get the latest data)

ckETH Tables

We have also worked with Dune and Flipside to label ckETH data in their SQL tables to help web3 analysts easily find and understand ckETH data.

Flipside: All references of ETH to ckETH deposit smart contract 0x7574eB42cA208A4f6960ECCAfDF186D627dCC175 are labeled as ckETH: Deposits

Dune: The cketh_ethereum.ckETHDeposit_evt_ReceivedEth table shows all ETH deposits for ckETH.

Using the cketh_ethereum.ckETHDeposit_evt_ReceivedEth table in Dune

Querying data

The data analysis below further examines the SQL queries used to build the dashboard on Flipside Crypto.

Deposits / Amount of ckETH

As alluded to above, Ethereum holders send ETH to the ckETH helper contract at 0x7574eB42cA208A4f6960ECCAfDF186D627dCC175 and specify their ICP principal (wallet address) where they want their minted ckETH to appear.

Therefore, you can assume that any ETH sent to the contract address 0x7574eB42cA208A4f6960ECCAfDF186D627dCC175 is minted as ckETH.

An example query to get the total ETH deposited (for ckETH):

SELECT
SUM(value) as deposits
FROM
ethereum.core.fact_transactions
WHERE
to_address = LOWER('0x7574eB42cA208A4f6960ECCAfDF186D627dCC175')

An example query to get the total unique wallet addresses that deposited ETH (for ckETH):

select
count(distinct(from_address)) as wallets
from
ethereum.core.fact_transactions
where
to_address = lower('0x7574eB42cA208A4f6960ECCAfDF186D627dCC175')

As of Monday, December 18, 2023, at 21:00 UTC, 74 distinct wallet addresses made 171 separate ETH deposits to receive ckETH.

Number of Deposits and Unique Wallets Deposited ETH for ckETH

Withdrawals / Removal or burning of ckETH

To withdraw ckETH (convert it from ckETH on ICP to ETH on Ethereum), the ckETH holder would approve the ckETH mint canister smart contract to deduct gas fees and set a specific Ethereum wallet address and ckETH amount to convert to ETH. The ckETH minter canister smart contracts the specified ETH amount to the specific Ethereum wallet address using the wallet address 0xb25eA1D493B49a1DeD42aC5B1208cC618f9A9B80.

An example query for total ckETH withdrawn:

SELECT
SUM(value) AS withdrawals
FROM
ethereum.core.fact_transactions
WHERE
from_address = LOWER('0xb25eA1D493B49a1DeD42aC5B1208cC618f9A9B80')

An example query for total unique wallet addresses that withdrew ckETH for ETH:

select
count(distinct(to_address)) as wallets
from
ethereum.core.fact_transactions
where
from_address = lower('0xb25eA1D493B49a1DeD42aC5B1208cC618f9A9B80')

As of Monday, December 18, 2023, at 21:00 UTC, 23 distinct wallet addresses made 36 separate ckETH withdrawals for ETH. This indicates that most users are holding or interacting with ckETH on ICP as opposed to converting it back to ETH on Ethereum.

Number of Withdrawals and Unique Wallets Withdraw ckETH to ETH

ckETH Supply

Therefore, the total ckETH volume is the number of deposits minus the number of withdrawals.

An example query for total ckETH supply:

with deposit as (
SELECT
SUM(value) AS deposit_count
FROM
ethereum.core.fact_transactions
WHERE
to_address = LOWER('0x7574eB42cA208A4f6960ECCAfDF186D627dCC175')
),
withdrawal as (
SELECT
SUM(value) AS withdrawal
FROM
ethereum.core.fact_transactions
WHERE
from_address = LOWER('0xb25eA1D493B49a1DeD42aC5B1208cC618f9A9B80')
)

SELECT
(deposit.deposit_count - withdrawal.withdrawal) AS cumulative_volume_in_ETH
FROM
deposit,
withdrawal;

As an alternative, you can query the current balance of the wallet 0xb25eA1D493B49a1DeD42aC5B1208cC618f9A9B80 since it holds all of the ETH.

SELECT
current_bal
FROM
ethereum.core.ez_current_balances
WHERE
user_address = lower('0xb25eA1D493B49a1DeD42aC5B1208cC618f9A9B80')
ORDER_BY
last_activity_block desc
LIMIT
1

Total Value Locked

Since ckETH is a digital twin of ETH on ICP, ckETH will have the same price as ETH on Ethereum. The total value locked is the current volume of ckETH multiplied by the current price of ETH.

An example query for total value locked:

with deposit as (
SELECT
SUM(value) AS deposit_count
FROM
ethereum.core.fact_transactions
WHERE
to_address = LOWER('0x7574eB42cA208A4f6960ECCAfDF186D627dCC175')
),
withdrawal as (
SELECT
SUM(value) AS withdrawal
FROM
ethereum.core.fact_transactions
WHERE
from_address = LOWER('0xb25eA1D493B49a1DeD42aC5B1208cC618f9A9B80')
),
eth_price as (
SELECT
price as eth_usd
FROM
ethereum.price.ez_hourly_token_prices
WHERE
symbol = 'WETH'
ORDER BY
hour DESC
LIMIT
1
)
SELECT
ROUND(
(deposit.deposit_count - withdrawal.withdrawal) * eth_price.eth_usd,
2
) AS cumulative_volume_in_USD
FROM
deposit
JOIN withdrawal ON 1 = 1
JOIN eth_price ON 1 = 1;

As of Monday, December 18, 2023, at 21:00 UTC, 815.3 ETH has been deposited and $1.8 million of value has been locked.

Total Volume of ETH Deposited and Total Value Locked (USD)

As the ICP and ETH communities discover the value-add of ckETH, we are seeing increasing volume.

The daily volume of ckETH

User Balances

ckETH holders can withdraw some of their ETH without converting all of their ckETH. Therefore, ckETH holders who have withdrawn ETH can still have ckETH balances.

To find their ckETH balances, you must subtract their deposit amount from their withdrawal amount.

An example query for user balances:

WITH Withdrawals AS (
SELECT
to_address::STRING AS wallet,
ens_domain,
SUM(value::FLOAT) AS amount_withdrew
FROM
ethereum.core.fact_transactions
LEFT JOIN ethereum.ens.ez_ens_domains ON set_address = wallet
WHERE
from_address = LOWER('0xb25eA1D493B49a1DeD42aC5B1208cC618f9A9B80')
GROUP BY
wallet,
ens_domain
),
Deposits AS (
SELECT
from_address::STRING AS wallet,
ens_domain,
SUM(value_precise::FLOAT) AS amount_deposited
FROM
ethereum.core.fact_transactions
LEFT JOIN ethereum.ens.ez_ens_domains ON set_address = wallet
WHERE
to_address = LOWER('0x7574eB42cA208A4f6960ECCAfDF186D627dCC175')
GROUP BY
wallet,
ens_domain
)
SELECT
COALESCE(w.wallet, d.wallet) AS wallet,
COALESCE(w.ens_domain, d.ens_domain) AS ens_domain,
CASE
WHEN COALESCE(amount_deposited, 0) - COALESCE(amount_withdrew, 0) >= 0 THEN TO_VARIANT(COALESCE(amount_deposited, 0) - COALESCE(amount_withdrew, 0))
ELSE 0
END AS remaining_balance
FROM
Withdrawals w
FULL OUTER JOIN Deposits d ON w.wallet = d.wallet AND w.ens_domain = d.ens_domain
ORDER BY
remaining_balance DESC;

As of Monday, December 18, 2023, at 21:00 UTC, the median user balance of ckETH is 0.03 ckETH.

--

--