GitXplorerGitXplorer
z

fhevm-workshop

public
7 stars
1 forks
0 issues

Commits

List of commits on branch main.
Verified
1c44e3c7d5e2702ee79175b62e801055392684df

Merge pull request #2 from zama-ai/more-renaming

mmortendahl committed 8 months ago
Unverified
aa978cf6c3d2ca799cb8862f2dda317aa9b8921e

fix: change env var name

mmortendahl committed 8 months ago
Verified
89ee3a7a0590c23cef7cf22dc6e6d07c2562cd1d

Merge pull request #1 from zama-ai/bring-up-to-date

mmortendahl committed 8 months ago
Unverified
b275a5db066cbc75799732b2386e37e2789aac3f

feat: reverting transfer

mmortendahl committed 8 months ago
Unverified
68ec20ff6ff6739754395aad7b2fb579f5bf562d

Update package-lock.json

mmortendahl committed 8 months ago
Unverified
33fe266c0d02da3959399a1e1873acf6cedce78c

fix: update to new fhevmjs and fhEVM

mmortendahl committed 8 months ago

README

The README file for this repository.

fhEVM Workshop

Welcome to this workshop on building an encrypted ERC20 token!

See more of our examples at https://dapps.zama.ai.

Getting started

Install Zama Devnet in MetaMask:

Encrypted ERC20

Set env variable WORKSHOP_PRIVATE_KEY to private key that was used to deploy the contract (as copied from MetaMask, i.e. without 0x prefix):

export WORKSHOP_PRIVATE_KEY=<private key>

When a contract have been deployed to the devnet, the Python files can be used to interact with it by set env variable CONTRACT to the address (as copied from Remix) and saving the ABI to abi.json.

Nodejs with fhevmjs

Go in fhevmjs directory and npm install. Be sure you set WORKSHOP_PRIVATE_KEY and CONTRACT

Mint new tokens:

CONTRACT=<address> npm run mint 100

Get your current balance:

CONTRACT=<address> npm run balanceOf

Make a transfer:

CONTRACT=<address> npm run transfer 0x56c836D1d7c9f64b9654B433dCa16f1014429DC5 100

Python

Use Python3.10 or earlier:

python3.10 -m venv venv
. ./venv/bin/activate
pip install -r requirements.txt

For now we also need to installed the fhEVM cli:

git clone https://github.com/zama-ai/fhevm-tfhe-cli
cd fhevm-tfhe-cli
cargo install --path .

Mint new tokens:

python mint.py --amount 100 --contract <address>

Get your current balance:

python get_balance.py --contract <address>

Make a transfer:

python transfer.py --amount 5 --to <address> --contract <address>