diff --git a/.github/workflows/book.yml b/.github/workflows/book.yml new file mode 100644 index 0000000..68bc232 --- /dev/null +++ b/.github/workflows/book.yml @@ -0,0 +1,31 @@ +name: Bitcoin Circle STARK Book + +on: + push: + branches: + - main + pull_request: + +jobs: + deploy: + runs-on: ubuntu-20.04 + concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + steps: + - uses: actions/checkout@v2 + + - name: Setup mdBook + uses: peaceiris/actions-mdbook@v1 + with: + mdbook-version: "0.4.10" + + - name: Build mdBook + run: mdbook build + working-directory: ./book + + - name: Deploy + uses: peaceiris/actions-gh-pages@v3 + if: ${{ github.ref == 'refs/heads/main' }} + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./book/book diff --git a/book/.gitignore b/book/.gitignore new file mode 100644 index 0000000..7585238 --- /dev/null +++ b/book/.gitignore @@ -0,0 +1 @@ +book diff --git a/book/book.toml b/book/book.toml new file mode 100644 index 0000000..7712d3f --- /dev/null +++ b/book/book.toml @@ -0,0 +1,13 @@ +[book] +authors = ["Bitcoin-Wildlife-Sanctuary"] +language = "en" +multilingual = false +src = "src" +title = "Bitcoin Circle STARK" + +[output.html] +git-repository-url = "https://github.com/Bitcoin-Wildlife-Sanctuary/bitcoin-circle-stark/" +edit-url-template = "https://github.com/Bitcoin-Wildlife-Sanctuary/bitcoin-circle-stark/book/{path}" + +[output.html.playground] +runnable = false diff --git a/book/src/README.md b/book/src/README.md new file mode 100644 index 0000000..58adf66 --- /dev/null +++ b/book/src/README.md @@ -0,0 +1,8 @@ + +# Introduction + +Bitcoin Circle STARK includes Bitcoin script implementations of various cryptographic primitives for STARK. + +Essentially, it's a collection of building blocks of a Circle STARK verifier in Bitcoin script. + +- [Circle STARKs paper](https://eprint.iacr.org/2024/278.pdf) \ No newline at end of file diff --git a/book/src/SUMMARY.md b/book/src/SUMMARY.md new file mode 100644 index 0000000..1c1c32e --- /dev/null +++ b/book/src/SUMMARY.md @@ -0,0 +1,6 @@ + +# Summary + +[Introduction](README.md) + +- [Primitives](./primitives.md) \ No newline at end of file diff --git a/book/src/primitives.md b/book/src/primitives.md new file mode 100644 index 0000000..c0aa38e --- /dev/null +++ b/book/src/primitives.md @@ -0,0 +1,26 @@ + +# Primitives + +## M31, CM31, QM31, Circle Point + +- Implementation of add, sub, mul of Mersenne-31 (M31), its complex extension (CM31), and its degree-4 extension (QM31), which is imported from [BitVM/rust-bitcoin-m31-or-babybear](https://github.com/BitVM/rust-bitcoin-m31-or-babybear). + +## CirclePoint over QM31 + +- Implementation of doubling of a circle point over QM31. +- Implementation of drawing a random point on the circle over QM31, useful for Order-Optimal Data Structures (OODS). + +## Fiat-Shamir Transcript + +- Also known as "channel," which is the term used in Starkware's [stwo](https://github.com/starkware-libs/stwo) library. +- Absorbing commitments and QM31 elements through `OP_CAT + OP_SHA256`. +- Squeezing random elements for Fiat-Shamir transform using hints and `OP_CAT + OP_SHA256`. + +## Proof-of-Work Check + +- Calculating a proof-of-work nonce for the "channel", based on specified security bits. +- Verifying the proof-of-work nonce and computing the new "channel" state. + +## Merkle Tree + +- Implementation of Merkle path verification using hints and `OP_CAT + OP_SHA256`. \ No newline at end of file