-
Notifications
You must be signed in to change notification settings - Fork 2
docs: improve readme #119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
docs: improve readme #119
Changes from 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
2423194
docs: improve readme
0xAleksaOpacic 4d961ab
fix: grammar
0xAleksaOpacic 448cf16
docs: add link to FP
0xAleksaOpacic 5254456
Merge remote-tracking branch 'origin/main' into docs/improve_readme
0xAleksaOpacic caaad46
add: chanelog
0xAleksaOpacic File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
---|---|---|
@@ -1,92 +1,118 @@ | ||
# Rollup BSN Contracts | ||
|
||
This repo contains the Wasm smart contract for rollup BSN integration. The | ||
contract is intended to be deployed on Babylon Genesis and will maintain | ||
finality signatures and block finalisation status of rollups. | ||
**Bitcoin-secured finality for rollups through Babylon's Bitcoin staking | ||
protocol.** | ||
|
||
## Specification | ||
This repository contains the finality contract that enables Ethereum Rollups to | ||
become Bitcoin Supercharged Networks (BSNs) by inheriting Bitcoin's economic | ||
security through Babylon's staking infrastructure. | ||
|
||
For detailed technical specifications and requirements of the finality contract, | ||
please see [SPEC.md](docs/SPEC.md). The spec document outlines the contract's | ||
interfaces, message handlers, queries, and provides guidance for integrators. | ||
## What is Rollup BSN? | ||
|
||
## Development | ||
**Bitcoin Supercharged Networks (BSNs)** are blockchain networks that leverage | ||
Bitcoin's economic security through Babylon's Bitcoin staking protocol. BSNs | ||
enhance their security by tapping into Bitcoin's massive economic security, | ||
where Bitcoin stakers delegate their BTC to provide cryptographic attestations | ||
for network finality. | ||
|
||
### Prerequisites | ||
### How It Works | ||
|
||
Make sure you have `cargo-run-script` installed and docker running. | ||
1. **Deploy Contract** - Deploy this finality contract on Babylon Genesis chain | ||
2. **Register BSN** - Register your rollup as a Bitcoin Supercharged Network | ||
3. **BTC Delegation** - Bitcoin stakers delegate their BTC to finality providers | ||
4. **Block Finalization** - Finality providers sign rollup blocks and submit | ||
signatures to the contract | ||
5. **Cross-Chain Security** - Your rollup inherits Bitcoin's economic security | ||
through Babylon's infrastructure | ||
|
||
```bash | ||
cargo install cargo-run-script | ||
``` | ||
The finality contract acts as the bridge between your rollup and Babylon's | ||
Bitcoin staking protocol, maintaining an immutable record of block finalization | ||
and ensuring finality providers remain honest through economic incentives. | ||
|
||
### Clean the build | ||
> **Note:** To read finalized data from contracts on Babylon Genesis, you should | ||
> use an already built off-chain service or build your own. We have a | ||
> proof-of-concept available at | ||
> [rollup-finality-gadget](https://github.com/babylonlabs-io/rollup-finality-gadget). | ||
|
||
```bash | ||
cargo clean | ||
``` | ||
### Security Through Cryptography | ||
|
||
### Build the contract | ||
The system uses **EOTS (Extractable One-Time Signatures)** to ensure finality | ||
provider honesty: | ||
|
||
```bash | ||
cargo build | ||
``` | ||
- **Public Randomness Commitment** - Finality providers pre-commit to randomness | ||
values they'll use for signing | ||
- **Block Finality Signatures** - Finality providers sign rollup block data | ||
using their private keys | ||
- **One-Time Signatures** - Each signature uses unique randomness and can only | ||
be used once safely | ||
- **Automatic Slashing** - If a provider signs two different blocks at the same | ||
height (double-signing), the contract automatically extracts their private key | ||
and triggers slashing | ||
|
||
### Formatting and Linting | ||
## Repository Structure | ||
|
||
Check whether the code is formatted correctly. | ||
- **`contracts/finality/`** - Core finality contract implementing BSN | ||
integration | ||
- **`docs/`** - Comprehensive technical specifications and guides | ||
- **`e2e/`** - End-to-end integration tests | ||
- **`scripts/`** - Development and deployment utilities | ||
|
||
```bash | ||
cargo fmt --all -- --check | ||
cargo check | ||
cargo clippy --all-targets -- -D warnings | ||
``` | ||
## Quick Start | ||
|
||
Alternatively, you can run the following command to run all the checks at once. | ||
### Prerequisites | ||
|
||
```bash | ||
cargo run-script lint | ||
# Install dependencies | ||
cargo install cargo-run-script | ||
``` | ||
|
||
### Build the optimized contract | ||
### Build & Test | ||
|
||
```bash | ||
# Build the contract | ||
cargo build | ||
|
||
# Run tests | ||
cargo test --lib | ||
|
||
# Build optimized version for deployment | ||
cargo run-script optimize | ||
``` | ||
|
||
## Tests | ||
### Deploy to Babylon | ||
|
||
### Unit tests | ||
1. **Upload Contract**: Deploy WASM bytecode to Babylon Genesis | ||
2. **Instantiate**: Configure your BSN parameters | ||
3. **Register BSN**: Register with Babylon's consumer registry | ||
4. **Go Live**: Start accepting finality signatures from Finality Providers | ||
|
||
Note: Requires the optimized contract to be built (`cargo optimize`) | ||
See our [Contract Management Guide](docs/contract-managment.md) for detailed | ||
deployment instructions. | ||
|
||
Runs all the CI checks locally (in your actual toolchain). | ||
## Development Commands | ||
|
||
```bash | ||
cargo test --lib | ||
``` | ||
# Linting & formatting | ||
cargo run-script lint | ||
|
||
### Integration tests | ||
# Integration tests (requires optimized build) | ||
cargo run-script integration | ||
|
||
Note: Requires the optimized contract to be built (`cargo optimize`) | ||
# End-to-end tests | ||
cargo run-script e2e | ||
|
||
```bash | ||
cargo test --test integration | ||
# Generate contract schema | ||
cargo run-script schema | ||
``` | ||
|
||
Alternatively, you can run the following command, that makes sure to build the | ||
optimized contract before running the integration tests. | ||
## Contributing | ||
|
||
```bash | ||
cargo run-script integration | ||
``` | ||
|
||
### End-to-End Tests | ||
We welcome contributions! This project follows the same guidelines as the | ||
[Babylon node repository](https://github.com/babylonlabs-io/babylon/blob/main/CONTRIBUTING.md). | ||
|
||
Note: Requires the optimized contract to be built (`cargo optimize`) | ||
--- | ||
|
||
Run the end-to-end tests for the contract. | ||
**Need Help?** Check our [documentation](docs/) or open an issue for support. | ||
|
||
```bash | ||
cargo run-script e2e | ||
``` | ||
**Learn More:** Visit [Babylon Labs](https://babylonlabs.io) to understand the | ||
broader Bitcoin staking ecosystem. |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.