{"id":13619795,"url":"https://github.com/halseth/elftrace","last_synced_at":"2025-03-17T03:31:25.313Z","repository":{"id":207776411,"uuid":"720067189","full_name":"halseth/elftrace","owner":"halseth","description":null,"archived":false,"fork":false,"pushed_at":"2024-09-24T17:51:39.000Z","size":1378,"stargazers_count":32,"open_issues_count":0,"forks_count":7,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-02-27T17:19:13.519Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/halseth.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-11-17T14:06:13.000Z","updated_at":"2024-09-24T17:51:42.000Z","dependencies_parsed_at":"2024-04-29T17:27:29.638Z","dependency_job_id":"18eed4f6-da5c-4b5c-aaf3-2347231a54ee","html_url":"https://github.com/halseth/elftrace","commit_stats":null,"previous_names":["halseth/elftrace"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/halseth%2Felftrace","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/halseth%2Felftrace/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/halseth%2Felftrace/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/halseth%2Felftrace/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/halseth","download_url":"https://codeload.github.com/halseth/elftrace/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243841203,"owners_count":20356443,"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-08-01T21:00:48.828Z","updated_at":"2025-03-17T03:31:24.983Z","avatar_url":"https://github.com/halseth.png","language":"Rust","funding_links":[],"categories":["Libraries"],"sub_categories":["Potential Use Case"],"readme":"# Bitcoin Elftrace\nVerify RISC-V binary execution in Bitcoin script.\n\n## What is this?\n`Bitcoin Elftrace` is a proof of concept tool used to trace the execution of\nRISCV-32 binaries (ELFs), and generate Bitcoin script that can be used to\nverify this execution on-chain.\n\n## How do I use it?\nSee the [compilation doc](./docs/compile.md) for an example of how to trace a\nRISC-V binary, or the [ZK verification example](./docs/zk_verifier.md) for how\nto write a STARK verifier in Rust that can be traced.\n\n## What is this useful for?\nUsing this you can use your favourite language to write arbitrary programs that\ncan be verified on Bitcoin. Paired with the \"optimistic execution\" smart\ncontracting paradigm, this opens up the possibility for Bitcoin smart contracts\nto be arbitrary complex while still keeping the on-chain footprint low.\n\n## What is optimistic execution?\nThe idea is to write your UTXO smart contracts in a way that gives any spender\nthe incentive to act honestly. If someone tries to spend the UTXO with an\nimproper execution of the contract, they can be punished efficiently using a\nfraud proof.\n\n## How can I use elftrace to write Bitcoin smart contracts?\n`elftrace` only (currently) generates the scripts needed to validate the\nprogram execution. You will need to wrap the program in a \"MATT challenge\"\nstyle script in order to set up a proper smart contract. See\n[mattlab](https://github.com/halseth/mattlab/blob/main/docs/challenge.md) for\nan example.\n\n## Are there any limitations?\nThis is very much in a POC stage. Here's a non-exhaustive list of known\nissues/TODOs:\n\n- [ ] `CScriptNum` is used when doing operations on address locations and\n  various other operations. This can fail if numbers exceed 31-bit.\n- [ ] RISC-V opcodes `SLTI`, `LB`, `SLT`, `SRA` currently not implemented.\n\n## When can I use this on mainnet?\nIn order to use this on mainnet we would need to deploy a _covenant opcode_.\n`elftrace` is based on the `OP_CHECKCONTRACTVERIFY` opcode proposed by\n[MATT](https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2022-November/021182.html).\n\nCome join us in getting covenants deployed on Bitcoin! 🤠\n\n## What does this enable on Bitcoin?\nHaving a covenant deployed on bitcoin would enable us to use this to create\ntrustless two-way pegs, rollups, ZK verifiers... in general much more\nflexible ways of handing custody of coins to an on-chain computer program.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhalseth%2Felftrace","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhalseth%2Felftrace","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhalseth%2Felftrace/lists"}