Skip to content

Instantly share code, notes, and snippets.

@torkelrogstad
Created June 12, 2019 11:23
Show Gist options
  • Save torkelrogstad/12c975961ea1ef11f566d3685233a7f8 to your computer and use it in GitHub Desktop.
Save torkelrogstad/12c975961ea1ef11f566d3685233a7f8 to your computer and use it in GitHub Desktop.
import scala.concurrent._
import akka.actor.ActorSystem
import org.bitcoins.{rpc, core}
import core.currency.Bitcoins
import rpc.client.common._
implicit val system = ActorSystem.create()
implicit val ec: ExecutionContext = system.dispatcher
// this reads authentication credentials and
// connection details from the default data
// directory on your platform
val client = BitcoindRpcClient.fromDatadir()
val balance: Future[Bitcoins] = for {
_ <- client.start()
balance <- client.getBalance
} yield balance
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment