Skip to content

Latest commit

 

History

History

lab

Mina-anons: 🔬 LAB

Lab is a playground where small legos for BIG ideas are built and tested.

This development process is to make iterative and followable progress while exploring the less explored territory of Mina x Ethereum and Mina x Bitcoin as inspired by Mina's ECDSA support.

These smaller legos will then be utilized later to create full-stack ZkApps.

Demo video

To illustrate running of .test.ts and .run.ts files 🎥 https://youtu.be/_iXCUi2q5-8

Below are a few experiements

use node version 18

Proof of ownership by verifying signature

very first simple program to verify signature verifySignedHash is used instead to abstract out quirks with message prefix

npm install
npm run build
node build/src/ownership.run.js

Proof of membership

as part of Mina-anons, users need to anonymously prove membership of certain groups

MerkleTree with persistence (levelDB) is utilized (ref: https://github.com/plus3-labs/o1js-merkle)

db folder contains levelDB files for persistence, Merkle Tree is loaded from the existing DB if it is there already otherwise, a fresh DB is initiated

npm install
npm run build
node build/src/membership.run.js

Proof of ownership + membership

To prove anonymously that a user not only own an ethereum address but also the address is a member of a list of addresses

Ethereum address is not the publicKey but is the last 20 characters of Keccak hash of the publicKey

publicKey can be derived only from the privateKey or from the signature

Mina ECDSA support verifies only signature with publicKey it is needed more to check that address can indeed be derived from pulicKey

following checks are done

  • ethereum address is a member
  • derived address from publicKey (in bytes) is equal to the ethereum address
  • verify publicKey (in ForeignCurve) and signature
  • check publicKey (in bytes) vs publicKey (in ForeignCurve)
npm install
npm run build
node build/src/ownership-membership.run.js

BIP340 Schorr support

More details on BIP340 support is documented in this BIP340.README.md

The main file to refere is src/bip340Verify.ts

vote proof for Snapshot.org

More details on integration with Snapshot.org is documented in this anon-snapshot/README.md

Please refer to current implementation part

In essence, slip_id a unique identifier to mask a voter address is issued by the oracle and it is used in proof to do vote by proxy ingested by Snapshot.org

Run tests

check out .test.ts files

🎥 running .test.ts files: : https://youtu.be/_iXCUi2q5-8

npm install
npm run build
npm run test

Run .run.ts files

check out .run.ts files especially for BIP340 cases.

🎥 running .run.ts files: https://youtu.be/E9_M-hKh_2o

.run.ts files are basically tests. .test.ts files will be added shortly.

npm install
npm run build

node build/src/bip340Verify.run.js
node build/src/ownership.bip340.run.js
node build/src/membership.bip340.run.js
node build/src/ownership-membership.bip340.run.js
node build/src/snapshotVoteProof.run.js

References and tools

License

Apache-2.0