Ruby

Getting started

Ensure you have a recent version of Ruby installed.

  1. Install libsecp256k1 as described here.

  2. Add the gem to your Gemfile:

gem 'money-tree', git: 'https://github.com/bluzelle/money-tree'
gem 'bitcoin-secp256k1', git: 'git@github.com:cryptape/ruby-bitcoin-secp256k1'
gem 'bluzelle', git: 'https://github.com/bluzelle/blzrb'
  1. Then install:

bundle install
  1. Use:

require "bluzelle"

client = Bluzelle::new_client({
  "address" =>  "...",
  "mnemonic" => "...",
  "uuid" => "bluzelle",
  "endpoint" => "http://dev.testnet.public.bluzelle.com:1317",
})

key = 'foo'
gas_info = {
  'max_fee' => 4000001,
}

client.create key, 'bar', gas_info
value = client.read key
client.update key, 'baz', gas_info
client.delete key, gas_info

Examples

Copy .env.sample to .env and configure if needed.

cp .env.sample .env

Then run the example:

DEBUG=false LIBRESSL_REDIRECT_STUB_ABORT=0 bundle exec ruby examples/crud.rb

Tests

Configure env as described in the examples section above.

bundle exec rspec --format documentation

User Acceptance Testing

Please checkout the UAT.md document for more details.

Abort 6 error

If you encounter this error, you either might have to:

Licence

MIT

Last updated