0.0
Repository is archived
No commit activity in last 3 years
No release in over 3 years
Ruby client consumes Factom (factom.org) API.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Runtime

>= 0.0.7
>= 3.3.0
~> 1.8.0
 Project Readme

Ruby Client for Factom

A ruby client who talks to factomd in Factom project.

Features

  • Encode/decode messages for you
  • Independent, work without fctwallet and factom-cli
  • No account management, use factom-cli for that purpose

Install

gem i factom-ruby

or

Add it to your Gemfile:

gem 'factom-ruby'

Usage

require 'factom-ruby'

ec_private_key = '0000000000000000000000000000000000000000000000000000000000000000'
f = Factom::Client.new('http://factomd.node.ip:8088', ec_private_key)

#################
# get some info #
#################

p f.properties
p f.fee

################
# get balances #
################

fa_address = 'FAblahblah...' # Factoid address
fa_pubkey = f.address_to_pubkey fa_address
p f.fa_balance_in_decimal(fa_pubkey)

f.ec_address # EntryCredit address, calculated automatically from ec_private_key
p f.ec_balance_in_decimal # default to balance on f.ec_address

###########################################################################
# create a new chain, remember to choose a unique chain names combination #
###########################################################################

resp = f.commit_chain %w(three body problem), "the world belongs to ???"
puts "resp code: #{resp.code} body: #{resp.body}"
resp = f.reveal_chain %w(three body problem), "the world belongs to ???"
puts "resp code: #{resp.code} body: #{resp.body}"

######################
# submit a new entry #
######################

resp = f.commit_entry(some_chain_id, %w(chapter1), "once upon a time ...")
puts "resp code: #{resp.code} body: #{resp.body}"
resp = f.reveal_entry(some_chain_id, %w(chapter1), "once upon a time ...")
puts "resp code: #{resp.code} body: #{resp.body}"

Check examples directory for more examples.

License

MIT License