
# zkMemory
[chiro@orochi.network](mailto://chiro@orochi.network)
Voluteer at [](https://zkplabs.network)
---
# Agenda
- Whoami?
- Intro to ZKP
- Overview
- Specification
- Growth potential
- Q & A
---
## ~$ whoami
- Founder of Orochi Network
- ZKP
- MPC (threshold signature, ECVRF)
- VRF and VDF
- Cryptography
- Love Open Source. Yes, i love GNU/Linux
- Love Programming. Yes, i love Rust
- Love Cyber Security & Cryptography
---
## Intro to ZKP #1
- Everything is in heavily development
- Hard to catch up with academic side
- Code works or not work magically
- High complexity
- Security is a mist
---
## Intro to ZKP #2

---
## Intro to ZKP #3
Schrödinger's cat but in zkSNARK.

---
## Overview
- Everybody who do zkVM, have to handle the memory themselves
- No one actually try to generalized the memory
- Modular is a thing _(think about everything can be built in lego style)_
---
## Spec #1 What is memory?
- Storage is a memory but it's persist
- Stack is a memory with a pointer
- Registers can be emulated by several memory cells
---
## Spec #2 Why we need to commit the memory?
- Make sure the memory state is consistent
- Prover can not cheat in a private computation
---
## Spec #3 How do we do it?
You might aware that the memory can be constructed as a simple state machine with $2$ instructions `READ` and `WRITE`.
---
## Spec #4 Memory trace
| Address | Time Log | Instruction | Value |
| -------- | -------- | ----------- | -------- |
| 0x..0000 | 1 | `READ` | 0x..0000 |
| 0x..0000 | 2 | `WRITE` | 0x..0a20 |
| 0x..0020 | 3 | `WRITE` | 0x..0010 |
| 0x..0020 | 4 | `READ` | 0x..0010 |
| 0x... | .. | ... | ... |
---
## Spec #5 Memory Cell

---
## Spec #6 Merkle tree proof cost $\mathcal{O}(log_2n)$

---
## Spec #7 KZG Commitment
- $\mathsf{Setup}$: Output $crs=\left(\{[s^i]\}_{i \in \{0,\dots, k-1\}}\right)$.
- $\mathsf{Commit}(f(X),crs)$: Output $[f(s)]_1$.
- $\mathsf{OpenWitness}(f(X),crs,i)$: Output $\pi=(i,f(i),[(f(s)-f(i))/(s-i)])$.
- $\mathsf{VerifyWitness}(crs,C,\pi=(i,y,w_i))$: Check $e(C-[y],[1])=e([s-i],w_i)$.
---
## Spec #8 KZG without verkle tree
Combining KZG with Verkle Tree:
- Construction time: $\mathcal{O}(kn)$.
- [Constant proof size and verfication time](https://dankradfeist.de/ethereum/2021/06/18/pcs-multiproofs.html).
---
## Spec #9 Verkle Tree

---
## Sepc #10 Milestones
- Implement zkMemory as a state machine
- Support Halo2
- Support Nova & SuperNova
- Research folding scheme for vector commiment
---
## Growth potential
What if we combine zkMemory with Nova like proof system?
- ZK File System _(distributed storage + ZKP)_
- ZK Database [$^{1}$](https://github.com/orochi-network/zkDatabase) _(provable data)_
- Support all zkVM projects[$^{2}$](https://zkresear.ch/t/towards-a-nova-based-zk-vm/105)
---
# Thank You for Your Attention
## Q & A
{"metaMigratedAt":"2023-06-17T23:26:36.962Z","metaMigratedFrom":"Content","title":"zkMemory","breaks":true,"contributors":"[{\"id\":\"ec89d97e-db3e-4fb3-b85d-10cdd2a14d2c\",\"add\":2940,\"del\":195},{\"id\":\"71a6d4e1-9182-4f4b-86d2-07ae316ab649\",\"add\":1092,\"del\":612}]"}