haskoin-store: Storage and index for Bitcoin and Bitcoin Cash

[ bitcoin, finance, library, mit, network, program ] [ Propose Tags ]

Store blocks, transactions, and balances for Bitcoin or Bitcoin Cash, and make that information via REST API.


[Skip to Readme]

Modules

[Last Documentation]

  • Network
    • Haskoin
      • Network.Haskoin.Store

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1.0, 0.1.1, 0.1.2, 0.1.3, 0.2.0, 0.2.1, 0.2.2, 0.2.3, 0.3.0, 0.3.1, 0.4.0, 0.4.1, 0.4.2, 0.5.0, 0.6.0, 0.6.1, 0.6.2, 0.6.3, 0.6.4, 0.6.5, 0.6.6, 0.6.7, 0.6.8, 0.6.9, 0.7.0, 0.8.0, 0.8.1, 0.9.0, 0.9.1, 0.9.2, 0.9.3, 0.10.0, 0.10.1, 0.11.0, 0.11.1, 0.11.2, 0.12.0, 0.13.0, 0.13.1, 0.14.0, 0.14.1, 0.14.2, 0.14.3, 0.14.4, 0.14.5, 0.14.6, 0.14.7, 0.14.8, 0.14.9, 0.15.0, 0.15.1, 0.15.2, 0.16.0, 0.16.1, 0.16.2, 0.16.3, 0.16.4, 0.16.5, 0.16.6, 0.17.0, 0.17.1, 0.17.2, 0.18.0, 0.18.1, 0.18.2, 0.18.3, 0.18.4, 0.18.5, 0.18.6, 0.18.7, 0.18.8, 0.18.9, 0.18.10, 0.18.11, 0.19.0, 0.19.2, 0.19.3, 0.19.4, 0.19.5, 0.20.0, 0.20.1, 0.20.2, 0.21.0, 0.21.1, 0.21.2, 0.21.3, 0.21.4, 0.21.5, 0.21.6, 0.21.7, 0.22.0, 0.22.1, 0.22.2, 0.22.3, 0.22.4, 0.22.5, 0.23.0, 0.23.1, 0.23.2, 0.23.3, 0.23.4, 0.23.5, 0.23.6, 0.23.7, 0.23.8, 0.23.9, 0.23.10, 0.23.11, 0.23.12, 0.23.13, 0.23.14, 0.23.15, 0.23.16, 0.23.18, 0.23.19, 0.23.20, 0.23.21, 0.23.22, 0.23.23, 0.24.0, 0.25.1, 0.25.2, 0.25.3, 0.25.4, 0.26.0, 0.26.1, 0.26.2, 0.26.3, 0.26.4, 0.26.5, 0.26.6, 0.27.0, 0.28.0, 0.29.0, 0.29.1, 0.29.3, 0.30.0, 0.30.1, 0.31.0, 0.32.0, 0.32.1, 0.32.2, 0.32.3, 0.33.0, 0.33.1, 0.34.0, 0.34.1, 0.34.2, 0.34.3, 0.34.4, 0.34.5, 0.34.6, 0.34.7, 0.35.0, 0.35.1, 0.35.2, 0.36.0, 0.36.2, 0.36.4, 0.37.0, 0.37.1, 0.37.2, 0.37.3, 0.37.4, 0.37.5, 0.38.0, 0.38.1, 0.38.2, 0.38.3, 0.38.4, 0.39.0, 0.40.0, 0.40.1, 0.40.2, 0.40.3, 0.40.4, 0.40.5, 0.40.6, 0.40.7, 0.40.8, 0.40.9, 0.40.10, 0.40.11, 0.40.12, 0.40.13, 0.40.14, 0.40.15, 0.40.16, 0.40.17, 0.40.18, 0.40.19, 0.40.20, 0.40.21, 0.40.22, 0.41.0, 0.41.1, 0.41.2, 0.41.3, 0.42.0, 0.42.1, 0.42.2, 0.42.3, 0.43.0, 0.43.1, 0.44.0, 0.45.0, 0.46.0, 0.46.1, 0.46.2, 0.46.3, 0.46.4, 0.46.5, 0.46.6, 0.47.0, 0.47.1, 0.47.2, 0.47.3, 0.47.4, 0.47.5, 0.47.6, 0.48.0, 0.49.0, 0.50.0, 0.50.1, 0.50.2, 0.50.3, 0.51.0, 0.52.0, 0.52.1, 0.52.2, 0.52.3, 0.52.4, 0.52.5, 0.52.6, 0.52.7, 0.52.8, 0.52.9, 0.52.10, 0.52.11, 0.52.12, 0.52.13, 0.53.0, 0.53.1, 0.53.2, 0.53.3, 0.53.4, 0.53.5, 0.53.6, 0.53.8, 0.53.9, 0.53.10, 0.53.11, 0.55.0, 0.56.0, 0.57.0, 0.58.0, 0.59.0, 0.60.0, 0.61.0, 0.61.1, 0.62.0, 0.62.1, 0.64.0, 0.64.1, 0.64.2, 0.64.3, 0.64.4, 0.64.5, 0.64.6, 0.64.7, 0.64.8, 0.64.10, 0.64.11, 0.64.12, 0.64.13, 0.64.14, 0.64.15, 0.64.16, 0.64.17, 0.64.18, 0.64.19, 0.65.0, 0.65.1, 0.65.2, 0.65.3, 0.65.5, 0.65.6, 0.65.7, 0.65.8, 0.65.9, 0.65.10, 1.0.0, 1.0.1, 1.1.0, 1.2.0, 1.2.1, 1.2.2, 1.2.3, 1.2.4, 1.2.5, 1.3.0, 1.4.0
Change log CHANGELOG.md
Dependencies aeson, base (>=4.7 && <5), bytestring, cereal, conduit, containers, directory, filepath, haskoin-core, haskoin-node, haskoin-store, hspec, http-types, monad-logger, mtl, network, nqe, optparse-applicative, random, rocksdb-haskell, rocksdb-query, scotty, string-conversions, text, time, transformers, unliftio [details]
License LicenseRef-PublicDomain
Author Jean-Pierre Rupp
Maintainer xenog@protonmail.com
Category Bitcoin, Finance, Network
Home page http://github.com/haskoin/haskoin#readme
Bug tracker http://github.com/haskoin/haskoin/issues
Source repo head: git clone https://github.com/haskoin/haskoin.git
Uploaded by xenog at 2018-09-09T22:08:54Z
Distributions
Executables haskoin-store
Downloads 260196 total (633 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs not available [build log]
All reported builds failed as of 2018-09-10 [all 3 reports]

Readme for haskoin-store-0.1.0

[back to package description]

Haskoin Store

Full blockchain index & store featuring:

  • Address index.
  • Mempool.
  • Persistent storage using RocksDB.
  • RESTful endpoints for blockchain data.
  • Concurrent design.
  • No blocking on database access.
  • Guaranteed consistency within a request.
  • Atomic updates to prevent corruption.

Install

  • Get Stack.
  • Get Nix.
  • Clone this repository git clone https://github.com/haskoin/haskoin-store.
  • From the root of this repository run stack --nix build --copy-bins.
  • File will usually be installed in ~/.local/bin/haskoin-store.

API Documentation

Addresses & Balances

For every address Haskoin Store has a balance object that contains basic statistics about the address. These statistics are described below.

  • confirmed balance is that which is in the blockchain. Will always be positive or zero.
  • unconfirmed balance represent aggregate changes done by mempool transactions. Can be negative if the transactions currently in the mempool are expected to reduce the balance when all of them make it into the blockchain.
  • outputs is the count of outputs that send funds to this address. It is just a count and not a monetary value.
  • utxo is the count of outputs that send funds to this address that remain unspent, taking the mempool into account: if spent in the mempool it will not count as unspent.

Limits

Various endpoints in the API will have both server and per-query limits to avoid overloading the server. Depending on the type of query being done the limits have varying effects.

Multiple Objects in URI

If specifying multiple objects in the URI, for example when obtaining the balances for multiple addresses, no more than 500 elements may be requested.

If each object specified in the URI might lead to multiple results, these will be concatenated in the response, such that the first set of elements will correspond to the first requested item that yields any results, and the last set of elements will correspond to the last requested item that yields results, assuming that the number of returned items has not exceeded the count limit.

Count Limit

The count limit is set by default at 10,000 server-wide. It may be changed via the server command line or for an individual request. The individual request limit may not be value larger than the server’s.

If the number of available results exceeds the count limit, and if stopping at exactly the limit would lead to a result set that would be partial for a block in the blockchain, any extra items that belong to the same block as the last element that fits within the limit will be appended to the results, exceeding the count limit.

When multiple objects are present in the URI and the result set exceeds the count limit, and stopping at the limit would lead to a partial result set for a requested item and block in the blockchain, any extra elements that pertain to the same item and block as the last element that fits within the limit will be appended.

The mempool is considered as a single block for count limit calculation purposes.

In short, a block worth of relevant data—or the mempool—will always be delivered in its entirety, regardless of the count limit.

Height Limit

When delivering multiple results, Haskoin Store will start with data from the mempool, and then data from the highest block in the chain, followed by its parent, and so on until reaching the genesis block, or the count limit. Results are returned in reversed order from highest (latest) to lowest (earliest).

If the result set count matches or exceeds the count limit, it is possible that there are more entries available below the block height of the last result returned. By specifying a height limit in the query, the result set will start at the specified height, skipping any blocks above it.

Since block data is never delivered incomplete, it suffices to subtract one to the block height of the last returned element when performing the next request. If the last returned element is not in a block, then the height of the best block should be used for the next request.