Skip to content

Commit

Permalink
Merge pull request #46 from bitcoinprivacy/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
JorgeMartinezPizarro authored Dec 10, 2017
2 parents cd6b638 + 7f3ed97 commit 2da2289
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 16 deletions.
4 changes: 2 additions & 2 deletions README.org
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,10 @@ changed in the config.
*** API

#+BEGIN_SRC sh
bgeapi [port]
bgeapi [-Dapi.port=PORT] [-Dapi.mode=development]
#+END_SRC

starts the api on localhost, default port is 8080.
starts the api on localhost, default port is 8080, default mode is production.

These are all available queries:

Expand Down
4 changes: 2 additions & 2 deletions api/project/build.scala
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import com.earldouglas.xwp.ContainerPlugin.autoImport._
object BgeapiBuild extends Build {
val Organization = "net.bitcoinprivacy"
val Name = "bgeapi"
val Version = "3.2.1"
val Version = "3.3"
val ScalaVersion = "2.11.8"
val ScalatraVersion = "2.4.0"

Expand All @@ -36,7 +36,7 @@ object BgeapiBuild extends Build {
"org.eclipse.jetty" % "jetty-webapp" % "9.2.15.v20160210" % "container;compile",
"javax.servlet" % "javax.servlet-api" % "3.1.0" % "provided"
),
containerPort in Jetty := 8081,
// containerPort in Jetty := 8081,
scalateTemplateConfig in Compile <<= (sourceDirectory in Compile){ base =>
Seq(
TemplateConfig(
Expand Down
2 changes: 2 additions & 0 deletions api/src/main/resources/reference.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
api.port=8080
api.mode=production
6 changes: 3 additions & 3 deletions api/src/main/scala/api/models/Movement.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import scala.slick.driver.PostgresDriver.simple._

import util.Hash

case class Movement(tx: String, value:Long, spentInTx: String, address: String)
case class Movement(tx: String, value:Long, spentInTx: String, address: String, blockHeightIn: Int, blockHeightOut: Int)

case class MovementsSummary(sum: Long, count: Long, minHeight: Int, maxHeight: Int)

Expand All @@ -26,9 +26,9 @@ object Movement extends db.BitcoinDB {
DB withSession { implicit session =>

val inputs = for (b<-movements filter f drop from take (until-from))
yield (b.transaction_hash, b.value, b.spent_in_transaction_hash, b.address)
yield (b.transaction_hash, b.value, b.spent_in_transaction_hash, b.address, b.height_in, b.height_out)

inputs.run map (p => Movement(Hash(p._1).toString, p._2, Hash(p._3).toString, Address.hashToAddress(p._4)))
inputs.run map (p => Movement(Hash(p._1).toString, p._2, Hash(p._3).toString, Address.hashToAddress(p._4), p._5, p._6))

}

Expand Down
10 changes: 5 additions & 5 deletions api/src/main/scala/api/models/UTXO.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import scala.slick.driver.PostgresDriver.simple._

import util.Hash

case class UTXO(tx: String, value:Long, address: String)
case class UTXO(tx: String, value:Long, address: String, blockHeight: Int)
case class UTXOsSummary(count : Int, sum: Long, minHeight: Int, maxHeight: Int)

object UTXO extends db.BitcoinDB{
Expand All @@ -14,9 +14,9 @@ object UTXO extends db.BitcoinDB{
val ad = Address.hashToAddress(address)

val utxos = for (b<- utxo.filter(_.address===address).drop(from).take(until-from))
yield (b.transaction_hash ,b.value)
yield (b.transaction_hash ,b.value, b.block_height)

utxos.run map (p => UTXO(Hash(p._1).toString, p._2, ad))
utxos.run map (p => UTXO(Hash(p._1).toString, p._2, ad, p._3))

}

Expand All @@ -25,9 +25,9 @@ object UTXO extends db.BitcoinDB{
val tx = Hash(transactionHash).toString

val outputsFromUTXOS = for (b<-utxo.filter(_.transaction_hash===transactionHash).drop(from).take(until-from))
yield (b.address, b.value)
yield (b.address, b.value, b.block_height)

outputsFromUTXOS.run map (p => UTXO(tx, p._2, Address.hashToAddress(p._1)))
outputsFromUTXOS.run map (p => UTXO(tx, p._2, Address.hashToAddress(p._1), p._3))

}

Expand Down
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ organization := "net.bitcoinprivacy"

name := "bge"

version := "3.2.1"
version := "3.3"

scalaVersion := "2.11.8"

Expand Down
3 changes: 0 additions & 3 deletions src/main/resources/reference.conf
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,5 @@ host = "localhost"
jdbcOptions = "?useServerPrepStmts=false&rewriteBatchedStatements=true&maxWait=-1"
mdb.path = ${dataDir}"mdb/"
mdb.transactionSize = 100000
api.port=8081
api.mode="production"


logger.scala.slick=ERROR

0 comments on commit 2da2289

Please sign in to comment.