Here's a detailed README.md file for the project that outlines the steps, functionality, and how to run the DApp:
This project demonstrates how to deposit Ethereum (ETH) from the Ethereum blockchain to the Internet Computer Protocol (ICP) using ckETH. It also includes a simple React-based frontend that allows users to deposit and withdraw ETH between Ethereum and ICP.
- Overview
- Prerequisites
- Project Structure
- Setup and Installation
- Running the Project
- Using the DApp
- Connecting to Mainnet
- Contributing
- License
This DApp allows users to:
- Deposit ETH from Ethereum into the ICP ecosystem as ckETH
- Withdraw ckETH from ICP back to Ethereum
The ckETH
canister acts as a bridge between Ethereum and ICP, enabling interoperability between the two blockchains.
Before running the project, ensure you have the following installed:
- Node.js: Install Node.js
- DFX SDK: Install DFX
- MetaMask Wallet: For interacting with Ethereum
- An Ethereum Wallet: With some test ETH (for the testnet)
eth_to_icp_cketh/ │ ├── cketh_dapp/ # ICP Project containing ckETH canister code │ ├── src/ │ ├── dfx.json # DFX configuration │ ├── README.md │ └── ... │ ├── eth-icp-dapp/ # React Frontend Project │ ├── src/ │ │ ├── components/ │ │ │ ├── Deposit.js # Deposit Component │ │ │ └── Withdraw.js # Withdraw Component │ │ ├── App.js # Main React App │ │ └── ... │ ├── package.json │ └── ... └── README.md # This README file
- Clone this repository:
git clone https://github.com/username/eth-icp-dapp cd eth_to_icp_cketh/cketh_dapp
- Install DFX SDK and start the ICP local environment:
dfx start --background
- Deploy ckETH Canister:
dfx deploy
-
Setting Up the Frontend
-
Navigate to the frontend project:
cd ../eth-icp-dapp
- Install dependencies:
npm install
Running the Project
- Running the ICP Canisters
Make sure your local ICP environment is running:
cd cketh_dapp dfx start --background dfx deploy
- Running the React Frontend
In a separate terminal, start the React application:
cd eth-icp-dapp npm start
The application should be available at http://localhost:3000.
Using the DApp
- Deposit ETH to ICP
Connect your MetaMask wallet.
Enter the amount of ETH to deposit.
Click on the Deposit button.
- Withdraw ETH from ICP
Enter the amount of ckETH to withdraw.
Click on the Withdraw button.
Note: Make sure your wallet has enough ETH for gas fees when using the Ethereum network.
Connecting to Mainnet
-
Update your dfx.json file with mainnet configurations.
-
Update the ckethCanisterAddress in App.js with the deployed canister address on the mainnet.
To deploy to the mainnet, run: