{"id":13454207,"url":"https://github.com/steemit/steem-ruby","last_synced_at":"2025-04-11T04:41:49.108Z","repository":{"id":50618856,"uuid":"131033256","full_name":"steemit/steem-ruby","owner":"steemit","description":"Steem-ruby is the official Ruby library for the Steem blockchain","archived":false,"fork":false,"pushed_at":"2022-07-30T22:27:15.000Z","size":479,"stargazers_count":8,"open_issues_count":7,"forks_count":15,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-03-25T02:51:12.370Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/steemit.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-04-25T16:17:21.000Z","updated_at":"2025-01-01T12:20:48.000Z","dependencies_parsed_at":"2022-08-28T11:11:48.800Z","dependency_job_id":null,"html_url":"https://github.com/steemit/steem-ruby","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steemit%2Fsteem-ruby","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steemit%2Fsteem-ruby/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steemit%2Fsteem-ruby/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steemit%2Fsteem-ruby/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/steemit","download_url":"https://codeload.github.com/steemit/steem-ruby/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248345276,"owners_count":21088242,"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-07-31T08:00:51.839Z","updated_at":"2025-04-11T04:41:49.085Z","avatar_url":"https://github.com/steemit.png","language":"Ruby","funding_links":[],"categories":["SDKs"],"sub_categories":[],"readme":"[![Gem Version](https://badge.fury.io/rb/steem-ruby.svg)](https://badge.fury.io/rb/steem-ruby)\n[![Inline docs](http://inch-ci.org/github/steemit/steem-ruby.svg?branch=master\u0026style=shields)](http://inch-ci.org/github/steemit/steem-ruby)\n\n# `steem-ruby`\n\nSteem-ruby the Ruby API for Steem blockchain.\n\nFull documentation: http://www.rubydoc.info/gems/steem-ruby\n\n**Note:** *This library depends on AppBase methods that are a work in progress.*\n\n## `radiator` vs. `steem-ruby`\n\nThe `steem-ruby` gem was written from the ground up by `@inertia`, who is also the author of [`radiator`](https://github.com/inertia186/radiator).\n\n\u003e \"I intend to continue work on `radiator` indefinitely. But in `radiator-0.5`, I intend to refactor `radiator` so that is uses `steem-ruby` as its core. This means that some features of `radiator` like Serialization will become redundant. I think it's still useful for radiator to do its own serialization because it reduces the number of API requests.\" - @inertia\n\n`radiator` | `steem-ruby`\n---------- | ------------\nHas internal failover logic | Can have failover delegated externally\nPasses `error` responses to the caller | Handles `error` responses and raises exceptions\nSupports tx signing, does its own serialization | Also supports tx signing, but delegates serialization to `database_api.get_transaction_hex`, then deserializes to verify\nAll apis and methods are hardcoded | Asks `jsonrpc` what apis and methods are available from the node\n(`radiator-0.4.x`) Only supports AppBase but relies on `condenser_api` | Only supports AppBase but does not rely on `condenser_api` **(WIP)**\nSmall list of helper methods for select ops (in addition to build your own transaction) | Complete implementation of helper methods for every op (in addition to build your own transaction)\nDoes not (yet) support `json-rpc-batch` requests | Supports `json-rpc-batch` requests\n\n## Getting Started\n\nThe steem-ruby gem is compatible with Ruby 2.2.5 or later.\n\n### Install the gem for your project\n\n*(Assuming that [Ruby is installed](https://www.ruby-lang.org/en/downloads/) on your computer, as well as [RubyGems](http://rubygems.org/pages/download))*\n\nTo install the gem on your computer, run in shell:\n\n```bash\ngem install steem-ruby\n```\n\n... then add in your code:\n\n```ruby\nrequire 'steem'\n```\n\nTo add the gem as a dependency to your project with [Bundler](http://bundler.io/), you can add this line in your Gemfile:\n\n```ruby\ngem 'steem-ruby', require: 'steem'\n```\n\n## Examples\n\n### Broadcast Vote\n\n```ruby\nparams = {\n  voter: voter,\n  author: author,\n  permlink: permlink,\n  weight: weight\n}\n\nSteem::Broadcast.vote(wif: wif, params: params) do |result|\n  puts result\nend\n```\n\n*See: [Broadcast](https://www.rubydoc.info/gems/steem-ruby/Steem/Broadcast)*\n\n### Streaming\n\nThe value passed to the block is an object, with the keys: `:type` and `:value`.\n\n```ruby\nstream = Steem::Stream.new\n\nstream.operations do |op|\n  puts \"#{op.type}: #{op.value}\"\nend\n```\n\nTo start a stream from a specific block number, pass it as an argument:\n\n```ruby\nstream = Steem::Stream.new\n\nstream.operations(at_block_num: 9001) do |op|\n  puts \"#{op.type}: #{op.value}\"\nend\n```\n\nYou can also grab the related transaction id and block number for each operation:\n\n```ruby\nstream = Steem::Stream.new\n\nstream.operations do |op, trx_id, block_num|\n  puts \"#{block_num} :: #{trx_id}\"\n  puts \"#{op.type}: #{op.value}\"\nend\n```\n\nTo stream only certain operations:\n\n```ruby\nstream = Steem::Stream.new\n\nstream.operations(types: :vote_operation) do |op|\n  puts \"#{op.type}: #{op.value}\"\nend\n```\n\nOr pass an array of certain operations:\n\n```ruby\nstream = Steem::Stream.new\n\nstream.operations(types: [:comment_operation, :vote_operation]) do |op|\n  puts \"#{op.type}: #{op.value}\"\nend\n```\n\nOr (optionally) just pass the operation(s) you want as the only arguments.  This is semantic sugar for when you want specific types and take all of the defaults.\n\n```ruby\nstream = Steem::Stream.new\n\nstream.operations(:vote_operation) do |op|\n  puts \"#{op.type}: #{op.value}\"\nend\n```\n\nTo also include virtual operations:\n\n```ruby\nstream = Steem::Stream.new\n\nstream.operations(include_virtual: true) do |op|\n  puts \"#{op.type}: #{op.value}\"\nend\n```\n\n### Multisig\n\nYou can use multisignature to broadcast an operation.\n\n```ruby\nparams = {\n  voter: voter,\n  author: author,\n  permlink: permlink,\n  weight: weight\n}\n\nSteem::Broadcast.vote(wif: [wif1, wif2], params: params) do |result|\n  puts result\nend\n```\n\nIn addition to signing with multiple `wif` private keys, it is possible to also export a partially signed transaction to have signing completed by someone else.\n\n```ruby\nbuilder = Steem::TransactionBuilder.new(wif: wif1)\n\nbuilder.put(vote: {\n  voter: voter,\n  author: author,\n  permlink: permlink,\n  weight: weight\n})\n\ntrx = builder.sign.to_json\n\nFile.open('trx.json', 'w') do |f|\n  f.write(trx)\nend\n```\n\nThen send the contents of `trx.json` to the other signing party so they can privately sign and broadcast the transaction.\n\n```ruby\ntrx = open('trx.json').read\nbuilder = Steem::TransactionBuilder.new(wif: wif2, trx: trx)\napi = Steem::CondenserApi.new\ntrx = builder.transaction\napi.broadcast_transaction_synchronous(trx)\n```\n\n### Get Accounts\n\n```ruby\napi = Steem::DatabaseApi.new\n\napi.find_accounts(accounts: ['steemit', 'alice']) do |result|\n  puts result.accounts\nend\n```\n\n*See: [Api](https://www.rubydoc.info/gems/steem-ruby/Steem/Api)*\n\n### Reputation Formatter\n\n```ruby\nrep = Steem::Formatter.reputation(account.reputation)\nputs rep\n```\n\n### Tests\n\n* Clone the client repository into a directory of your choice:\n  * `git clone https://github.com/steemit/steem-ruby.git`\n* Navigate into the new folder\n  * `cd steem-ruby`\n* All tests can be invoked as follows:\n  * `bundle exec rake test`\n* To run `static` tests:\n  * `bundle exec rake test:static`\n* To run `broadcast` tests (broadcast is simulated, only `verify` is actually used):\n  * `bundle exec rake test:broadcast`\n* To run `threads` tests (which quickly verifies thread safety):\n  * `bundle exec rake test:threads`\n* To run `testnet` tests (which does actual broadcasts)\n  * `TEST_NODE=https://testnet.steemitdev.com bundle exec rake test:testnet`\n\nYou can also run other tests that are not part of the above `test` execution:\n\n* To run `block_range`, which streams blocks (using `json-rpc-batch`)\n  * `bundle exec rake stream:block_range`\n\n\nIf you want to point to any node for tests, instead of letting the test suite pick the default, set the environment variable to `TEST_NODE`, e.g.:\n\n```bash\n$ TEST_NODE=https://api.steemitdev.com bundle exec rake test\n```\n\n## Contributions\n\nPatches are welcome! Contributors are listed in the `steem-ruby.gemspec` file. Please run the tests (`rake test`) before opening a pull request and make sure that you are passing all of them. If you would like to contribute, but don't know what to work on, check the issues list.\n\n## Issues\n\nWhen you find issues, please report them!\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsteemit%2Fsteem-ruby","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsteemit%2Fsteem-ruby","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsteemit%2Fsteem-ruby/lists"}