From 1d7a9fa39d337bef5970842d7497fbed0ff7b313 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Kami=C5=84ski?= Date: Fri, 2 Aug 2024 17:22:59 +0200 Subject: [PATCH 1/9] wip --- README.md | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/README.md b/README.md index 565c10f8..bab30993 100644 --- a/README.md +++ b/README.md @@ -13,14 +13,50 @@ Raito is a zero-knowledge Bitcoin client implemented in Cairo. It aims to provide trustless validation of the Bitcoin blockchain through STARK proof verification. It is heavily inspired by [ZeroSync](https://github.com/ZeroSync/ZeroSynchttps://github.com/ZeroSync/ZeroSync) project. +```mermaid +flowchart TB +Pnm1(STARK proof of the chain state
up to the block n - 1) --> Vp(zk verifier) +Bn(blocks n..m) ----> Vb + +subgraph Cairo + Vp{{STARK verifier}}-->ChS(verified chain state) + ChS --> Vb{{validate block
against the chain state}} + Vb --> ChS +end + +Vb --> Pn(STARK proof of the chain state
up to the block m) + +style Bn fill:pink +style Pn fill:lightgreen +style Pnm1 fill:lightgreen +style ChS fill:greenyellow +style Vp fill:gold +style Vb fill:gold +``` + +Raito accepts two inputs: + - batch of consequitive blocks n..m + - STARK proof of the state of the chain up to block n - 1 +It makes sure that the previous chain state is valid by verifing STARK proof of it, then produces a new chain state by applying blocks. As a result a proof of a new state is generated. + +## Roadmap +### Milestone 1 +### Milestone 2 + + > **Disclaimer:** This project is in the early stages of development and should not be used in production. It will evolve rapidly, expect breaking changes. +Overview + Design goals: - **Usability:** One-click install and run. WebAssembly compatibility for browser-based execution. - **Maintainability:** Emphasis on simplicity and clean code structure. - **Performance:** Optimized for speed and efficiency, leveraging STWO's next-generation prover. + + + ## Name reference Raito is a reference to Light Yagami (夜神月, Yagami Raito) from the manga/anime Death Note. @@ -61,6 +97,7 @@ This will run the test-suite for all op-codes, integration, and test Bitcoin Scr - [Cairo](https://www.cairo-lang.org/) - [Circle STARK paper](https://eprint.iacr.org/2024/278) - [ZeroSync](https://github.com/ZeroSync/ZeroSync) +- [Shinigami](https://github.com/keep-starknet-strange/shinigami) ## Contributors ✨ From b8692a7f224cf5f78eee25d5eb4027a1e1bcd6dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Kami=C5=84ski?= Date: Fri, 2 Aug 2024 17:52:36 +0200 Subject: [PATCH 2/9] wip 2 --- README.md | 33 ++++++++++++--------------------- 1 file changed, 12 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index bab30993..705e39de 100644 --- a/README.md +++ b/README.md @@ -9,10 +9,14 @@ Exploration Team -## About +## Overview Raito is a zero-knowledge Bitcoin client implemented in Cairo. It aims to provide trustless validation of the Bitcoin blockchain through STARK proof verification. It is heavily inspired by [ZeroSync](https://github.com/ZeroSync/ZeroSynchttps://github.com/ZeroSync/ZeroSync) project. +**Disclaimer:** This project is in the early stages of development and should not be used in production. It will evolve rapidly, expect breaking changes. + +Raito at its core accepts two inputs: batch of consequitive blocks n..m and STARK proof of the state of the chain up to block n - 1. It makes sure that the historical chain state is valid by verifing STARK proof of it, then produces a new chain state by applying new blocks of top of historical state. As a result a proof of a new state is generated. + ```mermaid flowchart TB Pnm1(STARK proof of the chain state
up to the block n - 1) --> Vp(zk verifier) @@ -34,28 +38,15 @@ style Vp fill:gold style Vb fill:gold ``` -Raito accepts two inputs: - - batch of consequitive blocks n..m - - STARK proof of the state of the chain up to block n - 1 -It makes sure that the previous chain state is valid by verifing STARK proof of it, then produces a new chain state by applying blocks. As a result a proof of a new state is generated. +## Applications +Although this is a highly experimental project without immediate plans for deployment, there are many potential applications: +* light clients +* IBC speedup +* noncustodial bridges +* layer 2s ## Roadmap -### Milestone 1 -### Milestone 2 - - -> **Disclaimer:** This project is in the early stages of development and should not be used in production. It will evolve rapidly, expect breaking changes. - -Overview - -Design goals: - -- **Usability:** One-click install and run. WebAssembly compatibility for browser-based execution. -- **Maintainability:** Emphasis on simplicity and clean code structure. -- **Performance:** Optimized for speed and efficiency, leveraging STWO's next-generation prover. - - - +- [] abc ## Name reference From 41a279910475757da2c2ae9a457d76c54f7e20bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Kami=C5=84ski?= Date: Fri, 2 Aug 2024 17:53:25 +0200 Subject: [PATCH 3/9] wip 3 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 705e39de..1ed70a0d 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ Raito is a zero-knowledge Bitcoin client implemented in Cairo. It aims to provide trustless validation of the Bitcoin blockchain through STARK proof verification. It is heavily inspired by [ZeroSync](https://github.com/ZeroSync/ZeroSynchttps://github.com/ZeroSync/ZeroSync) project. -**Disclaimer:** This project is in the early stages of development and should not be used in production. It will evolve rapidly, expect breaking changes. +> **Disclaimer:** This project is in the early stages of development and should not be used in production. It will evolve rapidly, expect breaking changes. Raito at its core accepts two inputs: batch of consequitive blocks n..m and STARK proof of the state of the chain up to block n - 1. It makes sure that the historical chain state is valid by verifing STARK proof of it, then produces a new chain state by applying new blocks of top of historical state. As a result a proof of a new state is generated. From e0f7bf60c6b62f1d7c4c32db5dd742db500aeb53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Kami=C5=84ski?= Date: Fri, 2 Aug 2024 18:26:45 +0200 Subject: [PATCH 4/9] wip 4 --- README.md | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 1ed70a0d..7a893114 100644 --- a/README.md +++ b/README.md @@ -15,8 +15,6 @@ Raito is a zero-knowledge Bitcoin client implemented in Cairo. It aims to provid > **Disclaimer:** This project is in the early stages of development and should not be used in production. It will evolve rapidly, expect breaking changes. -Raito at its core accepts two inputs: batch of consequitive blocks n..m and STARK proof of the state of the chain up to block n - 1. It makes sure that the historical chain state is valid by verifing STARK proof of it, then produces a new chain state by applying new blocks of top of historical state. As a result a proof of a new state is generated. - ```mermaid flowchart TB Pnm1(STARK proof of the chain state
up to the block n - 1) --> Vp(zk verifier) @@ -38,15 +36,21 @@ style Vp fill:gold style Vb fill:gold ``` +Raito, at its core, accepts two inputs: a batch of consecutive blocks n to m and a STARK proof of the state of the chain up to block n−1. It ensures that the historical chain state is valid by verifying the STARK proof. Then, it produces a new chain state by applying the new blocks on top of the historical state. As a result, a proof of the new state is generated. + ## Applications Although this is a highly experimental project without immediate plans for deployment, there are many potential applications: * light clients -* IBC speedup -* noncustodial bridges +* IBD speedup +* non custodial bridges * layer 2s ## Roadmap -- [] abc +- 👷‍♂️ verify block header (block hash, previous block hash, Merkle root, proof-of-work, median time, and difficulty adjustment) +- 👷‍♂️ verify transactions +- [] integrate with Shinigami and verify scripts +- [] verify previous chain proofs +- [] add utreexo accumulator to the chain state ## Name reference From a5e285e1cef613168235e4352bb18967acc5cb09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Kami=C5=84ski?= Date: Fri, 2 Aug 2024 18:29:23 +0200 Subject: [PATCH 5/9] wip 5 --- README.md | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 7a893114..cf1034ce 100644 --- a/README.md +++ b/README.md @@ -48,9 +48,9 @@ Although this is a highly experimental project without immediate plans for deplo ## Roadmap - 👷‍♂️ verify block header (block hash, previous block hash, Merkle root, proof-of-work, median time, and difficulty adjustment) - 👷‍♂️ verify transactions -- [] integrate with Shinigami and verify scripts -- [] verify previous chain proofs -- [] add utreexo accumulator to the chain state +- [ ] integrate with Shinigami and verify scripts +- [ ] verify previous chain proofs +- [ ] add utreexo accumulator to the chain state ## Name reference @@ -62,15 +62,7 @@ Raito is a reference to Light Yagami (夜神月, Yagami Raito) from the manga/an ![Raito and Raito](./docs/img/memes/raito_shinigami_fusion.jpg) -### Running - -```bash -scarb cairo-run --available-gas=200000000 -``` - -This will run the provided Bitcoin Script in Cairo. - -### Building +## Usage ```bash scarb build @@ -78,13 +70,11 @@ scarb build This will compile all the components. -### Testing - ```bash scarb test ``` -This will run the test-suite for all op-codes, integration, and test Bitcoin Scripts. +This will run the test-suite. ## References From 92f4c7e607c0bc793df7872a71ee72f660f5664f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Kami=C5=84ski?= Date: Fri, 2 Aug 2024 18:34:09 +0200 Subject: [PATCH 6/9] wip 6 --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index cf1034ce..4d26b6c1 100644 --- a/README.md +++ b/README.md @@ -46,8 +46,8 @@ Although this is a highly experimental project without immediate plans for deplo * layer 2s ## Roadmap -- 👷‍♂️ verify block header (block hash, previous block hash, Merkle root, proof-of-work, median time, and difficulty adjustment) -- 👷‍♂️ verify transactions +- [ ] verify block header (block hash, previous block hash, Merkle root, proof-of-work, median time, and difficulty adjustment) +- [ ] verify transactions - [ ] integrate with Shinigami and verify scripts - [ ] verify previous chain proofs - [ ] add utreexo accumulator to the chain state @@ -63,18 +63,18 @@ Raito is a reference to Light Yagami (夜神月, Yagami Raito) from the manga/an ![Raito and Raito](./docs/img/memes/raito_shinigami_fusion.jpg) ## Usage +This will compile all the components: ```bash scarb build -``` -This will compile all the components. +``` +This will run the test-suite: ```bash scarb test ``` -This will run the test-suite. ## References From 44b21f3a91ef50a1bd50ea911a65dc36993943b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Kami=C5=84ski?= Date: Fri, 2 Aug 2024 18:50:00 +0200 Subject: [PATCH 7/9] wip 7 --- README.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 4d26b6c1..8be5a67d 100644 --- a/README.md +++ b/README.md @@ -39,14 +39,16 @@ style Vb fill:gold Raito, at its core, accepts two inputs: a batch of consecutive blocks n to m and a STARK proof of the state of the chain up to block n−1. It ensures that the historical chain state is valid by verifying the STARK proof. Then, it produces a new chain state by applying the new blocks on top of the historical state. As a result, a proof of the new state is generated. ## Applications + Although this is a highly experimental project without immediate plans for deployment, there are many potential applications: * light clients * IBD speedup * non custodial bridges -* layer 2s +* layer 2s ## Roadmap -- [ ] verify block header (block hash, previous block hash, Merkle root, proof-of-work, median time, and difficulty adjustment) + +- [ ] verify block header (block hash, previous block hash, Merkle root, proof-of-work, median time, and difficulty adjustment) - [ ] verify transactions - [ ] integrate with Shinigami and verify scripts - [ ] verify previous chain proofs @@ -63,19 +65,20 @@ Raito is a reference to Light Yagami (夜神月, Yagami Raito) from the manga/an ![Raito and Raito](./docs/img/memes/raito_shinigami_fusion.jpg) ## Usage + This will compile all the components: ```bash scarb build ``` + This will run the test-suite: ```bash scarb test ``` - ## References - [STWO](https://github.com/starkware-libs/stwo) From 75f5bbc0bad3c771b878749d65cef88ea3a26b0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Kami=C5=84ski?= Date: Fri, 2 Aug 2024 18:51:56 +0200 Subject: [PATCH 8/9] wip 8 --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 8be5a67d..b0163071 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,7 @@ Raito, at its core, accepts two inputs: a batch of consecutive blocks n t ## Applications Although this is a highly experimental project without immediate plans for deployment, there are many potential applications: + * light clients * IBD speedup * non custodial bridges From f6de97ffdf580012d63f3f8c585782dd40e97d22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Kami=C5=84ski?= Date: Fri, 2 Aug 2024 18:54:42 +0200 Subject: [PATCH 9/9] wip 9 --- README.md | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index b0163071..a7a1dd73 100644 --- a/README.md +++ b/README.md @@ -49,19 +49,19 @@ Although this is a highly experimental project without immediate plans for deplo ## Roadmap -- [ ] verify block header (block hash, previous block hash, Merkle root, proof-of-work, median time, and difficulty adjustment) -- [ ] verify transactions -- [ ] integrate with Shinigami and verify scripts -- [ ] verify previous chain proofs -- [ ] add utreexo accumulator to the chain state +* [ ] verify block header (block hash, previous block hash, Merkle root, proof-of-work, median time, and difficulty adjustment) +* [ ] verify transactions +* [ ] integrate with Shinigami and verify scripts +* [ ] verify previous chain proofs +* [ ] add utreexo accumulator to the chain state ## Name reference Raito is a reference to Light Yagami (夜神月, Yagami Raito) from the manga/anime Death Note. -- Raito in Japanese means "Light", which in turns can refer to Lightning ⚡ (and hence both a reference to speed of verification of the Bitcoin blockchain using a ZKP and a reference to the Lightning Network) -- Raito can work in tandem with [Shinigami](https://github.com/keep-starknet-strange/shinigami) that enables verification of Bitcoin Script programs. Raito = Consensus and Shinigami = Execution. Since Shinigami was named after Ryuk (Shinigami in Death Note), Raito was named after Light (Raito in Death Note). -- What Raito writes in the Death Note always happen, so you can see it as a source of truth, similarly to how you use a Zero-Knowledge Proof to verify the integrity of a computation. +* Raito in Japanese means "Light", which in turns can refer to Lightning ⚡ (and hence both a reference to speed of verification of the Bitcoin blockchain using a ZKP and a reference to the Lightning Network) +* Raito can work in tandem with [Shinigami](https://github.com/keep-starknet-strange/shinigami) that enables verification of Bitcoin Script programs. Raito = Consensus and Shinigami = Execution. Since Shinigami was named after Ryuk (Shinigami in Death Note), Raito was named after Light (Raito in Death Note). +* What Raito writes in the Death Note always happen, so you can see it as a source of truth, similarly to how you use a Zero-Knowledge Proof to verify the integrity of a computation. ![Raito and Raito](./docs/img/memes/raito_shinigami_fusion.jpg) @@ -82,11 +82,11 @@ scarb test ## References -- [STWO](https://github.com/starkware-libs/stwo) -- [Cairo](https://www.cairo-lang.org/) -- [Circle STARK paper](https://eprint.iacr.org/2024/278) -- [ZeroSync](https://github.com/ZeroSync/ZeroSync) -- [Shinigami](https://github.com/keep-starknet-strange/shinigami) +* [STWO](https://github.com/starkware-libs/stwo) +* [Cairo](https://www.cairo-lang.org/) +* [Circle STARK paper](https://eprint.iacr.org/2024/278) +* [ZeroSync](https://github.com/ZeroSync/ZeroSync) +* [Shinigami](https://github.com/keep-starknet-strange/shinigami) ## Contributors ✨