Created by: coldstar1993 Created time: June 2, 2024 1:51 PM Tags: Mina, zkApp
This tutorial will lead you step by step to go into Mina network and ZkApp Development. The video tutorials cover 4 series:
-
Starter Series(入门系列): basic knowledge for new joiners to learn about Mina & zkApp
-
Advanced Series(进阶系列): step deeper into zkApp development
-
Practices Series(实践系列): share more good practices during zkApp development
-
Framework Series(框架系列): share frameworks to accelerate zkApp development
<Video1> Learn about Zero Knowledge Proof
-
start from "Ali and the Cave" story
-
Color-Blind experiment
-
Intro on general zk proof systems
- what’s arithmetic circuits
- zkSnark/zkStark/Halo/BulletProofs
- cooresponding blockchains, like
- Zcash/Ironfish/Loopring on Groth16_zksnark
- Mina/Aztec/zkSync/Anoma on Plonk_zksnark
- Aleo on Halo
- StarkNet/Polygon on STARK
- Grin on BulletProofs
-
Intro on zkSNARK family members & their features
-
Intro on Plonk
- recursion zkSnark
- general-purpose zkp
- simplified trusted setup
- small proof size
- …
<Video2> What & Why & How of Mina chain https://x.com/SoorajKSaju/status/1798328297874419925
-
Scalability&Privacy issue of current blockchain industry
-
Why&How Mina solves these issue
- Data Compression: Recursive zkp & Succinct(22kb)
- Computation compression: offchain execution & onchain verification
- Ouroboros Samasika POS Consensus
- Programmable Privacy
-
How to be ‘The Universal ZK Layer for Web3’
- zkApps Smart Contracts based on O1js
- What’s Httpz & #ProofOfEverything
- Future expectations - How to interoperate with other blockchains(eth/evm chains,etc.)
- …
<Video3> First Look at Mina
-
installation & usage of Auro wallet
-
chain explorers & other community resources
-
delegate MINA and receive staking rewards
-
high-level intro on main components of Mina network
- daemon nodes & archive nodes & snark workers
- how these roles cooperate together
- lifecycle of a Payment
- …
<Video4> Intro on Mina Ecology & Community
-
intro on o1js DSL
- background of O1Labs & MF & Mina Protocol
- kimchi-pickles proof system from Plonk
- comparison to Circom+Snarkjs & Leo & Noir
- go into o1js repo structure
-
resources & activities for community builders
- Wechat & discord & tw & tg
- O1lab-blog / MIPs / MF-blog
- Navigator Programs & zkIgnite Cohort & Core Grants
- …
<Video5> Go deeper into o1js
-
what’s arithmetic circuits
- common flows: compile -> witness calc -> proof-gen -> verify
- Prover Functions & Verification Keys
- Trusted Setup & why no need in o1js
-
Basic Concepts
- Data types & Utils
- Primitive types & Custom data types**(Struct)**
- reason on why cannot use js data type within a circuit
- Poseidon.hash & Signature & Encryption & PrivateKey & PublicKey…
- Conditionals
- Provable
- !!! Traditional conditional statements VS conditional statements within Circuit
- Functions
-
ZkProgram Overview
- talk about Recursion
- design a simple zkProgram
- What’s happenning under zkProgram.compile()
- Data types & Utils
<Video5> First Look at zkApps
-
comparison to Solidity-contract
- design two simple contracts with same functions in solidity & o1js and compare them
- !!! thinking pattern of Onchain-Exec-Pattern & Offchain-Exec-Pattern
- other differences like gas&fee, onchain storage, etc.
-
how zkApp works
- prover & verifier
- private/public inputs & onchain states of a contract
- onchain states & offchain states
- ** !!! ** smart contract is the composition of zkProgram(pure ciruit) + precondition + onchain states
- what are the underlying public-inputs and private-inputs?
- how precondition works based on onchain states?
proofAuth
atAccountUpdate
is the result from zkProgram(pure ciruit)
<Video6> ZkApps Getting Started I
- Install or update the zkApp CLI
- Create a project
- Add testing code
- Add functionality
<Video7> ZkApps Getting Started II
-
Create an Unit test
-
What’s LocalBlockchain
- test accounts
- proofEnabled: true/false
-
Test locally
<Video8> ZkApps Getting Started III
-
What’s Lightnet
-
Setup Lightnet
-
Test with Lightnet
<Video9> ZkApps Getting Started IV
-
DevNet & Faucet & MinaScan Explorer
-
Test with a live network
<Video10> ZkApps Getting Started V
-
Write a sample zkApp UI by Vite+Vue3
-
Enabling COOP and COEP headers
-
Connecting your zkApp with a user's wallet
<Video11> Write a Smart Contract by hand
-
Intro on base class: SmartContract
-
Regular account & zkApp account
-
On-chain state & Reading state & Assertions & Debugging
-
Public and private inputs
-
design a simple sample contract
- What’s happenning under contrat.compile()
- What the @method decorator do
- What’s happenning under contrat.compile()
-
deploy to Devnet & trigger a @method
- tx.prove()/sign()/send()/wait()
<Video12> Inspect a Transaction
-
transaction strutures
- { feePayer, accountUpdates: [...], memo }
- MIP: https://github.com/MinaProtocol/MIPs/blob/main/MIPS/mip-0004-zkapps.md
-
AccoutUpdates & Account update tree structures
- structure:
- publicKey & tokenId
- states updates & balance changes
- preconditions & Auth
- Account update tree & Forest
- pre-order traversal
- Visualize the AccountUpdates
- structure:
-
What’s happenning under tx.prove/sign()
<Video13> On-Chain Values
-
onchain states
-
Precondition - Network/Account
-
Setting account fields
-
Accessing accounts other than the zkApp's account
<Video14> Permissions
-
Types of Permissions & Types of Authorization
-
default-permissions
-
upgradeability-of-smart-contracts
- why we need TransactionVersion
- example-impossible-to-upgrade
- example-upgradeable-with-a-proof
-
design a sample contract
<Video15> Events
-
intro about Archive Nodes & archive graph endpoint
-
design event and try getEvents&fetchEvents
-
design a sample contract
<Video16> Actions & Reducer
-
What&Why of Action(SequencedEvent) and related #issue #pr example reference: https://zknoid.medium.com/mina-action-reducers-guide-why-we-need-them-81b6836c1700
-
Mechenism of 5 onchain ActionState
-
this.reducer.reduce() & Actions.updateSequenceState()
-
how Actions works for concurrent state updates (simple rollup)
-
design actions and try getActions&fetchActions
-
design a sample contract
-
best practices to fetchActions
<Video17> Time-Locked Accounts
-
vesting mechenism
-
design a sample contract
<Video18> Custom Tokens
-
ProofAuth & SignatureAuth
-
Design a sample for ProofAuth
-
Inspect into TokenContract source code & basic usage
<Video18.5> review and deploy Mina Fungile Token Standard
- repo: https://github.com/coldstar1993/mina-fungible-token/blob/main/FungibleToken.ts
- MIP: https://github.com/o1-labs/rfcs/blob/main/0014-fungible-token-standard.md
<Video19> Off-Chain Storage
-
talk about Merkle Tree family
- Basic features & membership witness & non-membership witness
- AppendOnly Merkle Tree & Sparse Merkle Tree & Updatable Merkle Tree
- Merkle Mountain Range
-
inspect classes : MerkleTree&MerkleWitness, MerkleMap&MerkleMapWitness
-
classes: OffchainState & OffchainStateCommitments…
-
Intro about o1js-merkle & design usage samples
<Video20> Cached Proving Key
-
talk about: #pr1187: caching prover and verifier keys in Node.js
-
reduce circuit compiling time cost → improve performances
<Video21> Side-Loaded VK
-
what’s Generic Recursive Proving Primitives
-
talk about: #RFC-0002 & #pr1606
-
Dynamic Proof to reduce circuit dependencies&memory resources cost → improve performances
<Video22> Gadgets
-
bitwise-operations samples & usage
-
foreign-fields samples & usage
<Video23> ECDSA & SHA-256
-
ECDSA & Schnorr
-
SHA256 & Poseidon
-
how to verify Bitcoin block headers using zero-knowledge proofs with o1js
<Video24> Some good Practices for zkApp
-
about fetchActions & fetchEvents
-
about how to merge actions by hand within zkProgram rather than reducer
-
about tx.send&wait
-
about interoperate with auro wallet on UI
-
about contract permissions design
-
about token contract & token account usage
-
about how to store more data onchain: packing&store
-
about dynamic import o1js to improve ui loading
-
about nodejs params config
-
about debug circuits
-
about inspect/analyse failed tx
-
…TODO…
<Video25> Security issue during zkApp contracts
-
normal design flaws
-
…TODO…
<Video26> Setup Daemon node & Archive Nodes for your zkApps
-
Redundancy & keep nodes stable
-
Monitoring
-
Archive Tooling
<Video27> Protocol development framework
-
Application specific rollups & General-Purpose rollups
-
Protocol Arch
- Runtime
- Protocol
- Sequencer
-
…TODO…
<Video28> Zeko
- …TODO…
<Video29> Integrate DA Layer -- Celestia
- what's DA & Modular?
- working mechenism of Celestia
- DA issue of zkApp(Appchain)
- how your zkApp integrate with Celestia?
<Video30> Integrate With Aligned Layer