Project

sbds-rails

0.0
No commit activity in last 3 years
No release in over 3 years
Ruby on Rails Engine for accessing Steem Blockchain Data Service.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0.4.6, ~> 0.4
~> 0.10.3
~> 0.11.2

Runtime

>= 5.1.1, ~> 5.1
 Project Readme

Steem Blockchain Data Service Rails Engine

Ruby on Rails Engine for accessing Steem Blockchain Data Service.

The sbds project is the official database layer for accessing a local, read-only version of the Steem blockchain. It is developed and maintained by Steemit, Inc. and can be confugured to use SQLite, Postgres, and MySQL.

This gem allows you to access an sdbs instance with ActiveRecord.

New Features

  • Added sqlite3 and pg drivers.
  • Added scopes to simplify lookups for related transactions. E.g.:
    • Get a specific post:
      • post = Sbds::Comment.find_by(author: 'inertia', permlink: 'one-post-at-a-time')
    • Get voting transactions for the post.
      • post.votes
      • post.upvotes
      • post.downvotes
      • post.unvotes
    • Get the comment options for the post.
      • post.options
      • post.options.beneficiaries

Installation

For Existing Rails Projects

Assuming you already have an existing rails project, add this line to your application's Gemfile:

gem 'sbds-rails', require: 'sbds'

And then execute:

$ bundle install

SQLite

This assumes that the database is stored as db/sdbs.sqlite3 folder of your rails project.

Edit database.yml:

default: &default
  adapter: sqlite3
  database: sbds.sqlite3

MySQL

Edit database.yml and use your own sbds database or try out @furion's:

default: &default
  adapter: mysql2
  encoding: utf8
  pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
  username: steemit
  password: steemit
  host: sbds-mysql.steemdata.com
  database: sbds
  reconnect: true

PostgreSQL

$ createuser sbds -d --no-superuser
$ createdb -O sbds sbds

Edit database.yml:

default: &default
  adapter: postgresql
  encoding: unicode
  database: sbds
  pool: 5
  username: sbds
  password:

For New Projects

Have a look at this article on setting up a new rails project, then use the steps above to enable this plug-in.

How to Write a Ruby on Rails App for STEEM

Tests

  • Basic tests can be invoked as follows:
    • rake
  • To run tests with parallelization and local code coverage:
    • HELL_ENABLED=true rake

Get in touch!

If you're using sbds-rails, I'd love to hear from you. Drop me a line and tell me what you think! I'm @inertia on STEEM.

License

I don't believe in intellectual "property". If you do, consider sbds-rails as licensed under a Creative Commons CC0 License.