{"id":18728800,"url":"https://github.com/rubyonworld/bitcoin-ruby-blockchain","last_synced_at":"2026-04-10T22:49:29.535Z","repository":{"id":174007845,"uuid":"542153233","full_name":"RubyOnWorld/bitcoin-ruby-blockchain","owner":"RubyOnWorld","description":"This is a bitcoin blockchain storage based on bitcoin-ruby with support for several different backends and database adapters.","archived":false,"fork":false,"pushed_at":"2022-09-27T16:39:35.000Z","size":97,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-19T20:33:02.954Z","etag":null,"topics":["bitcion","bitcoin","bitcoin-ruby","rails","ruby"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RubyOnWorld.png","metadata":{"files":{"readme":"README.rdoc","changelog":"CHANGELOG","contributing":null,"funding":null,"license":"COPYING","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-09-27T15:19:16.000Z","updated_at":"2024-05-20T11:11:41.000Z","dependencies_parsed_at":null,"dependency_job_id":"bc5d3b66-b522-4e7e-99c6-07bc59631f42","html_url":"https://github.com/RubyOnWorld/bitcoin-ruby-blockchain","commit_stats":null,"previous_names":["rubyonworld/bitcoin-ruby-blockchain"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/RubyOnWorld/bitcoin-ruby-blockchain","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RubyOnWorld%2Fbitcoin-ruby-blockchain","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RubyOnWorld%2Fbitcoin-ruby-blockchain/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RubyOnWorld%2Fbitcoin-ruby-blockchain/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RubyOnWorld%2Fbitcoin-ruby-blockchain/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RubyOnWorld","download_url":"https://codeload.github.com/RubyOnWorld/bitcoin-ruby-blockchain/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RubyOnWorld%2Fbitcoin-ruby-blockchain/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262678882,"owners_count":23347441,"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":["bitcion","bitcoin","bitcoin-ruby","rails","ruby"],"created_at":"2024-11-07T14:24:24.717Z","updated_at":"2026-04-10T22:49:24.490Z","avatar_url":"https://github.com/RubyOnWorld.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"= Bitcoin-ruby-blockchain\n\nThis is a bitcoin blockchain storage based on bitcoin-ruby with support for\nseveral different backends and database adapters.\n\nIt also provides {Bitcoin::Blockchain::Validation Validation} functionality to ensure\nthat only valid data is stored.\n\n\n== Backends\n\nThe +:archive+ and +:utxo+ backends can both use any SQL database supported by sequel.\n\n\n=== Archive\n\nThe {Bitcoin::Blockchain::Backends::Archive Archive} backend stores a complete,\nfully-indexed blockchain.\n\nThis backend produces a very large DB, but holds the data in a completely normalized\nschema and can be queried arbitrarily.\n\nPostgres is the recommended adapter since it is the most optimized.\n\nWebbtc.com[http://webbtc.com] is based on this backend, and you can grab a postgres\ndump from http://dumps.webbtc.com to get started more quickly (hours instead of days).\n\n\n=== Utxo\n\nThe {Bitcoin::Blockchain::Backends::Utxo Utxo} backend stores only the utxos\n(\"Unspent TX Outputs\") needed to validate the blockchain on its own.\n\nThis backend produces a much smaller DB than the `:archive` backend, but can only be\nqueried for addresses it has been told to watch previously.\n\n\n=== Configuration\n\nSpecify which sequel adapter and database to use like this:\n\n sqlite:/                                          # sqlite in-memory database\n sqlite://bitcoin.db                               # sqlite db in current directory\n sqlite:///tmp/bitcoin.db                          # sqlite with absolute path\n postgres:/bitcoin                                 # local postgres database\n postgres://\u003cuser\u003e:\u003cpass\u003e@\u003chost\u003e:\u003cport\u003e/\u003cdatabase\u003e # remote postgres db with authentication\n\n\n== Installation\n\nWe assume you already have a ruby 1.9 or 2.0 compatible interpreter and rubygems environment.\n\n gem install bitcoin-ruby-blockchain\n\nOr add it to your Gemfile and\n\n require 'bitcoin/blockchain'\n\n\n== Usage\n\nInitialize a blockchain with the desired backend and DB adapter:\n # use :utxo backend with in-memory sqlite DB\n chain = Bitcoin::Blockchain::Utxo.new(db: \"sqlite:/\")\n \n # use :archive backend with local postgres DB\n chain = Bitcoin::Blockchain::Archive.new(db: \"postgres:/bitcoin\")\n\nGive it a {Bitcoin::Protocol::Block Block} to store:\n\n chain.store_block(block) #=\u003e [height, branch]\n\nAnd query objects from the blockchain:\n\n chain.get_head   #=\u003e current best block\n chain.get_height #=\u003e height of current best block\n block = chain.get_block(block_hash)\n tx = chain.get_tx(tx_hash)\n\nSee {Bitcoin::Blockchain::Backends::Base} for a complete list of methods common to all backends.\n\nThese return {Bitcoin::Blockchain::Models} objects, which are like {Bitcoin::Protocol}\nobjects with extra features to query related data from the blockchain, like so:\n\n block.get_prev_block  #=\u003e the previous block this one is based upon\n block.get_next_block  #=\u003e the next block based upon this one\n tx.get_block          #=\u003e the block this tx is in\n tx.confirmations      #=\u003e number of blocks in the main chain that confirm this tx\n tx.in[0].get_prev_out #=\u003e the previous output that is spent by this input\n tx.out[0].get_next_in #=\u003e the next input that is spending this output\n\n\n== Documentation\n\nAlways trying to improve, any help appreciated! If anything is unclear to you, let us know!\n\nDocumentation is generated using yardoc:\n\n rake doc\n\nThe specs are also a good place to see how things are supposed to work.\n\n\n== Specs\n\nThe specs can be run with\n\n rake\n\nor, if you want to run a single spec\n\n rspec spec/blockchain/models_spec.rb\n\nCoverage information is automatically generated and can be found in +coverage/+ after\nthe test run.\n\n\n== Contributing\n\nAny help or feedback is greatly appreciated! Just open an issue, submit a pull-request,\nor come to #bitcoin-ruby on irc.freenode.net if you want to chat.\n\n\n== License\n\nThis software is licensed under the terms of the MIT license. See {file:COPYING} for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frubyonworld%2Fbitcoin-ruby-blockchain","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frubyonworld%2Fbitcoin-ruby-blockchain","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frubyonworld%2Fbitcoin-ruby-blockchain/lists"}