Bitcoin Implementation in Scala
Go to file
Chris Stewart dc4def1d7f Bump scalac to 2.12.8 (#340)
* Bump scalac to 2.12.8

* Bump scalac in .travis.yml
2019-02-16 14:52:04 -06:00
bench rm usage of getSimpleName, as it breaks logback logging schemes (#322) 2019-02-03 10:51:31 -06:00
core Fix initialization problem with LnInvoice and the separator char (#334) 2019-02-14 07:16:15 -06:00
core-test Add bitcoin-s unit test class, all unit tests going forward should extend this (#335) 2019-02-15 07:13:33 -06:00
doc Add secp256k1jni readme, start working main project readme, move old readme to core/README.md (#276) 2019-01-08 09:29:06 -06:00
eclair-rpc Make start methods return Future[Unit] (#328) 2019-02-07 19:58:18 -06:00
project Make start methods return Future[Unit] (#328) 2019-02-07 19:58:18 -06:00
rpc Make start methods return Future[Unit] (#328) 2019-02-07 19:58:18 -06:00
secp256k1@2e16ac7d6c Changing TxSigComponent to take a TransactionOutput instead of a ScriptPubKey, refactoring ScriptProgram into 3 companion objects PreExecutionScriptProgram, ExecutionInProgressScriptProgram, ExecutedScriptProgram 2018-05-19 09:25:32 -05:00
secp256k1jni updates osx binaries (#308) 2019-01-28 09:55:56 -06:00
testkit Make start methods return Future[Unit] (#328) 2019-02-07 19:58:18 -06:00
zmq/src Added scalafmt and ran it (#264) 2018-12-09 14:43:31 -05:00
.gitignore Adding secp256k1 project, modifying .travis.yml file to try and build secp256k1 2017-02-21 09:09:53 -06:00
.gitmodules Adding specific commit for secp256k1 2018-04-25 16:44:48 -05:00
.scalafmt.conf Added scalafmt and ran it (#264) 2018-12-09 14:43:31 -05:00
build.sbt Add bitcoin-s unit test class, all unit tests going forward should extend this (#335) 2019-02-15 07:13:33 -06:00
CONTRIBUTING.md Adds Bitcoin-S static site (#299) 2019-01-18 06:34:27 -06:00
inThisBuild.sbt Bump scalac to 2.12.8 (#340) 2019-02-16 14:52:04 -06:00
LICENSE updating license 2018-01-17 17:15:18 -06:00
README.md Adds README notes on how to add Bitcoin-S in Ammonite (#300) 2019-01-21 07:12:03 -06:00

Build Status Coverage Status IRC NetworkGitter chat

Bitcoin-S

Design Principles

  • Immutable data structures everywhere
  • Algebraic Data Types to allow the compiler to check for exhaustiveness on match statements
  • Using property based testing to test robustness of code
  • Minimize dependencies to reduce attack surface

Projects

  1. core - this is where protocol data structures live, like Transactions, Blocks, or PrivateKeys. For more info read core/README.md

  2. core-test - this is where all test cases for the core project live

  3. rpc - this is a RPC client implementation for bitcoind. For more info read rpc/README.md

  4. eclair-rpc - this is a RPC client implementation for Eclair, which is a Lightning Network implementation. For more information please read eclair-rpc/README.md

  5. bench - benchmarks for Bitcoin-S. For more information please read bench/README.md

  6. testkit - This is a useful testkit for testing Bitcoin related applications. You can spin up Bitcoin and Lightning nodes arbitrarily and set them in specific states. For more information please read testkit/README.md

  7. zmq - bitcoind has a setting that publishes information about the state of the network over ZMQ. This project implements a subscriber that allows you to read and parse that information. For more information see zmq/README.md as well as the official Bitcoin Core ZMQ documentation

Artifacts

You need to add the Bitcoin-S Bintray to your resolvers to be able to access published artifacts.

sbt

With sbt, this can be done like this:

resolvers += Resolver.bintrayRepo("bitcoin-s", "bitcoin-s-core"),

Now you should be able to add Bitcoin-S artifacts like this:


"org.bitcoins" % "bitcoin-s-secp256k1jni" % "0.0.3"

"org.bitcoins" %% "bitcoin-s-core" % "0.0.3" withSources() withJavadoc()

"org.bitcoins" %% "bitcoin-s-bitcoind-rpc" % "0.0.3" withSources() withJavadoc()

"org.bitcoins" %% "bitcoin-s-eclair-rpc" % "0.0.3" withSources() withJavadoc()

"org.bitcoins" %% "bitcoin-s-testkit" % "0.0.3" withSources() withJavadoc()

"org.bitcoins" %% "bitcoin-s-zmq" % "0.0.3" withSources() withJavadoc()

Ammonite

Ammonite is (among other things) a modernized Scala REPL with syntax highlighting, multi-line editing, the ability to load artifacts directly in the REPL, and many other quality-of-life improvements missing in the default Scala REPL.

Ammonite is a project by Li Haoyi, and you can get it at ammonite.io

With Ammonite, this can be done like this:

@ import coursier.MavenRepository
import coursier.MavenRepository

@ interp.repositories() ++= Seq(MavenRepository("https://dl.bintray.com/bitcoin-s/bitcoin-s-core"))

@ import $ivy.`org.bitcoins::bitcoin-s-core:0.0.3`
import $ivy.$

@ import org.bitcoins.core.currency.Bitcoins
import org.bitcoins.core.currency.Bitcoins

@ Bitcoins(10)
res0: Bitcoins = BitcoinsImpl(10) // 🎉

This is only necessary one time, Ammonite remembers your resolvers across sessions.

Published artifacts

Versioned artifacts are available online.

Snapshots (not necessarily stable, use for local development) are available at JFrog.

Tagged versions are available at Bintray.