Skip to content

edescourtis/ebitcoind

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#ebitcoind

Erlang to Bitcoind API based off API documentation @ https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_calls_list

Linux or Mac is required to run this, Windows is not supported as of yet.

Steps

  1. First create a bitcoin configuration in your home directory that contains the following example
rpcuser=bitcoinrpc
rpcpassword=changeme
server=1
  1. Start the daemon by typing
bitcoind -daemon
  1. Start erlang

Usage

1> {ok,Pid} = ebitcoind:start_link().
{ok,<0.177.0>}
2> ebitcoind:getbalance(Pid).
8437.02478294
3> ebitcoind:getinfo(Pid).
{ok, #{<<"balance">> => 8437.02478294,
  <<"blocks">> => 260404,
  <<"connections">> => 8,
  <<"difficulty">> => 148819199.80509263,
  <<"errors">> => <<>>,
  <<"keypoololdest">> => 1420307921,
  <<"keypoolsize">> => 102,
  <<"paytxfee">> => 0.0,
  <<"protocolversion">> => 70002,
  <<"proxy">> => <<>>,
  <<"relayfee">> => 1.0e-5,
  <<"testnet">> => false,
  <<"timeoffset">> => -3,
  <<"version">> => 90300,
  <<"walletversion">> => 60000}}
4> ebitcoind:setgenerate(Pid,true).
{ok, null}

OR you can specify connection information as start_link argument

1> {ok,Pid} = ebitcoind:start_link(<<"http://rpcuser:rpcpassword@host:port">>).
{ok,<0.177.0>}