This project implements a zk-Rollup-based Layer 2 scaling solution for Ethereum. It includes the following components:
-
Install Dependencies:
- Clone this repository to your local machine:
git clone https://github.com/eversoluna/altlayer-zk-rollup.git cd altlayer-zk-rollup
- Clone this repository to your local machine:
-
Install Frontend Dependencies:
- Navigate to the
frontenddirectory and install the required npm packages:cd frontend npm install
- Navigate to the
-
Install Backend (Smart Contracts) Dependencies:
- Navigate to the project root directory and install Hardhat dependencies:
cd .. npm install
- Navigate to the project root directory and install Hardhat dependencies:
-
Set up Environment Variables:
- Create a
.envfile in the root directory and add your Infura project ID and Private Key for deployment:INFURA_PROJECT_ID=your_infura_project_id PRIVATE_KEY=your_wallet_private_key
- Create a
-
Set up MetaMask:
- Make sure MetaMask is installed in your browser, and connect it to an Ethereum testnet (e.g., Rinkeby or Goerli).
-
Deploy Smart Contracts to Ethereum:
- Run the following command to deploy the smart contracts (Rollup, Verifier, and Bridge) to Ethereum testnet or Mainnet:
npx hardhat run scripts/deploy.js --network rinkeby
- You can change
rinkebyto any other supported network (e.g.,goerliormainnet).
- Run the following command to deploy the smart contracts (Rollup, Verifier, and Bridge) to Ethereum testnet or Mainnet:
-
Deploy zk-Proof Verifier:
- Make sure to deploy the Verifier contract on Ethereum first before deploying the Rollup contract. The Rollup contract requires the address of the Verifier contract during deployment.
-
Start the Frontend:
- After deploying the contracts, navigate to the
frontenddirectory and run the React app:cd frontend npm start - Open your browser and visit
http://localhost:3000.
- After deploying the contracts, navigate to the
-
Interacting with zk-Rollup:
- Connect to the application using MetaMask.
- Deposit funds into the zk-Rollup contract by clicking the "Deposit" button.
- Withdraw funds back to Ethereum by clicking the "Withdraw" button.
- Generate Proof:
- Navigate to the
zkproofdirectory and generate the proof for a transaction:node generateProof.js
- This will generate a proof (e.g.,
proof.json) that can be submitted to the Rollup contract.
- Navigate to the
- Unit Tests for Smart Contracts:
- Run Hardhat tests to check the functionality of smart contracts:
npx hardhat test
- Run Hardhat tests to check the functionality of smart contracts:
- Fork this repository and clone it to your local machine.
- Create a new branch for your feature or bug fix.
- Submit a pull request to merge changes into the main repository.