Skip to main content

Making transactions

Advanced
Ethereum
Tutorial

Overview

There are several different ways to interact with ckETH:

  • Converting ETH to ckETH
  • Converting ckETH to ETH
  • Receiving ckETH
  • Sending ckETH
  • Viewing ckETH transactions

To interact with ckETH, some workflows require using a helper smart contract. Important links to these contracts can be found below:

Ethereum chainHelper smart contractMinter dashboard
Ethereum Mainnet0x7574eB42cA208A4f6960ECCAfDF186D627dCC175ckETH minter
Ethereum Testnet Sepolia0xb44B5e756A894775FC32EDdf3314Bb1B1944dC34ckSepoliaETH minter

Converting ETH to ckETH

First download the ckETH repo. Then, navigate into the subdirectory for either the mainnet (ic/rs/ethereum/cketh/mainnet) or testnet (ic/rs/ethereum/cketh/testnet).

To convert ETH to ckETH, you will need to make a call to a smart contract on Ethereum and pass in your encoded developer identity principal ID. To encode your developer identity, first get your identity's ID:

dfx identity get-principal

Then, you need to convert this principal into a smart contract argument. You can use the minter dashboard to do this, or you can use Cargo:

cargo run --bin cketh-principal-to-hex $(dfx identity get-principal)

or Bazel:

bazel run //rs/ethereum/cketh/minter:principal_to_hex -- $(dfx identity get-principal)

Call the minter helper contract's deposit function with your principal ID encoded and the amount to convert into ckETH as arguments. Once your transaction has been mined on Ethereum, the corresponding amount of ckETH will be minted after about 20 minutes. You can use dfx to check if your funds have arrived:

dfx canister --network ic call ledger icrc1_balance_of 'record {owner = principal "'"$(dfx identity get-principal)"'" }'

If your encoded principal is incorrect, funds will be lost.

The smart contract addresses are different for the Ethereum mainnet and Sepolia testnet. Refer to the chart above.

Converting ckETH to ETH

First download the ckETH repo. Then, navigate into the subdirectory for either the mainnet(ic/rs/ethereum/cketh/mainnet) or testnet(ic/rs/ethereum/cketh/testnet).

To convert ckETH to ETH, there are two steps. First, you need to approve the minter's principal on the ledger for the desired amount to convert:

dfx canister --network ic call ledger icrc2_approve "(record { spender = record { owner = principal \"$(dfx canister id minter --network ic)\" }; amount = LARGE_AMOUNT_WEI })"

Then make a call to the minter to withdraw ckETH for ETH:

dfx canister --network ic call minter withdraw_eth "(record {amount = SMALL_AMOUNT_WEI; recipient = \"YOUR_ETH_ADDRESS\"})"

This withdraw is done in wei, the smallest denomination of ETH. You can use this converter to convert ETH to wei.

The first step uses LARGE_AMOUNT_WEI while the second step uses SMALL_AMOUNT_WEI. This is because once you approve an amount, which may be large, the second command can be run multiple times with smaller amounts until the entire allowance is used.

For example, to withdraw 1 ETH:

dfx canister --network ic call minter withdraw_eth "(record {amount = 1_000_000_000_000_000_000; recipient = \"DESTINATION_ADDRESS\"})"

Replace DESTINATION_ADDRESS with your Ethereum address, such as recipient = \"0xAB586458E47f3e9D350e476fB7E294a57825A3f4\").

Transferring ckETH to another account

You can transfer ckETH to any wallet that supports ckETH, such as the NNS dapp or Oisy wallet. Directions for the NNS dapp are shown below.

Transferring ckETH
  • Step 2: Sign in with your existing Internet Identity, or create one by selecting 'More options' > 'Create New'.

Transferring ckETH
  • Step 3: Select 'ckETH' while on the 'Tokens'.

Transferring ckETH
  • Step 4: Click on 'Send' at the bottom of the screen.

Transferring ckETH
  • Step 5: Insert your ckETH address in the 'Destination' field, then enter the amount to send.

Transferring ckETH

Receiving ckETH

You can receive ckETH in any wallet that supports ckETH, such as the NNS dapp or Oisy wallet. Directions for the NNS dapp are shown below.

Receiving ckETH
  • Step 2: From the 'Tokens' page, select the QR code icon next to 'ckETH'.

Receiving ckETH
  • Step 3: Scan this QR code from a device that you'd like to send ckETH from.

Receiving ckETH

You can also copy the ckETH address displayed under the QR code and provide this to a friend or third-party (like an exchange) to for them to send you ckETH.

Converting ICP to ckETH/ETH

To convert ICP into ckETH or ETH, a decentralized exchange like ICPSwap must be used. There is no protocol for directly converting one to the other.

Viewing transaction history

To view transaction history for all ckETH transactions on ICP, navigate to the Internet Computer Dashboard, then select the 'Ethereum' dropdown menu in the top left corner, then select 'ckETH transactions'.

ckETH transactions

You can also go directly to Ethereum transactions.

This will display the full history of all ckETH transactions on ICP.

ckETH transactions

You can also search for specific ckETH transactions by address or transaction ID by selecting the 'Search' bar, then selecting 'I am searching for ckETH' and inserting your address/transaction ID:

ckETH transactions

How ckETH transactions differ from ETH transactions

ckETH transactions are quite different from ETH transactions:

  • Speed: ckETH transactions can be completed with 1-2 second finality time, compared to the average ETH time of a few minutes.

  • Cost: ckETH transaction fees are negligible, costing less than a cent.

  • Fixed transaction fees: Transaction fees have a fixed cost, compared to ETH transaction fees that fluctuate based on the size of the transaction and the network's current load.

  • Smart contract integration: Smart contracts can programmatically hold and transfer ckETH, enabling layer-2 applications to develop Bitcoin solutions.

Transaction fees

ckETH transaction fees are set to 0.000002 ckETH.

ETH transaction fees are incurred when converting ETH to ckETH or vice versa. These fees will vary based on the current Ethereum network fee. Learn more about ETH transaction fees.