Skip to content

An erc-20 token with EIP750 style zk private transactions and a new nullifier scheme to allow partial spends

Notifications You must be signed in to change notification settings

jimjimvalkema/scrollZkWormholes

Repository files navigation

An erc20 with EIP7503, partial spends and reusable address

An erc20 token with EIP7503 (zkwormholes) style private transfers, and a new nullifier scheme to enable partial spends and reusable burn addresses.
More info in docs/notes.md

Try it out here: https://scrollzkwormholes.jimjim.dev/

ui

deployment on scroll sepolia

https://sepolia.scrollscan.com/address/0x6A0e54612253d97Fd2c3dbb73BDdBAFfca531A9B

WARNING WORK IN PROGRESS

The code here in barely tested and has 3 inflation bugs.
These are: anyone can call setTrustedStorageRoot and mint.
Also EOA<->zkwormhole address collisions can be created.
More info in docs/notes.md

install

js

yarn install;
yarn install-submodules && yarn install-vite;

Install noir

nargo
https://noir-lang.org/docs/getting_started/quick_start#noir

noirup -v 1.0.0-beta.1;

barretenberg
https://noir-lang.org/docs/getting_started/quick_start#proving-backend

bbup -v 0.66.0

Run ui locally

yarn dev

Build static site locally

yarn build

Deploy

Set environment variables

yarn hardhat vars set PRIVATE_KEY; #<=deployment key
yarn hardhat vars set SEPOLIA_SCROLL_ETHERSCAN_KEY;
yarn compile-contracts;

Deploy contracts

rm -fr ignition/deployments;
yarn hardhat run scripts/deploy.cjs --network scrollSepolia;
cp artifacts/contracts/Token.sol/Token.json website/abis/Token.json;
yarn hardhat ignition deploy ignition/modules/Token.cjs --network scrollSepolia --verify 

you need to manually change the contract address:
ui: website/main.js at line 22
ui: scripts/proofAndRemint.js at line 213

Test

set reminter privatekey

(can be same as deployer)

yarn hardhat vars set RECIPIENT_PRIVATE_KEY;

do remint

yarn hardhat run scripts/proofAndRemint.js 

test circuit

cd circuits/remintProver;
nargo test;
cd circuits/storageRootProver;
nargo test;

Compile circuit (verifier contracts are created in scripts/deploy.cjs)

yarn compile-circuits 

get storage slots layout

forge inspect contracts/Token.sol:Token storage --pretty > contracts/storagelayouts/Token.txt

About

An erc-20 token with EIP750 style zk private transactions and a new nullifier scheme to allow partial spends

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published