{"id":15201996,"url":"https://github.com/demining/rust-bitcoinconsensus-google-colab","last_synced_at":"2025-10-07T20:10:33.716Z","repository":{"id":144620972,"uuid":"460601061","full_name":"demining/rust-bitcoinconsensus-Google-Colab","owner":"demining","description":"Bitcoin's libbitcoinconsenus.a with Rust binding. Built from Bitcoin sources with cargo Google Colab","archived":false,"fork":false,"pushed_at":"2022-07-02T01:07:38.000Z","size":6534,"stargazers_count":0,"open_issues_count":0,"forks_count":11,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-12T12:57:43.226Z","etag":null,"topics":["bitcoin","bitcoin-api","bitcoin-core","bitcoin-payment","bitcoin-transaction","bitcoin-wallet","colab","colab-notebook","colab-notebooks","colab-tutorial","colaboratory","google-colab","google-colab-notebook","google-colab-notebooks","google-colab-tutorial","google-colaboratory","google-colaboratory-notebooks","googlecolab"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/demining.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","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":"2022-02-17T20:41:15.000Z","updated_at":"2024-08-12T20:20:43.000Z","dependencies_parsed_at":null,"dependency_job_id":"77d72683-269e-402e-83b4-63cc7a180278","html_url":"https://github.com/demining/rust-bitcoinconsensus-Google-Colab","commit_stats":{"total_commits":63,"total_committers":14,"mean_commits":4.5,"dds":"0.46031746031746035","last_synced_commit":"0589c69eaa3fb4266b12446aad710781fee7ba1c"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/demining/rust-bitcoinconsensus-Google-Colab","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/demining%2Frust-bitcoinconsensus-Google-Colab","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/demining%2Frust-bitcoinconsensus-Google-Colab/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/demining%2Frust-bitcoinconsensus-Google-Colab/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/demining%2Frust-bitcoinconsensus-Google-Colab/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/demining","download_url":"https://codeload.github.com/demining/rust-bitcoinconsensus-Google-Colab/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/demining%2Frust-bitcoinconsensus-Google-Colab/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278838434,"owners_count":26054720,"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","status":"online","status_checked_at":"2025-10-07T02:00:06.786Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["bitcoin","bitcoin-api","bitcoin-core","bitcoin-payment","bitcoin-transaction","bitcoin-wallet","colab","colab-notebook","colab-notebooks","colab-tutorial","colaboratory","google-colab","google-colab-notebook","google-colab-notebooks","google-colab-tutorial","google-colaboratory","google-colaboratory-notebooks","googlecolab"],"created_at":"2024-09-28T04:00:25.988Z","updated_at":"2025-10-07T20:10:33.698Z","avatar_url":"https://github.com/demining.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Status](https://travis-ci.org/rust-bitcoin/rust-bitcoinconsensus.png?branch=master)](https://travis-ci.org/rust-bitcoin/rust-bitcoinconsensus)\n\n-------------------------\n### Run rust-bitcoinconsensus-Google-Colab\n\nhttps://colab.research.google.com/drive/1OShIMVcFZ_khsUIBOIV1lzrqAGo1gfm_?usp=sharing\n\n-------------------------\n\nThis project builds libbitcoinconsensus library from Bitcoin's C++ sources using cargo and offers Rust binding to its API.\n\nLibbitcoinconsenus allows transaction verification using Bitcoins unique script engine. \nBitcoin enabled applications SHOULD use libbitcoinconsensus library to avoid accepting transactions that the Bitcoin network nodes would not.\n\nThis project simplifies Rust developer's life by creating the libbitcoinconsensus library with cargo. \nNo need to deal with the archaic C++ toolchain directly.  \nThis also simplifies cross-compiling the consenus library e.g. for a mobile application.\n\nLibbitcoinconsenus refers to code from another library [secp256k1](https://github.com/bitcoin-core/secp256k1). \nA snapshot of that library is also included into Bitcoin sources, therefore it could be backed into libbitcoinconsenus. \nA typical Bitcoin enabled application will however want to access further secp256k1 functions. \nThe project [rustc-secp256k1](https://github.com/rust-bitcoin/rust-secp256k1) offers a cargo build and Rust bindings, \ntherefore decided to depend on that instead of compiling the Bitcoin embedded sources into libbitcoinconsensus. \nThis introduces a risk, since a difference between the two secp256k1 sources could break consensus with Bitcoin.\n\n## Build\n\nThis project has a submodule (the Bitcoin Core sources), you have to clone it using:\n\n`\ngit clone --recurse-submodules git@github.com:rust-bitcoin/rust-bitcoinconsensus.git\n`\n\nthen build it simple with:\n\n`\ncargo build\n`\n\nI verified the build for Linux and OSX. Aleksey Sidorov contributed the windows build. PRs are welcome to extend support for other platforms.\n\n## MSRV\n\nThe MSRV of this crate is 1.29.0.\n\nThe build dependency `cc` might require a more recent version of the Rust compiler.\nTo ensure compilation with Rust 1.29.0, pin its version in your `Cargo.lock`\nwith `cargo update -p cc --precise 1.0.41`. If you're using `secp256k1` in a library,\nto make sure it compiles in CI, you'll need to generate a lockfile first.\nExample for Travis CI:\n```yml\nbefore_script:\n  - if [ \"$TRAVIS_RUST_VERSION\" == \"1.29.0\" ]; then\n    cargo generate-lockfile --verbose \u0026\u0026 cargo update -p cc --precise \"1.0.41\" --verbose;\n    fi\n```\n\n## API\nThe API is very basic, exposing Bitcoin's as is. This is intentional to keep this project minimal footprint and no further runtime dependencies. You will need another Rust library to serialize Bitcoin transactions and scripts.\n\nVerify a single spend (input) of a Bitcoin transaction:\n\n`\nverify (spent_output_script: \u0026[u8], amount: u64, spending_transaction: \u0026[u8], input_index: usize) -\u003e Result\u003c(), Error\u003e\n`\n\n### Arguments\n * spend_output_script: a Bitcoin transaction output script to be spent\n * amount: The spent output amount in satoshis\n * spending_transaction: spending Bitcoin transaction, serialized in Bitcoin's on wire format\n * input_index: index of the input within spending_transaction\n### Example\n\nThe (randomly choosen) Bitcoin transaction [aca326a724eda9a461c10a876534ecd5ae7b27f10f26c3862fb996f80ea2d45d](https://blockchain.info/tx/aca326a724eda9a461c10a876534ecd5ae7b27f10f26c3862fb996f80ea2d45d)\nspends one input, that is the first output of [95da344585fcf2e5f7d6cbf2c3df2dcce84f9196f7a7bb901a43275cd6eb7c3f](https://blockchain.info/tx/95da344585fcf2e5f7d6cbf2c3df2dcce84f9196f7a7bb901a43275cd6eb7c3f) with a value of 630482530 satoshis\n\nThe spending transaction in wire format is:\n\n`\nspending = 02000000013f7cebd65c27431a90bba7f796914fe8cc2ddfc3f2cbd6f7e5f2fc854534da95000000006b483045022100de1ac3bcdfb0332207c4a91f3832bd2c2915840165f876ab47c5f8996b971c3602201c6c053d750fadde599e6f5c4e1963df0f01fc0d97815e8157e3d59fe09ca30d012103699b464d1d8bc9e47d4fb1cdaa89a1c5783d68363c4dbc4b524ed3d857148617feffffff02836d3c01000000001976a914fc25d6d5c94003bf5b0c7b640a248e2c637fcfb088ac7ada8202000000001976a914fbed3d9b11183209a57999d54d59f67c019e756c88ac6acb0700\n`\n\nThe script of the first output of the spent transaction is:\n\n`\nspent = 76a9144bfbaf6afb76cc5771bc6404810d1cc041a6933988ac\n`\n\nThe (pseudo code) call:\n\n`\nverify(spent, 630482530, spending, 0)\n`\n\nshould return OK(())\n\n**Note** that spent amount will only be checked for Segwit transactions. Above example is not segwit therefore verify will succeed with any amount.\n\n----\n\n|  | Donation Address |\n| --- | --- |\n| ♥ __BTC__ | 1Lw2kh9WzCActXSGHxyypGLkqQZfxDpw8v |\n| ♥ __ETH__ | 0xaBd66CF90898517573f19184b3297d651f7b90bf |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdemining%2Frust-bitcoinconsensus-google-colab","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdemining%2Frust-bitcoinconsensus-google-colab","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdemining%2Frust-bitcoinconsensus-google-colab/lists"}