package bitcoin

  1. Overview
  2. Docs

Module BitcoinSource

OCaml interface to the official Bitcoin client API.

Exceptions

Sourceexception Unspecified_connection
Sourceexception Bitcoin_error of int * string
Sourceexception Internal_error of int * string
Sourceexception Httpclient_error of exn

Type definitions

Sourcetype address_t = string
Sourcetype account_t = [
  1. | `Default
  2. | `Named of string
]
Sourcetype amount_t = int64
Sourcetype txid_t = string
Sourcetype txoutput_t = txid_t * int
Sourcetype blkhash_t = string
Sourcetype priv_t = string
Sourcetype sig_t = string
Sourcetype hextx_t = string
Sourcetype hexspk_t = string
Sourcetype hexblk_t = string
Sourcetype hexwork_t = string
Sourcetype multi_t = [
  1. | `Address of address_t
  2. | `Hexspk of hexspk_t
]
Sourcetype node_t = string
Sourcetype assoc_t = (string * Yojson.Safe.t) list
Sourcetype conn_t = {
  1. inet_addr : Unix.inet_addr;
  2. host : string;
  3. port : int;
  4. username : string;
  5. password : string;
}

Public module types

Sourcemodule type HTTPCLIENT = sig ... end

Interface that any module offering HTTP POST client calls must obey. Note that the module may require POST calls to be wrapped under a custom monad, which must also be provided (use the identity monad if no actual monad is required).

Sourcemodule type CONNECTION = sig ... end

Module encapsulating all connection information.

Sourcemodule type ENGINE = sig ... end

Actual engine offering the Bitcoin API.

Public functions and values

Sourceval amount_of_float : float -> amount_t

Converts a BTC quantity expressed as a float into its amount_t representation.

Sourceval float_of_amount : amount_t -> float

Converts a BTC quantity expressed as an amount_t into its float representation.

Public functors

Functor that takes a concrete implementation of a HTTPCLIENT and actual CONNECTION information, and creates a module with signature ENGINE offering an API for communicating with a Bitcoin client.

OCaml

Innovation. Community. Security.