-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
100294c
commit e4183bc
Showing
13 changed files
with
198 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: Bitcoin Wildlife Sanctuary Book | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
book: | ||
runs-on: ubuntu-20.04 | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Check for changes in the book directory | ||
id: check_changes | ||
run: | | ||
if git diff --quiet --exit-code HEAD^ HEAD -- book; then | ||
echo "No changes in the 'book' directory. Exiting..." | ||
exit 0 | ||
else | ||
echo "Changes detected in the book directory. Continuing..." | ||
fi | ||
continue-on-error: true | ||
|
||
- name: Setup mdBook | ||
if: steps.check_changes.outcome == 'success' | ||
uses: peaceiris/actions-mdbook@v1 | ||
with: | ||
mdbook-version: "latest" | ||
|
||
- name: Build mdBook | ||
if: steps.check_changes.outcome == 'success' | ||
run: mdbook build | ||
working-directory: ./book | ||
|
||
- name: Deploy | ||
if: ${{ github.ref == 'refs/heads/main' }} && steps.check_changes.outcome == 'success' | ||
uses: peaceiris/actions-gh-pages@v3 | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
publish_dir: ./book/book |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
// ./book/03-motivation.md | ||
## Motivation | ||
|
||
The Bitcoin Wildlife Conservatorium exists as a hub for research and experimentation with advanced Bitcoin Script functionalities, covenants, experimental opcodes, and cryptographic proofs such as STARKs/SNARKs. This collection of repositories represents a concerted effort to push the boundaries of Bitcoinβs scripting capabilities and cryptographic applications. By experimenting with new opcodes, arithmetic operations, and advanced proof systems, we aim to uncover novel ways to extend Bitcoinβs utility while maintaining its security and decentralization principles. | ||
|
||
Our motivation is driven by the need to enhance Bitcoin's scalability, security, and functionality. By developing and testing these advanced mechanisms, we seek to contribute to the long-term robustness and adoption of the Bitcoin network. This involves not only advancing technical knowledge but also fostering a community of developers and researchers dedicated to Bitcoinβs evolution. | ||
// ./book/02-background.md | ||
## Background | ||
|
||
Bitcoin Script, the native programming language on Bitcoin, is Turing-incomplete. However, its constraints foster innovation, allowing Bitcoin developers to build complex mechanisms even with a limited set of tools. Even small changes to Bitcoin can have serious effects on the overall functionality of the network, with many strategies going undiscovered for years (e.g., the publication of the BitVM paper in 2023 after the Taproot upgrade in 2021). | ||
|
||
Bitcoin, in its current form, cannot scale to support billions of users. Offboarding execution to cheaper, and sometimes more expressive, environments is a scaling strategy that allows Bitcoin to see greater adoption without overhauling its core structure. Thus, Bitcoin serves as a base layer for various execution environments. Tools such as covenants and validity proofs address custody and state validation concerns, respectively. | ||
|
||
One of the experimental areas in Bitcoin Script is the use of new opcodes, such as OP_CAT. Various proposed opcodes can enable covenants, but OP_CAT is seen as the most simple activation as it was already activated in the original Bitcoin software. OP_CAT, which concatenates two stack items, was removed from Bitcoin Script early on due to security concerns but has seen renewed interest as developers explore its potential applications. | ||
|
||
One of those applications is improved bridging modules for second layer protocols. Bitcoin Wildlife is currently working on designs that would enable recursive covenants and a STARK verifier directly in Script for the purpose of creating trustless two-way pegs for second layer protocols. | ||
|
||
// ./book/06-more.md | ||
|
||
## Other repositories | ||
|
||
Developers are also welcome to contribute to the following repositories to support the Bitcoin Wildlife project. | ||
|
||
|
||
### 1. Covenants and Experimental Opcodes | ||
|
||
* <strong><code>[covenants-gadgets](https://github.com/Bitcoin-Wildlife-Sanctuary/covenants-gadgets)</code></strong>: Gadgets for covenants: Schnorr trick and txid reflection. | ||
* <strong><code>[covenants-examples](https://github.com/Bitcoin-Wildlife-Sanctuary/covenants-examples)</code></strong>: Examples of covenants in Bitcoin script. | ||
* <strong><code>[catnet](https://github.com/Bitcoin-Wildlife-Sanctuary/catnet)</code></strong>: Custom Bitcoin signet with OP_CAT enabled, used to test the implementation of Bitcoin Circle STARK Verifier. | ||
* <strong><code>[rust-bitcoin-m31-with-muldiv](https://github.com/Bitcoin-Wildlife-Sanctuary/rust-bitcoin-m31-with-muldiv)</code></strong>: Arithmetic over the M31 field assuming OP_MUL and OP_DIV in Bitcoin Script. | ||
|
||
### 2. Bitcoin-friendly Cryptography | ||
|
||
* <strong><code>[bitcoin-circle-stark](https://github.com/Bitcoin-Wildlife-Sanctuary/bitcoin-circle-stark)</code></strong>: Building blocks of a Circle STARK verifier in Bitcoin script. | ||
* <strong><code>[catgolfing](https://github.com/Bitcoin-Wildlife-Sanctuary/catgolfing)</code></strong>: Bitcoin Circle Stark performance contest. | ||
* <strong><code>[stwo](https://github.com/Bitcoin-Wildlife-Sanctuary/stwo)</code></strong>: A fork of stwo for Bitcoin-friendly proof systems. | ||
* <strong><code>[stwo-bedd93](https://github.com/Bitcoin-Wildlife-Sanctuary/stwo-bedd93)</code></strong>: A fork of stwo for Bitcoin-friendly proof systems (archived). | ||
* <strong><code>[rust-bitcoin-m31](https://github.com/Bitcoin-Wildlife-Sanctuary/rust-bitcoin-m31)</code></strong>: Arithmetic over the M31 or BabyBear field in Bitcoin Script. | ||
|
||
### 3. General Cryptography | ||
|
||
* <strong><code>[r1cs-to-circle-plonk](https://github.com/Bitcoin-Wildlife-Sanctuary/r1cs-to-circle-plonk)</code></strong>: A transpiler, prover, and verifier for proving R1CS in Circle Plonk. | ||
* <strong><code>[circle-plonk](https://github.com/Bitcoin-Wildlife-Sanctuary/circle-plonk)</code></strong>: Using stwo to implement a Plonk prover and verifier over Circle STARK. | ||
* <strong><code>[circom-compat](https://github.com/Bitcoin-Wildlife-Sanctuary/circom-compat)</code></strong>: Arkworks bindings to Circom's R1CS, for Groth16 Proof and Witness generation in Rust. | ||
* <strong><code>[circom](https://github.com/Bitcoin-Wildlife-Sanctuary/circom)</code></strong>: zkSnark circuit compiler. | ||
* <strong><code>[r1cs-std](https://github.com/Bitcoin-Wildlife-Sanctuary/r1cs-std)</code></strong>: R1CS constraints for bits, fields, and elliptic curves. | ||
* <strong><code>[fri-study](https://github.com/Bitcoin-Wildlife-Sanctuary/fri-study)</code></strong>: Study and implementation of the FRI (Fast Reed-Solomon Interactive Oracle Proofs of Proximity) protocol in Rust. | ||
|
||
### 4. Bitcoin Script in Rust | ||
|
||
* <strong><code>[rust-bitcoin-scriptexec](https://github.com/Bitcoin-Wildlife-Sanctuary/rust-bitcoin-scriptexec)</code></strong>: Bitcoin Script interpreter implemented in Rust. | ||
* <strong><code>[rust-bitcoin-script](https://github.com/Bitcoin-Wildlife-Sanctuary/rust-bitcoin-script)</code></strong>: Inline Bitcoin scripts in Rust. | ||
|
||
### 5. Development Tooling or Miscellaneous | ||
|
||
* <strong><code>[bitcoin-simulator](https://github.com/Bitcoin-Wildlife-Sanctuary/bitcoin-simulator)</code></strong>: A simulator of a local Bitcoin testnet based on Rust and SQLite. | ||
* <strong><code>[reuse-bitcoin-pow-gadgets](https://github.com/Bitcoin-Wildlife-Sanctuary/reuse-bitcoin-pow-gadgets)</code></strong>: Gadgets that navigate how to leverage the BTC consensus for PoW security. | ||
|
||
// ./book/04-outcomes.md | ||
## Outcomes | ||
|
||
The desired outcome of this initiative is to consolidate the knowledge and tools necessary to evaluate and implement experimental Bitcoin features. By rigorously testing and documenting these advancements, we seek to provide the Bitcoin development community with a clearer understanding of the potential risks and benefits associated with these experimental features. | ||
|
||
Ultimately, this body of work aims to inform the broader discussion on Bitcoin's evolution, offering a repository of tested ideas and implementations that can be referenced for future upgrades or soft forks. In doing so, we hope to ensure that any enhancements to Bitcoin are made with a comprehensive understanding of their implications, paving the way for more secure, scalable, and innovative applications on the network. | ||
// ./book/index.md | ||
# Table of Contents | ||
|
||
1. [Introduction](01-introduction.md) | ||
2. [Background](02-background.md) | ||
3. [Motivation](03-motivation.md) | ||
4. [Outcomes](04-outcomes.md) | ||
5. [Bitcoin Cricle STARK](05-bitcoin-circle-stark.md) | ||
6. [More](06-more.md) | ||
|
||
// ./book/01-introduction.md | ||
## Intro | ||
|
||
In this docs site youβll find background information on the Bitcoin Wildlife Conservatorium project, its current focus areas, and how you can contribute. | ||
|
||
Bitcoin Wildlife is a community project focused on developing, testing and iterating on primitives in Bitcoin Script with the introduction of OP_CAT. All implementations are tested on Catnet, a fork of Signet with OP_CAT activated that features a Circle STARK Verifier directly in Script. | ||
|
||
Developers and researchers who are interested in showcasing why OP_CAT should, or shouldnβt, be activated on Bitcoin are invited to contribute to this project. | ||
|
||
Developers and researchers are also invited to apply for a grant from the [insert fund name] for their work on OP_CAT R&D. | ||
// ./book/05-bitcoin-circle-stark.md | ||
|
||
## Bitcoin Circle STARK | ||
|
||
### 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. | ||
|
||
As outlined in the Motivation section, a Circle STARK verifier enables Bitcoin to support true second layer protocols where users are guaranteed a right to exit. | ||
|
||
To contribute to this repository, please see this GitHub repo and join our community telegram chat. | ||
|
||
For reference, see the [Circle STARKs paper](https://eprint.iacr.org/2024/278.pdf). | ||
|
||
### 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 library](https://github.com/starkware-libs/stwo). | ||
|
||
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`. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
book |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
[book] | ||
authors = ["Abdel @ StarkWare"] | ||
language = "en" | ||
multilingual = false | ||
src = "src" | ||
title = "Bitcoin Wildlife Sanctuary" | ||
|
||
[output.html] | ||
git-repository-url = "https://github.com/Bitcoin-Wildlife-Sanctuary/btcwild.life" | ||
edit-url-template = "https://github.com/Bitcoin-Wildlife-Sanctuary/btcwild.life/edit/main/{path}" |
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Summary | ||
|
||
- [Introduction](./01-introduction.md) | ||
- [Background](./02-background.md) | ||
- [Motivation](./03-motivation.md) | ||
- [Outcome](./04-outcomes.md) | ||
- [Bitcoin Circle STARK](./05-bitcoin-circle-stark.md) | ||
- [More](./06-more.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# Chapter 1 |