Understanding ZK Proof (with Polygon zkEVM)

Understanding ZK Proof (with Polygon zkEVM)

Created time
May 16, 2025 06:41 AM
Category
Web3
Last updated time
May 17, 2025 04:57 PM
๐Ÿ‡ฐ๐Ÿ‡ทย Korean
๐Ÿ’ก
Youtube์—์„œ ์ฐพ์€ ์˜์ง€์‹ ์ฆ๋ช…์„ ์œ„ํ•œ ์ข‹์€ ๋™์˜์ƒ์„ ์†Œ๊ฐœํ•˜๊ณ , ํ•ด๋‹น ๊ฐœ๋…์ด ๋ธ”๋ก์ฒด์ธ ๋‚ด์—์„œ ์–ด๋–ป๊ฒŒ ์ ์šฉ๋˜๋Š”์ง€ ์†Œ๊ฐœํ•ด๋ดค์–ด์š”.

์˜์ง€์‹ ์ฆ๋ช…์ด ๋ญ˜๊นŒ?

Video preview
ย 
ํ•ด๋‹น ๋™์˜์ƒ์„ ๋ณธ๋‹ค๋ฉด, ์˜์ง€์‹ ์ฆ๋ช…์— ๋Œ€ํ•ด์„œ ์ดํ•ดํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค!
๋™์˜์ƒ์„ ๋ณด๊ธฐ ํž˜๋“œ์‹  ๋ถ„๋“ค์„ ์œ„ํ•ด, ํ…์ŠคํŠธ๋กœ ์š”์•ฝํ•˜์ž๋ฉด ๋‹ค์Œ๊ณผ ๊ฐ™์Šต๋‹ˆ๋‹ค.
ย 
โ€œ4๊ฐ€์ง€ ์ƒ‰์„ ๊ฐ–๊ณ , ๋ฏธ๊ตญ์˜ ๋ชจ๋“  ์ฃผ๋“ค์ด ๊ตญ๊ฒฝ์ด ๋งž๋‹ฟ์„ ๋•Œ, ์„œ๋กœ ๋‹ค๋ฅธ ์ƒ‰์ƒ์„ ๊ฐ–๋„๋ก ๋ชจ๋‘ ์ƒ‰์น  ํ•˜๊ธฐโ€ ๋ผ๋Š” ๋ฌธ์ œ๊ฐ€ ์žˆ์Šต๋‹ˆ๋‹ค. Alice๊ฐ€ ๋ˆ์„ ๊ฑด ๋ฌธ์ œ์ด๊ณ , Bob์ด ์ด๋ฅผ ํ•ด๊ฒฐํ•  ์ •๋‹ต์„ ๋“ค๊ณ  ์™”์Šต๋‹ˆ๋‹ค. ํ•˜์ง€๋งŒ, ์—ฌ๊ธฐ์„œ ๋‘ ์‚ฌ๋žŒ์€ ์ด๋Ÿฐ ๊ณ ๋ฏผ์„ ํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค.
ย 
  1. Bob์€ ๋ˆ์„ ๋ฐ›๊ณ  ์ •๋‹ต์„ ๋„˜๊ฒจ์ฃผ๊ณ  ์‹ถ์Šต๋‹ˆ๋‹ค.
  1. Alice๋Š” ์ •๋‹ต์ด ์ •ํ™•ํ•œ์ง€ ์•Œ๊ณ  ๋ˆ์„ ์ฃผ๊ณ  ์‹ถ์Šต๋‹ˆ๋‹ค.
ย 
์–ด๋–ป๊ฒŒ ํ•˜๋ฉด, Bob๊ณผ Alice ๋ชจ๋‘ ๋งŒ์กฑํ•˜๋Š” ๋ฐฉํ–ฅ์œผ๋กœ ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ•  ์ˆ˜ ์žˆ์„๊นŒ์š”?
์˜์ง€์‹ ์ฆ๋ช…์„ ํ™œ์šฉํ•œ๋‹ค๋ฉด, ์ด ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐ ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค.
์ด๋ฅผ ๋ฐ˜์˜ํ•˜๊ธฐ ์œ„ํ•ด์„œ, Bob์€ ๋‹ค์Œ๊ณผ ๊ฐ™์€ ๋ฐฉ์‹์œผ๋กœ Alice์—๊ฒŒ ๋ชจ๋‘ ๋‹ค๋ฅธ ์ƒ‰์œผ๋กœ ์ง€๋„๋ฅผ ์ƒ‰์น ํ–ˆ๋Š”์ง€ ์ฆ๋ช…ํ•ฉ๋‹ˆ๋‹ค.
โ€œAlice๊ฐ€ ๊ณ ๋ฅธ ๋งก ๋‹ฟ์€ 2๊ฐ€์ง€ ์ฃผ์˜ ์ƒ‰์ƒ์„ ๋ณด์—ฌ์ฃผ๊ธฐโ€
Alice๊ฐ€ ๋งŒ์ผ 2๊ฐ€์ง€ ์ƒ‰์ƒ์„ ๊ณจ๋ž๊ณ , Bob์˜ ์ •๋‹ต์ด ์ •ํ™•ํ•˜๋‹ค๋ฉด, ๋‘ ์ƒ‰๊น”์€ ๋‹ค๋ฅผ๊ฒ๋‹ˆ๋‹ค.
ํ•ด๋‹น ๊ณผ์ •์ด ๋งŒ์ผ 100๋ฒˆ ์ •๋„ ์ง„ํ–‰๋˜์—ˆ๋‹ค๋ฉด, Alice๋Š” Bob์˜ ์ •๋‹ต์„ ํ™•์‹  ํ›„ ๋ˆ์„ ์ฃผ๊ณ , Bob์€ ๋ˆ์„ ๋ฐ›๊ณ  ์ •๋‹ต์„ ๋„˜๊ธธ ์ˆ˜ ์žˆ์„ ๊ฒƒ์ž…๋‹ˆ๋‹ค.
ย 

์–ด๋–ป๊ฒŒ ZK Rollup Chain์— ์˜์ง€์ฆ๋ช…์„ ๋ฐ˜์˜ํ• ๊นŒ?

์ด์ œ, ๊ฐ„๋‹จํ•œ ์˜์ง€์ฆ๋ช…์˜ ๊ฐœ๋…์—์„œ ํ™•์žฅํ•˜์—ฌ ZK Rollup Chain์— ํ™œ์šฉ๊นŒ์ง€ ํ™•์žฅํ•ด๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค.
๋จผ์ € ์œ„์—์„œ ๊ฐ„๋‹จํ•œ ๋น„์œ ๋ฅผ ํ†ตํ•ด ๊ธฐ๋ณธ์ ์ธ ๋ฉ”์ปค๋‹ˆ์ฆ˜์„ ํ™•์ธํ•ด๋ณด์•˜๋‹ค๋ฉด, ์˜์ง€์ฆ๋ช…์—๋Š” ์ด๋ก ์ ์œผ๋กœ ์–ด๋– ํ•œ ๊ตฌ์„ฑ์š”์†Œ๊ฐ€ ์žˆ๋Š”์ง€ ์‚ดํŽด ๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค.
ย 
  1. Statement : ๋ชจ๋‘์—๊ฒŒ ๊ณต๊ฐœ๋œ ์ฆ๋ช… ์ •๋ณด, โ€œ๋ชจ๋“  ์ฃผ๊ฐ€ ๊ฒน์น˜์ง€ ์•Š๋„๋ก 4๊ฐ€์ง€ ์ƒ‰์œผ๋กœ ์ƒ‰์น ํ•˜๊ธฐโ€
  1. Verifier : Alice, ์ •๋ณด๋ฅผ ๊ฒ€์ฆํ•  ์‚ฌ๋žŒ
  1. Prover : Bob, ์ž์‹ ์ด ๊ฐ€์ง„ ์ •๋ณด๋ฅผ ๊ณต๊ฐœํ•˜์ง€ ์•Š๊ณ , ์ •๋ณด๋ฅผ ์ฆ๋ช…ํ•˜๊ณ  ์‹ถ์€ ์‚ฌ๋žŒ
  1. Secret : ์ƒ‰์น ์ด ์น ํ•ด์ง„ ์ง€๋„, ๋ชจ๋‘์—๊ฒŒ ์ˆจ๊ธฐ์ง€๋งŒ, Prover๊ฐ€ ์ฆ๋ช…ํ•  ์ •๋ณด
  1. Challenge : 2๊ฐ€์ง€ ์ฃผ๋ฅผ ์„ ํƒํ•˜๋Š” ๊ณผ์ •, Verifier๊ฐ€ Prover์—๊ฒŒ Secret์„ ๊ฒ€์ฆํ•˜๋Š” ๊ณผ์ •
  1. Statement is true : Verifier๊ฐ€ Prover๊ฐ€ Secret์„ ๊ฐ–๊ณ  ์žˆ์Œ์„ ํ™•์ธํ•œ ์ƒํƒœ
ย 
์œ„ ๊ฐœ๋…๋“ค์ด, ์ฝ”๋“œ์™€ ์—ฌ๋Ÿฌ๊ฐ€์ง€ ์ธํ”„๋ผ๋ฅผ ํ†ตํ•ด์„œ zkEVM์—์„œ ๋ฐ˜์˜๋˜๊ฒŒ ๋ฉ๋‹ˆ๋‹ค.
ํ•˜์ง€๋งŒ, ๋ธ”๋ก์ฒด์ธ ๋„คํŠธ์›Œํฌ์—์„  Bob๊ณผ Alice์ฒ˜๋Ÿผ ์ƒํ˜ธ์ž‘์šฉํ•˜๋ฉฐ, ์˜์ง€ ์ฆ๋ช…์„ ์ด๋ฃจ์ง€๋Š” ์•Š์Šต๋‹ˆ๋‹ค. ๋”ฐ๋ผ์„œ, ์–ด๋–ป๊ฒŒ ๋ธ”๋ก์ฒด์ธ์—์„œ ์˜์ง€์ฆ๋ช… ๊ฐœ๋…์„ ๋ฐ˜์˜ํ•˜์˜€๋Š”์ง€, Polygon์˜ zkEVM์„ ์‚ดํŽด๋ณด๋ฉฐ ์ดํ•ดํ•ด๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค.
ย 
์ผ๋ฐ˜์ ์œผ๋กœ ๋ธ”๋ก์ฒด์ธ ๋‚ด ์˜์ง€์ฆ๋ช…์€ Non-Interactive Zero-Knowledge Proof System์ž…๋‹ˆ๋‹ค.
๋”ฐ๋ผ์„œ, zk-SNARKs ๋ผ๋Š” ์•”ํ˜ธํ™” ์ฒด๊ณ„๋ฅผ ๋”ฐ๋ฅด๊ฒŒ ๋ฉ๋‹ˆ๋‹ค. ํ•ด๋‹น ์ฒด๊ณ„์˜ ํŠน์„ฑ์€ ๋‹ค์Œ๊ณผ ๊ฐ™์Šต๋‹ˆ๋‹ค.
ย 

SNARK์˜ ํŠน์ง•

  1. Succinct : ์ฆ๋ช…์˜ ํฌ๊ธฐ๊ฐ€ ์ž‘๊ณ , ์‹ ์†ํ•˜๊ฒŒ ํ™•์ธํ•  ์ˆ˜ ์žˆ๋‹ค.
  1. Non-interactive : ์ƒํ˜ธ์ž‘์šฉ์ด ํ•„์š”์—†๋‹ค.
  1. Argument of Knowledge : Secret์„ ์‹ค์ œ๋กœ ์•Œ๊ณ  ์žˆ๋‹ค๋Š” ์‚ฌ์‹ค์„ ์ฆ๋ช…
ย 

Polygon zkEVM์—์„œ zk-SNARKS๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๋ฐฉ์‹

ZK Rollup ๋ฐฉ์‹์€ Optimistic Rollup ๋ฐฉ์‹๊ณผ ๋‹ค๋ฅด๊ฒŒ ๋ชจ๋“  ํŠธ๋žœ์žญ์…˜์„ L1 ๋ ˆ์ด์–ด๋กœ ์˜ฌ๋ฆฌ์ง€ ์•Š์œผ๋ฉด์„œ ์ด์ ์„ ์ฑ™๊ธฐ๋ ค ํ•ฉ๋‹ˆ๋‹ค. ๋Œ€์‹  L1์—๋Š” ๋ธ”๋ก์— ๋Œ€ํ•œ ZK Proof ๋ฅผ ๋„˜๊ฒจ์ฃผ๊ณ , Verifier๊ฐ€ ์ด๋ฅผ ๊ฒ€์ฆํ•˜๋ฉด์„œ ํŠธ๋žœ์žญ์…˜์˜ ๋ฌด๊ฒฐํ•œ ์ƒํƒœ ์ „์ด๋ฅผ ๊ฒ€์ฆํ•ฉ๋‹ˆ๋‹ค. ์—ฌ๊ธฐ์„œ, Polygon zkEVM์€ zkSNARKs ๋ฐฉ์‹์„ ์ฑ„ํƒํ–ˆ์Šต๋‹ˆ๋‹ค.
ย 
๊ทธ๋ ‡๋‹ค๋ฉด, ์‹ค์ œ ๋„คํŠธ์›Œํฌ์—์„œ ์˜์ง€ ์ฆ๋ช…์€ ์–ด๋–ป๊ฒŒ ๊ตฌํ˜„๋˜์—ˆ์„๊นŒ์š”? ๋‹ค์Œ๊ณผ ๊ฐ™์€ ๊ตฌํ˜„์ฒด๋“ค์ด ์กด์žฌํ•ฉ๋‹ˆ๋‹ค.
ย 
  1. The trusted sequencer : L2 ํŠธ๋žœ์žญ์…˜์„ ์‹คํ–‰ํ•˜๋Š” ๋…ธ๋“œ, L2 ํŠธ๋žœ์žญ์…˜์˜ Batch๋ฅผ Aggregator์—๊ฒŒ ์ „๋‹ฌํ•œ๋‹ค.
  1. The trusted aggregator : Sequencer์—๊ฒŒ ๋ฐ›์•„ ์ƒˆ๋กœ์šด State Root์— ๋”ฐ๋ฅธ zk proof๋ฅผ ์ƒ์„ฑํ•˜๊ณ , ์ด๋ฅผ Verifier(Consensus Contract)์— ์ „๋‹ฌํ•œ๋‹ค.
  1. The consensus contract (PolygonZkEVM.sol, deployed on L1) : L1์—์„œ zk proof๋ฅผ ๊ฒ€์ฆํ•œ๋‹ค.
ย 
ํ•œ ๋ฌธ์žฅ์œผ๋กœ ์š”์•ฝํ•˜๋ฉด,
๐Ÿ’ก
Aggregator๊ฐ€ Sequencer๊ฐ€ ๋ณด๋‚ธ L2์˜ ํŠธ๋žœ์žญ์…˜ ๋ฐฐ์น˜๋ฅผ ํ†ตํ•˜์—ฌ zkProof๋ฅผ ์ƒ์„ฑํ•˜๊ณ , L1์— ์ „๋‹ฌํ•˜์—ฌ Verifier ์ปจํŠธ๋ž™ํŠธ๊ฐ€ ๊ฒ€์ฆํ•œ๋‹ค.
ย 

zk Proof๊ฐ€ Verify๋˜๋Š” ์ˆœ๊ฐ„, ํ™•์ •๋˜๋Š” ์‚ฌ์‹ค๋“ค์€ ๋ญ˜๊นŒ์š”?

๋งจ ์ฒ˜์Œ์— ๋‹ค๋ฃจ์—ˆ๋˜ ์˜์ง€ ์ฆ๋ช… ์ผ€์ด์Šค๋Š”, Alice๊ฐ€ ๋‘ ๊ฐ€์ง€ ์ฃผ๋ฅผ ์„ ํƒํ•˜์—ฌ, ์ƒ‰๊น”์ด ๋‹ค๋ฆ„์„ ๋ฐ˜๋ณต์ ์œผ๋กœ ํ™•์ธํ•˜๋Š” ๊ณผ์ •์ด์—ˆ์Šต๋‹ˆ๋‹ค. ๊ทธ ๊ฒฐ๊ณผ๋กœ ์ž…์ฆํ•  ์ˆ˜ ์žˆ๋Š” ์‚ฌ์‹ค์€, Statement๊ฐ€ ์˜ณ๊ณ , Secret ๋˜ํ•œ ์œ ํšจํ•˜๋‹ค๋Š” ์‚ฌ์‹ค์ด์—ˆ์ฃ .
๊ทธ๋ ‡๋‹ค๋ฉด, Verifier Contract๊ฐ€ Aggregator๊ฐ€ ๋ณด๋‚ธ ZK Proof๋ฅผ ๊ฒ€์ฆํ•˜๊ฒŒ ๋˜๋ฉด ์–ด๋–ค Statement์™€ Secret์ด ์œ ํšจํ•œ์ง€ ์•Œ ์ˆ˜ ์žˆ์„๊นŒ์š”?
ย 
์ด๋ฅผ ์œ„ํ•ด์„ , ์–ด๋– ํ•œ ๊ฐ’๋“ค์ด ๊ฒฐ๊ตญ์—” Snark๊ฐ’์œผ๋กœ ๋ณ€ํ™˜๋˜๋Š”์ง€ ํ™•์ธํ•˜๋ฉด์„œ ์•Œ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
๋Œ€๋žต์ ์œผ๋กœ, Prover๊ฐ€ L2 Transaction Batch๋ฅผ Snark Proof ๊ฐ’์œผ๋กœ ๋ณ€ํ™˜๋˜๋Š” ๊ณผ์ •์€ ๋‹ค์Œ๊ณผ ๊ฐ™์Šต๋‹ˆ๋‹ค.
https://docs.polygon.technology/zkEVM/concepts/circom-intro-brief/
SNARK Proof๊ฐ€ ์ตœ์ข…์ ์œผ๋กœ ์ƒ์„ฑ๋˜๋Š” ๊ณผ์ •์—์„œ ๋‹ค์Œ๊ณผ ๊ฐ™์€ ํ”„๋กœ์„ธ์Šค๊ฐ€ ์ง„ํ–‰๋ฉ๋‹ˆ๋‹ค.
  1. STARK Recursion : ๋ฐฐ์น˜ ํŠธ๋žœ์žญ์…˜๋“ค์˜ ์˜ฌ๋ฐ”๋ฅธ ์‹คํ–‰์„ ๋ณด์žฅํ•˜๋Š” ์ฆ๋ช…์„ ํ•˜๋‚˜์˜ ์ฆ๋ช…์œผ๋กœ ๊ฒฐํ•ฉ
  1. CIRCOM : ํ•ด๋‹น ์ฆ๋ช…์„ ์ˆ˜ํ–‰ํ•  ์ˆ˜ ์žˆ๊ณ , ์‚ฌ์ด์ฆˆ๋Š” ์ค„์ธ Circuit ํ˜•ํƒœ๋กœ ๋ณ€ํ™˜ ํ›„ Witness ์ƒ์„ฑ
ย 
ํ•ด๋‹น ๊ณผ์ •์—์„œ๋Š”, ๋‹ค์–‘ํ•˜๊ณ  ๋ณต์žกํ•œ, ์‚ฐ์ˆ ์  ๋ฉ”์ปค๋‹ˆ์ฆ˜์ด ์ ์šฉ๋˜๋ฉด์„œ ํŠธ๋žœ์žญ์…˜์˜ ์˜ฌ๋ฐ”๋ฅธ ์ƒํƒœ์ „์ด๊ฐ€ ํ•˜๋‚˜์˜ ์ฆ๋ช…์œผ๋กœ ๋‚˜ํƒ€๋‚˜๊ฒŒ ๋ฉ๋‹ˆ๋‹ค. ํ•˜์ง€๋งŒ, ํ•ด๋‹น ๊ณผ์ •๋ถ€ํ„ฐ๋Š” ๋งค์šฐ ๋ณต์žกํ•˜๊ณ  ๊นŠ์€ ์ง€์‹์ด ํ•„์š”ํ•˜๋‹ˆ, ์ด๋ฒˆ ๊ธ€์—์„œ๋Š” ๋‹ค๋ฃจ์ง€ ์•Š๊ฒ ์Šต๋‹ˆ๋‹ค.
ย 

๊ฒฐ๋ก 

์˜์ง€์ฆ๋ช…์€, ์ค‘์š”ํ•œ Secret์„ ๋…ธ์ถœํ•˜์ง€ ์•Š๊ณ , ์ƒ๋Œ€๋ฐฉ์—๊ฒŒ Secret์„ ์•Œ๊ณ ์žˆ์Œ์„ ์ฆ๋ช…ํ•˜๋Š” ์•”ํ˜ธํ•™ ์ฒด๊ณ„์ž…๋‹ˆ๋‹ค. ๋‹จ์ˆœํžˆ ์ง€๋„์— ์ƒ‰์„ ์น ํ•˜๋Š” ์ •๋‹ต์„ ์•ˆ์ „ํ•˜๊ฒŒ ๊ฑฐ๋ž˜ํ•  ์ˆ˜ ์žˆ์„ ๋ฟ๋งŒ ์•„๋‹ˆ๋ผ, L2์˜ ๋ชจ๋“  ํŠธ๋žœ์žญ์…˜์„ ๋น ๋ฅด๊ฒŒ ์ฆ๋ช…ํ•  ์ˆ˜ ์žˆ๋Š” ๋ฐฉ์•ˆ์œผ๋กœ๋„ ์ฑ„ํƒ๋˜๊ณ  ์žˆ๋‹ค๋Š” ์‚ฌ์‹ค์ด ๋†€๋ž์Šต๋‹ˆ๋‹ค. ๋”ฐ๋ผ์„œ, ์กฐ๊ธˆ๋งŒ ๋” ์ฐพ์•„๋ณด๋ฉด ZK๋ฅผ ํ™œ์šฉํ•œ ์•”ํ˜ธํ™” ์ฒด๊ณ„๋Š” ์„ธ์ƒ ์ „๋ฐ˜์— ํผ์ ธ์žˆ๋Š” ๊ฑธ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
๋˜ํ•œ, zk-SNARKs๋ฅผ ์‚ดํŽด๋ณด๋ฉฐ ์•ˆ์ •์„ฑ์„ ๋†’์ด๊ธฐ ์œ„ํ•ด์„œ ๋‹ค์–‘ํ•œ ์ˆ˜ํ•™์  ๋ฐฐ๊ฒฝ์ด ๊น”๋ ค์žˆ๋‹ค๋Š” ์‚ฌ์‹ค์„ ์•Œ๊ฒŒ๋˜์—ˆ์Šต๋‹ˆ๋‹ค. ์ด ๊ธ€์—์„œ ๋‹ค๋ฃจ์ง€ ์•Š์•˜์ง€๋งŒ, ์ถฉ๋ถ„ํžˆ ๊ณต๋ถ€ํ• ๋งŒํ•œ ๊ฐ€์น˜๊ฐ€ ์žˆ๋‹ค๊ณ  ์ƒ๊ฐํ•ด์„œ ๊ด€๋ จ ๋ฆฌ์„œ์น˜๋ฅผ ์ฝ์–ด๋ณด๊ธฐ ์‹œ์ž‘ํ–ˆ์Šต๋‹ˆ๋‹ค.
์ œ๊ฐ€ ์“ฐ๊ณ  ์žˆ๋Š” ๊ธ€๋“ค์ด, ์ •๋ง RAWํ•˜๊ฒŒ ๋ชจ๋“  ๊ณต์‹๊ณผ ์ˆ˜์‹์„ ์ดํ•ดํ•˜๊ณ  ์“ฐ๋Š” ๊ธ€์ด ์•„๋‹ˆ์ง€๋งŒ, ๋ณต์žกํ•œ ์ง€์‹์„ ์ฝ๋Š” ์‚ฌ๋žŒ์—๊ฒŒ ๊ฐ€๋ณ๊ฒŒ ์ฝ์–ด๋ณด์ง€ ์•Š๋„๋ก ์ถ”ํ›„ ํ•ด๋‹น ๊ธ€๋„ ์ •๋ฆฌํ•ด๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค.
ย 
๐Ÿ’ก
I'd like to introduce a great video I found on YouTube about Zero-Knowledge Proofs and explain how this concept is applied in blockchain.

What is Zero-Knowledge Proof?

Video preview
Watch this video to understand Zero-Knowledge Proofs!
For those who can't watch the video, here's a text summary:
"Color all US states with 4 colors so that no adjacent states share the same color" is the problem. Alice has put money on this problem, and Bob has come with a solution. However, both parties have concerns.
  1. Bob wants to receive payment for providing the solution.
  1. Alice wants to verify the solution before paying.
How can we solve this problem in a way that satisfies both Bob and Alice?
This can be solved using Zero-Knowledge Proof.
To implement this, Bob proves to Alice that he colored the map correctly using the following method:
"Showing the colors of any two adjacent states that Alice chooses"
If Alice selects two states and Bob's solution is correct, the colors will be different.
If this process is repeated about 100 times, Alice can be confident in Bob's solution and pay him, and Bob can receive payment and provide the solution.

How is Zero-Knowledge Proof Applied in ZK Rollup Chain?

Now, let's expand from the basic concept of Zero-Knowledge Proof to its application in ZK Rollup Chain.
After understanding the basic mechanism through the simple analogy above, let's examine the theoretical components of Zero-Knowledge Proof.
  1. Statement: Publicly known proof information, "Color all states with 4 colors so no adjacent states share the same color"
  1. Verifier: Alice, the person verifying the information
  1. Prover: Bob, who wants to prove he has the information without revealing it
  1. Secret: The colored map, hidden from everyone but proven by the Prover
  1. Challenge: The process of selecting two states, where the Verifier validates the Prover's Secret
  1. Statement is true: When the Verifier confirms the Prover possesses the Secret
These concepts are implemented in zkEVM through code and various infrastructure.
However, blockchain networks don't create Zero-Knowledge Proofs through interaction like Bob and Alice. Let's understand how blockchain implements Zero-Knowledge Proof concepts by examining Polygon's zkEVM.
Generally, Zero-Knowledge Proof in blockchain is a Non-Interactive Zero-Knowledge Proof System.
Therefore, it follows the encryption system called zk-SNARKs. This system has the following characteristics:

SNARK Characteristics

  1. Succinct: The proof size is small and can be verified quickly
  1. Non-interactive: No interaction needed
  1. Argument of Knowledge: Proves that the Secret is actually known

How Polygon zkEVM Uses zk-SNARKS

Unlike Optimistic Rollup, ZK Rollup doesn't send all transactions to the L1 layer while maintaining benefits. Instead, it sends ZK Proof of the block to L1, and the Verifier validates the proof to verify the transaction's valid state transition. Here, Polygon zkEVM adopted the zkSNARKs approach.
So, how is Zero-Knowledge Proof implemented in the actual network? The following components exist:
  1. The trusted sequencer: A node that executes L2 transactions and sends L2 transaction batches to the Aggregator
  1. The trusted aggregator: Receives from Sequencer, generates zk proof based on new State Root, and sends it to the Verifier(Consensus Contract)
  1. The consensus contract (PolygonZkEVM.sol, deployed on L1): Verifies zk proof on L1
In one sentence:
The Aggregator generates zkProof through L2 transaction batches from the Sequencer and sends it to L1 for verification by the Verifier contract.

What Facts are Confirmed When zk Proof is Verified?

In our initial Zero-Knowledge Proof case, Alice repeatedly verified that two selected states had different colors. This proved that the Statement was correct and the Secret was valid.
Then, when the Verifier Contract verifies the ZK Proof sent by the Aggregator, what Statement and Secret are validated?
To understand this, we need to see what values are ultimately converted into Snark values.
Roughly, here's how the Prover converts L2 Transaction Batch into Snark Proof values:
The following processes occur during the final generation of SNARK Proof:
  1. STARK Recursion: Combines proofs ensuring correct execution of batch transactions into a single proof
  1. CIRCOM: Converts the proof into a smaller Circuit format and generates Witness
During this process, various complex arithmetic mechanisms are applied to represent the transaction's valid state transition as a single proof. However, as this process requires very complex and deep knowledge, we won't cover it in this article.

Conclusion

Zero-Knowledge Proof is a cryptographic system that proves possession of a Secret without revealing it. It's amazing that it can not only safely trade solutions like map coloring but is also adopted as a way to quickly prove all L2 transactions. If you look a bit further, you'll find that ZK-based encryption systems are widespread throughout the world.
Also, examining zk-SNARKs revealed the diverse mathematical background needed for increased security. Although not covered in this article, I've started reading related research as I believe it's worth studying.
While my articles don't RAW-ly explain all formulas and equations, I plan to organize this topic in future posts to ensure readers don't take complex knowledge lightly.
ย