Making transactions
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
- Integrate ckETH into your smart contract
To interact with ckETH, some workflows require using a helper smart contract. Important links to these contracts can be found below:
|Ethereum chain |Helper smart contract |Minter dashboard|
|Ethereum Mainnet |0x7574eB42cA208A4f6960ECCAfDF186D627dCC175 |ckETH minter|
|Ethereum Testnet Sepolia |0xb44B5e756A894775FC32EDdf3314Bb1B1944dC34 |ckSepoliaETH 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:
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.
For example, to withdraw 1 ETH:
dfx canister --network ic call ledger icrc2_approve "(record { spender = record { owner = principal \"$(dfx canister id minter --network ic)\" }; amount = 1_000_000_000_000_000_000 })"
Transferring ckETH to another account
Step 1: Navigate to the NNS frontend dapp.
Step 2: Sign in with your existing Internet Identity, or create one by selecting 'More options' > 'Create New'.
Step 3: Select 'ckETH' while on the 'Tokens'.
Step 4: Click on 'Send' at the bottom of the screen.
Step 5: Insert your ckETH address in the 'Destination' field, then enter the amount to send.
Receiving ckETH
Step 1: Navigate to the NNS frontend dapp.
Step 2: From the 'Tokens' page, select the QR code icon next to 'ckETH'.
Step 3: Scan this QR code from a device that you'd like to send ckETH from.
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'.
You can also go directly to Ethereum transactions.
This will display the full history of all ckETH transactions on ICP.
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:
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. Bitcoin does not support such functionality.
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.