{"id":13652582,"url":"https://github.com/nervosnetwork/ckb-sdk-ruby","last_synced_at":"2025-10-18T02:35:51.975Z","repository":{"id":41971664,"uuid":"176854132","full_name":"nervosnetwork/ckb-sdk-ruby","owner":"nervosnetwork","description":"Ruby SDK for CKB","archived":false,"fork":false,"pushed_at":"2024-11-01T05:59:13.000Z","size":1271,"stargazers_count":22,"open_issues_count":5,"forks_count":16,"subscribers_count":9,"default_branch":"develop","last_synced_at":"2025-03-09T05:52:03.499Z","etag":null,"topics":["blockchain","ckb","nervos","ruby"],"latest_commit_sha":null,"homepage":"https://www.nervos.org","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nervosnetwork.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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":"2019-03-21T02:26:33.000Z","updated_at":"2024-12-13T05:35:41.000Z","dependencies_parsed_at":"2024-11-01T06:24:03.952Z","dependency_job_id":"6b1d3c98-d1c4-488c-9304-f0b209dc1231","html_url":"https://github.com/nervosnetwork/ckb-sdk-ruby","commit_stats":null,"previous_names":[],"tags_count":45,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nervosnetwork%2Fckb-sdk-ruby","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nervosnetwork%2Fckb-sdk-ruby/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nervosnetwork%2Fckb-sdk-ruby/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nervosnetwork%2Fckb-sdk-ruby/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nervosnetwork","download_url":"https://codeload.github.com/nervosnetwork/ckb-sdk-ruby/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248504294,"owners_count":21115142,"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":["blockchain","ckb","nervos","ruby"],"created_at":"2024-08-02T02:01:00.665Z","updated_at":"2025-10-18T02:35:46.913Z","avatar_url":"https://github.com/nervosnetwork.png","language":"Ruby","readme":"# ckb-sdk-ruby\n\n[![Build Status](https://travis-ci.com/nervosnetwork/ckb-sdk-ruby.svg?branch=develop)](https://travis-ci.com/nervosnetwork/ckb-sdk-ruby)\n\nRuby SDK for CKB\n\nThe ckb-sdk-ruby is still under development and NOT production ready. You should get familiar with CKB transaction structure and RPC before using it.\n\n## WARNING\nModule Indexer has been removed from [ckb_v0.40.0](https://github.com/nervosnetwork/ckb/releases/tag/v0.40.0): Please use [ckb-indexer](https://github.com/nervosnetwork/ckb-indexer) as an alternate solution.\n\nThe following RPCs hash been removed from [ckb_v0.40.0](https://github.com/nervosnetwork/ckb/releases/tag/v0.40.0):\n* `get_live_cells_by_lock_hash`\n* `get_transactions_by_lock_hash`\n* `index_lock_hash`\n* `deindex_lock_hash`\n* `get_lock_hash_index_states`\n* `get_capacity_by_lock_hash`\n\nSince [ckb_v0.36.0](https://github.com/nervosnetwork/ckb/releases/tag/v0.36.0) SDK use [ckb-indexer](https://github.com/nervosnetwork/ckb-indexer) to collect cells, please see [Usage](#usage) for examples.\n\n## Prerequisites\n\nRequire Ruby 2.4 and above.\n\n### Ubuntu\n\n```bash\nsudo apt install libsodium-dev\n```\n\nThis SDK depends on the [rbsecp256k1](https://github.com/etscrivner/rbsecp256k1) gem. You need to install libsecp256k1. Follow [this](https://github.com/etscrivner/rbsecp256k1#requirements) to do so.\n\n### macOS\n\n```bash\nbrew tap nervosnetwork/tap\nbrew install libsodium libsecp256k1\n```\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'ckb-sdk-ruby', github: 'nervosnetwork/ckb-sdk-ruby', require: 'ckb'\n```\n\nAnd then execute:\n\n    $ bundle install\n\nIf you just want to use it in a console:\n\n```\ngit clone https://github.com/nervosnetwork/ckb-sdk-ruby.git\ncd ckb-sdk-ruby\nbundle install\nbundle exec bin/console\n```\n\n## Usage\n\nRPC interface returns parsed `JSON` object\n\n```ruby\nrpc = CKB::RPC.new\n\n# using RPC `get_tip_header`, it will return a Hash\nrpc.get_tip_header\n```\n\nAPI interface returns `Types` instead of `Hash`\n\n```ruby\napi = CKB::API.new\n\n# it will return a CKB::Types::BlockHeader\napi.get_tip_header\n```\n\nSend capacity\n\n```ruby\n# create api first\napi = CKB::API.new\n\n# create ckb-indexer api\nindexer_api = CKB::Indexer::API.new\n\n# create two wallet object\nbob = CKB::Wallet.from_hex(api, \"0xe79f3207ea4980b7fed79956d5934249ceac4751a4fae01a0f7c4a96884bc4e3\", indexer_api: indexer_api)\nalice = CKB::Wallet.from_hex(api, \"0x76e853efa8245389e33f6fe49dcbd359eb56be2f6c3594e12521d2a806d32156\", indexer_api: indexer_api)\n\n# bob send 1000 bytes to alice\ntx_hash = bob.send_capacity(alice.address, 1000 * 10**8, fee: 1000)\n\n# loop up the transaction by tx_hash\napi.get_transaction(tx_hash)\n```\n\nProvide wallet with a public key\n\n```ruby\napi = CKB::API.new\nindexer_api = CKB::Indexer::API.new\n\nbob = CKB::Wallet.new(api, \"0x024a501efd328e062c8675f2365970728c859c592beeefd6be8ead3d901330bc01\", indexer_api: indexer_api)\nalice = CKB::Wallet.new(api, \"0x0257623ec521657a27204c5590384cd59d9267c06d75ab308070be692251b67c57\", indexer_api: indexer_api)\n\nbob_key = \"0xe79f3207ea4980b7fed79956d5934249ceac4751a4fae01a0f7c4a96884bc4e3\"\n\ntx_hash = bob.send_capacity(alice.address, 1000 * 10**8, key: bob_key)\n```\n\n## Run Tests\n\n```bash\nBOB_PRIVATE_KEY=\"0xe79f3207ea4980b7fed79956d5934249ceac4751a4fae01a0f7c4a96884bc4e3\" rake spec\n```\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`.\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n\n## Changelog\n\nSee [CHANGELOG](CHANGELOG.md) for more information.\n","funding_links":[],"categories":["Tools"],"sub_categories":["SDKs"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnervosnetwork%2Fckb-sdk-ruby","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnervosnetwork%2Fckb-sdk-ruby","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnervosnetwork%2Fckb-sdk-ruby/lists"}