GithubHelp home page GithubHelp logo

fhevm-workshop's Introduction

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>

fhevm-workshop's People

Contributors

mortendahl avatar

Stargazers

Vivek Sahu avatar Swayam avatar Kz avatar Brian Stout avatar freshield.eth avatar Aurelia.eth avatar

Watchers

Daniel Demmler avatar Dragoș Rotaru avatar Nikita Frolov avatar lodge avatar Levent DEMIR avatar  avatar  avatar

Forkers

sbellem

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.