# ZKTF: Aztec & RISC Zero
## Aztec
### Intro
Chronology:
- Aztec 1: basic private transfers; deprecated
- Aztec Connect: zk-rollup, smart contracts; deprecated
- Aztec (Aztec 3, A3): Noir lang + encrypted L2 zk-rollup
Refs:
- [Overview](https://docs.aztec.network/aztec/overview)
- [Medium article](https://medium.com/aztec-protocol/aztec-the-hybrid-zkrollup-a90a197bf22e)
- [Docs](https://docs.aztec.network/aztec/how-it-works/private-public-execution#)
- [Noir lang](https://aztec.network/noir/)
- [Medium Noir](https://medium.com/aztec-protocol/introducing-noir-the-universal-language-of-zero-knowledge-ff43f38d86d9)
- [Awesome Noir](https://github.com/noir-lang/awesome-noir)
### Noir
Features:
- rust-like language for provable smart contracts
- tools (nargo), standard lib, circuit debug
- compile noir code to ACIR -- abstract circuit intermediate representation
- prove ACIR with any backend (PLONK, Groth16, Marlin, Barretenberg)
- `Field` data type, `private` data, `pub` modifier; `mut`, `comptime`, globals
Commands:
- `noirup` -- install noir/nargo
- `nargo compile` -- compile code into ACIR
- `nargo execute` -- run code
- `nargo prove` -- prove code for given inputs
- `nargo verify` -- verify proof
- `nargo codegen-verifier` -- generate solidity verifier contract
### Encrypted zk-rollup
- Encrypted zk-rollup: public account-based blockchain + UTXO-based privacy solution
- Composable smart contracts: any secret/public function can call any other function. Private and public functions operate on different stacks.
- Privacy: user, data, code
- Encrypted private user data is stored in append-only UTXO-like store with deletions encoded as nullifiers. UTXO is abstracted with Noir.
- User generates a proof of correct execution of a transaction (kernel proof). To allow concurrent access to data by different users there's historical data access (as long as data wasn't nullified). Private-public function calls.
- L1-L2 components:
- portal -- part of L1 app + hard link to L2 address,
- message box -- messaging between L1-L2
- rollup contract -- L2 rollup state root, state transition verification, data availability
- kernel circuit -- handles L1-L2 messages delivery
- rollup circuit -- state transition for a rollup block
- messages -- L1-L2 pieces of data
## RISC Zero
### Bonsai
Refs:
- [Book](https://dev.bonsai.xyz/litepaper/)
- [Blog](https://www.risczero.com/blog/ethdenver)
- [Repo](https://github.com/risc0/bonsai-starter-template)
Features:
- guest method
- solidity smart contract wrappers: not clear how proof is verified in smart contract
- deploy: submit guest method to Bonsai service for proving
- poke: interact with a smart contract
Hidden features:
- Bonsai proving service: prover-as-a-service
- verifier (SNARK?)
### POSIX I/O
- [rand](https://github.com/risc0/risc0/blob/84528d31c0efad566e585aa04a83d6692b32bd16/risc0/zkvm/platform/src/syscall.rs#L319)
- [sys_read](https://github.com/risc0/risc0/blob/84528d31c0efad566e585aa04a83d6692b32bd16/risc0/zkvm/platform/src/syscall.rs#L349)
- [stdin](https://github.com/risc0/risc0/blob/84528d31c0efad566e585aa04a83d6692b32bd16/risc0/zkvm/src/exec/env.rs#L168)