{"id":21526963,"url":"https://github.com/lambdaclass/starknet_rollup_on_bitcoin","last_synced_at":"2025-04-09T23:34:29.470Z","repository":{"id":181307792,"uuid":"639894794","full_name":"lambdaclass/starknet_rollup_on_bitcoin","owner":"lambdaclass","description":"Soverign rollup based on Rollkit, Cairo VM for the application layer and Bitcoin as a DA layer","archived":false,"fork":false,"pushed_at":"2023-07-14T16:19:50.000Z","size":32690,"stargazers_count":13,"open_issues_count":1,"forks_count":3,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-24T01:23:59.372Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lambdaclass.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-05-12T13:20:57.000Z","updated_at":"2024-04-23T16:44:56.000Z","dependencies_parsed_at":"2023-07-14T22:33:32.504Z","dependency_job_id":null,"html_url":"https://github.com/lambdaclass/starknet_rollup_on_bitcoin","commit_stats":null,"previous_names":["lambdaclass/starknet_rollup_on_bitcoin"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lambdaclass%2Fstarknet_rollup_on_bitcoin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lambdaclass%2Fstarknet_rollup_on_bitcoin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lambdaclass%2Fstarknet_rollup_on_bitcoin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lambdaclass%2Fstarknet_rollup_on_bitcoin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lambdaclass","download_url":"https://codeload.github.com/lambdaclass/starknet_rollup_on_bitcoin/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248130261,"owners_count":21052724,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-24T01:47:21.883Z","updated_at":"2025-04-09T23:34:29.436Z","avatar_url":"https://github.com/lambdaclass.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Starknet Rollup on Bitcoin PoC\n\n## Overview\nStarknet Rollup on Bitcoin is a PoC soverign rollup based on Rollkit and Starknet in Rust (Cairo VM) for the application layer over Bitcoin as the Data availability layer, allowing BRC-20 tokens to be used as Starknet tokens via a burn/bridge process.\n\n### Design\n\nThe design is based on watching specific burn transactions on Bitcoin, and decoding which BRC-20 assets they represent. Whenever a burn is detected, a mint for an ERC-20 compatible token occurs on the rollup's sequencer (Rollkit) which updates the Starknet state object, allowing for Cairo applications (such as AMMs, swaps, etc.) to run on top of it.\n\n## How to run\n\nRequirements:\n\n- `bitcoin-cli` and `bitcoind` have to be installed. See [this guide for running Rollkit with Bitcoin](https://rollkit.dev/docs/tutorials/bitcoin/) for more information.\n- `Python3.9` needs to be installed.\n- `GMP Library` should be available. You can install it on:\n  - Ubuntu ```sudo apt install -y libgmp3-dev```\n  - MacOS ```brew install gmp```\n\n### DA Layer\n\nWhat we need to do to run this is generate a wallet and run the daemon. For this, run\n\n```sh\nmake bitcoin\n```\n\nWhich runs `./bitcoin/start-daemon.sh` and `./bitcoin/run.sh`. This starts `bitcoind` in regtest and creates (and selects) a wallet, alongside starting a mining task.\nWe need this in order to post our Rollkit blocks to Bitcoin as configured in our Golang project (located in `/rollkit-node-bitcoin`).\n\n### Sequencer (app layer)\n\nOn another terminal, run the ABCI.\n\n```sh\nmake abci\n```\n\nThe ABCI is the binary which interfaces with systems such as Tendermint Core or Rollkit and defines the state transitions that are consequence of the transactions that our blockchain nodes receive.\n\n### Rollkit\n\nIf Tendermint Core is not installed, install and initialize it. This will initialize the required files that Rollkit will use when running:\n\n```sh\nmake consensus_install\nbin/tendermint init\n```\n\nNotice we could also eventually use Tendermint for running alongside our ABCI as a standalone blockchain consensus mechanism.\n\nAfter we have this, we can build and run our Rollkit project configured with Bitcoin as the DA layer.\n\n```sh\n# requires md5sum \nmake rollkit_bitcoin\n```\n\nAt this point you should have a DA layer running alongside the application layer (ABCI) and Rollkit acting as the sequencer for incoming transactions. You could now run the binary which watches Bitcoin's transactions and decodes the witness into BRC-20 data in order to send mint transactions to the sequencer (`cargo run --bin watcher`). \n\n### Cairo\n\nThe rollup only works with `Cairo 0`, this means cairo-lang should be installed. To do so run:\n\n```sh\nmake install cairo\n```\n\nAfter the installation is done, `starknet-compile` will be available in order to compile both Cairo contracts (`erc20_mintable.cairo` and `amm.cairo`). There is a make target for compiling the contracts: `make compile-starknet`\n\n## Limitations and future work\n\nFor now, Rollkit only runs as a single sequencer. More sequencing modes are planned for the roadmap, but this means that for now this project can only run as a centralized sequencer instead of having a set of multiple nodes which would mean more liveness. Furthermore, there is currently no way to have light nodes that can validate transactions accordingly. Read more about these limitations in Rollkit's [roadmap blog post](https://rollkit.dev/blog/introducing-rollkit/#vision-for-rollkit).\n\nThe design of the system involves running a binary that looks into recently-burned Bitcoin assets in order to send minting transactions to the sequencer. This implies a risk since, even when we can verify transactions through signatures, there is a possibility to get hacked and have arbitrary minting. For this we spent some time looking into the ABCI++ protocol to couple block production with minting according to what we saw on Bitcoin, but were not successful since the related methods are currently not supported on Rollkit (there are some experimental branches which we were not able to run correctly).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flambdaclass%2Fstarknet_rollup_on_bitcoin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flambdaclass%2Fstarknet_rollup_on_bitcoin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flambdaclass%2Fstarknet_rollup_on_bitcoin/lists"}