bitcoin-client

bitcoin client library for price ticker and wallet

git clone https://9o.is/git/bitcoin-client.git

commit f042b3eea5c2b6a69da036675b67493e8dfe245e
parent d9552641c1c5f12487146159b9f77663407f34dc
Author: Jul <jul@9o.is>
Date:   Tue, 18 Nov 2014 07:04:43 +0000

readme edit
Diffstat:
MREADME.md | 46+++++++++++++++++++++++++++++++++++++++++++---
1 file changed, 43 insertions(+), 3 deletions(-)

diff --git a/README.md b/README.md @@ -1,4 +1,44 @@ -Bitcoin Library -==================== +# Bitcoin Client Library -Provides several client-side bitcoin services such as price ticker, wallet and more. +Provides several client-side bitcoin services such as price ticker and wallet. + +---- +## usage examples + +Retrieve bitcoin address balance using Blockchain service. + + import akka.actor._ + import akka.pattern._ + import com.typesafe.config._ + import scala.concurrent.duration._ + import inc.pyc.bitcoin._, BitcoinJsonRPC._ + + val props = BitcoinService.props(BitcoinService.BlockChain) + val system = ActorSystem("sys", ConfigFactory.load(ConfigFactory.parseString(""" + bitcoin.blockchain { + wallet-uri = "https://rpc.blockchain.info" + rpc-user = "<blockchain wallet identifier>" + rpc-pass = "<blockchain password>" + wallet-pass = "<blockchain second password>" + } + """))) + + import system.dispatcher + val wallet = system.actorOf(props) + val balance = wallet.ask(GetBalance)(5 seconds).mapTo[String] + balance.foreach(println) + +Retrieve bitcoin price using BitStamp service. + + import akka.actor._ + import akka.pattern._ + import scala.concurrent.duration._ + import inc.pyc.bitcoin._ + + val props = BitcoinService.props(BitcoinService.BitStamp) + val system = ActorSystem("sys") + + import system.dispatcher + val ticker = system.actorOf(props) + val price = ticker.ask(Tick)(5 seconds).mapTo[Price] + price.foreach(p => println(p.format))