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.
To illustrate running of .test.ts
and .run.ts
files
🎥 https://youtu.be/_iXCUi2q5-8
use node version 18
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
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
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
frompublicKey
(in bytes) is equal to the ethereumaddress
- verify
publicKey
(in ForeignCurve) andsignature
- check
publicKey
(in bytes) vspublicKey
(in ForeignCurve)
npm install
npm run build
node build/src/ownership-membership.run.js
More details on BIP340 support is documented in this BIP340.README.md
The main file to refere is src/bip340Verify.ts
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
check out .test.ts
files
🎥 running .test.ts
files: : https://youtu.be/_iXCUi2q5-8
npm install
npm run build
npm run test
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