{"id":13879806,"url":"https://github.com/astroband/ruby-stellar-base","last_synced_at":"2025-07-16T15:33:07.640Z","repository":{"id":26757846,"uuid":"30215715","full_name":"astroband/ruby-stellar-base","owner":"astroband","description":"The stellar-base library is the lowest-level stellar helper library. It consists of classes to read, write, hash, and sign the xdr structures that are used in stellar-core","archived":true,"fork":false,"pushed_at":"2020-09-02T20:46:10.000Z","size":563,"stargazers_count":22,"open_issues_count":0,"forks_count":19,"subscribers_count":20,"default_branch":"master","last_synced_at":"2024-08-07T08:13:19.540Z","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":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/astroband.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-02-03T00:03:44.000Z","updated_at":"2023-01-28T13:01:00.000Z","dependencies_parsed_at":"2022-07-17T03:00:33.689Z","dependency_job_id":null,"html_url":"https://github.com/astroband/ruby-stellar-base","commit_stats":null,"previous_names":[],"tags_count":49,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/astroband%2Fruby-stellar-base","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/astroband%2Fruby-stellar-base/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/astroband%2Fruby-stellar-base/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/astroband%2Fruby-stellar-base/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/astroband","download_url":"https://codeload.github.com/astroband/ruby-stellar-base/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226143895,"owners_count":17580245,"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-06T08:02:34.079Z","updated_at":"2024-11-24T08:31:49.056Z","avatar_url":"https://github.com/astroband.png","language":"Ruby","funding_links":[],"categories":["Ruby"],"sub_categories":[],"readme":"**`stellar-base` is now maintained in the [astroband/ruby-stellar-sdk](https://github.com/astroband/ruby-stellar-sdk) repository.**\n\n----\n[![Build Status](https://travis-ci.org/stellar/ruby-stellar-base.svg)](https://travis-ci.org/stellar/ruby-stellar-base)\n[![Code Climate](https://codeclimate.com/github/stellar/ruby-stellar-base/badges/gpa.svg)](https://codeclimate.com/github/stellar/ruby-stellar-base)\n\nThe stellar-base library is the lowest-level stellar helper library.  It consists of classes\nto read, write, hash, and sign the xdr structures that are used in stellard.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'stellar-base'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install stellar-base\n\nAlso requires libsodium. Installable via `brew install libsodium` on OS X.\n\n## Supported Ruby Versions\n\nPlease see [travis.yml](.travis.yml) for what versions of ruby are currently tested by our continuous integration system.  Any ruby in that list is officially supported.\n\n### JRuby\n\nIt seems as though jruby is particularly slow when it comes to BigDecimal math; the source behind this slowness has not been investigated, but it is something to be aware of.\n\n## Usage\n\n[Examples are here](examples)\n\nIn addition to the code generated from the XDR definition files (see [ruby-xdr](https://github.com/stellar/ruby-xdr) for example usage), this library also provides some stellar specific features.  Let's look at some of them.\n\nWe wrap rbnacl with `Stellar::KeyPair`, providing some stellar specific functionality as seen below:\n\n```ruby\n\n# Create a keypair from a stellar secret seed\nsigner = Stellar::KeyPair.from_seed(\"SCBASSEX34FJNIPLUYQPSMZHHYXXQNWOOV42XYZFXM6EGYX2DPIZVIA3\")\n\n# Create a keypair from a stellar address\nverifier = Stellar::KeyPair.from_address(\"GBQWWBFLRP3BXD2RI2FH7XNNU2MKIYVUI7QXUAIVG34JY6MQGXVUO3RX\")\n\n# Produce a stellar compliant \"decorated signature\" that is compliant with stellar transactions\n\nsigner.sign_decorated(\"Hello world!\") # =\u003e #\u003cStellar::DecoratedSignature ...\u003e\n\n```\n\nThis library also provides an impementation of Stellar's \"StrKey\" encoding (RFC-4648 Base32 + CCITT-XModem CRC16):\n\n```ruby\n\nStellar::Util::StrKey.check_encode(:account_id, \"\\xFF\\xFF\\xFF\\xFF\\xFF\\xFF\\xFF\") # =\u003e \"GD777777777764TU\"\nStellar::Util::StrKey.check_encode(:seed, \"\\x00\\x00\\x00\\x00\\x00\\x00\\x39\") # =\u003e \"SAAAAAAAAAADST3H\"\n\n# To prevent interpretation mistakes, you must pass the expected version byte\n# when decoding a check_encoded value\n\nencoded = Stellar::Util::StrCheck.check_encode(:account_id, \"\\x61\\x6b\\x04\\xab\\x8b\\xf6\\x1b\")\nStellar::Util::StrKey.check_decode(:account_id, encoded) # =\u003e \"\\x61\\x6b\\x04\\xab\\x8b\\xf6\\x1b\"\nStellar::Util::StrKey.check_decode(:seed, encoded) # =\u003e throws ArgumentError: Unexpected version: :account_id\n\n```\n\nDuring development of your app, you may include the [FactoryBot](https://github.com/thoughtbot/factory_bot) definitions in your specs:\n\n```ruby\nrequire \"stellar-base/factories\"\n```\n\nSee the factories file for information on what factories are available.\n\n## Updating Generated Code\n\nThe generated code of this library must be refreshed each time the Stellar network's protocol is updated.  To perform this task, run `rake xdr:update`, which will download the latest `.x` files into the `xdr` folder and will run `xdrgen` to regenerate the built ruby code.\n\n## Caveats\n\nThe current integration of user-written code with auto-generated classes is to put it nicely, weird.  We intend to segregate the auto-generated code into its own namespace and refrain from monkey patching them.  This will happen before 1.0, and hopefully will happen soon.\n\n## Contributing\n\nPlease [see CONTRIBUTING.md for details](CONTRIBUTING.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fastroband%2Fruby-stellar-base","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fastroband%2Fruby-stellar-base","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fastroband%2Fruby-stellar-base/lists"}