No commit activity in last 3 years
No release in over 3 years
Provides a Ruby library to the complete Startcoin JSON-RPC API. Implements all methods listed at https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_Calls_list which is the same as Startcoin API. Lets you set options such as the host and port number, and whether to use SSL.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.3
~> 0.9
~> 2.6

Runtime

 Project Readme

startcoin-client¶ ↑

Provides a Ruby library to the complete Startcoin JSON-RPC API. Implements all methods listed at en.bitcoin.it/wiki/Original_Bitcoin_client/API_Calls_list. Also supports customizing the host and port number to connect to.

Installation¶ ↑

To install gem just add this entry to your Gemfile

gem 'startcoin-client'
gem 'json', '~> 1.5.3' # For Ruby < 1.9

Usage¶ ↑

As with most Ruby gems, you first need to require the library into your project:

require 'startcoin_client'

After doing this, the simplest possible usage looks like this:

StartcoinClient('username', 'password').balance
# => 0.001

Or, if you prefer a somewhat more explicit representation, the following code performs the exact same task:

client = StartcoinClient::Client.new('username', 'password')
client.balance
# => 0.001

The RPC method names available to you are exactly the same as those listed on the Startcoin wiki (again, that’s en.bitcoin.it/wiki/Original_Startcoin_client/API_Calls_list). Some aliases have been added to make them more “ruby-ish,” but none of the original names have been changed.

Host, Port, SSL, Proxy¶ ↑

Here are several examples of how you can change the host and proxy information:

StartcoinClient('username', 'password', :host => 'example.com', :port => 38332, :ssl => true, :proxy => 'http://someproxy.com')

client = StartcoinClient::Client.new('username', 'password', :host => 'example.com')
client.port = 38332
client.proxy = 'http://someproxy.com'
client.ssl = true
client.ssl?
# => true

You should see the StartcoinClient::Client class documentation if you’d like to see the other options and methods that are made available.

Test environment¶ ↑

It’s highly recommended to not connect StartcoinClient to live network, but instead use local testnet. One possibility is to use docker image called bitcoin-testnet-box (github.com/freewil/bitcoin-testnet-box). For installation process please follow instructions on its wiki page.

After successful instalation you can connect to wallets with following commands

StartcoinClient('admin1', '123', :host => '127.0.0.1', :port => 19001)
StartcoinClient('admin2', '123', :host => '127.0.0.1', :port => 19011)

At this point you can use regular RPC methods provided in API