使用 Github Codespace完成Zama-Level 3 - Builder任务
在目前这个Github页面,点击右上角Code,然后选择Codespace,点击< + >,创建一个新的终端,进入等待加载完成,运行下面的命令
1.安装依赖项:
# 更新系统
sudo apt update && sudo apt upgrade -y
sudo apt install screen curl iptables build-essential git wget lz4 jq make gcc nano automake autoconf tmux htop nvme-cli libgbm1 pkg-config libssl-dev libleveldb-dev tar clang bsdmainutils ncdu unzip libleveldb-dev -y
# 安装 Nodejs, npm, yarn
sudo apt update
sudo curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash -
sudo apt install -y nodejs
node -v
npm install -g yarn
yarn -v
# 安装 Hardhat
sudo npm install -g hardhat
2.部署 FHECounter 合约:
git clone https://github.com/zama-ai/fhevm-hardhat-template
cd fhevm-hardhat-template
3.安装:
npm install
4.替换 hardhat.config.ts 文件:
curl -o hardhat.config.ts https://raw.githubusercontent.com/0xmoei/zama-fhe/refs/heads/main/hardhat.config.ts
5.设置 Sepolia RPC:
npx hardhat vars set SEPOLIA_RPC_URL
6.会提示你输入一个 Sepolia RPC,使用下面官方的:
https://ethereum-sepolia-rpc.publicnode.com
7.设置私钥----提示您输入私钥,输入时不要加 0x 前缀:
npx hardhat vars set PRIVATE_KEY
8.编译并部署:
# 编辑
npx hardhat compile
# 部署
npx hardhat deploy --network sepolia
9.最后会出现你的部署合约地址0x开头的,到公会Level 3 - Builder提交填表,返回就会刷新