module Make:
Bitcoin.HTTPCLIENT
and actual
Bitcoin.CONNECTION
information, and creates a module with signature Bitcoin.ENGINE
offering an API for communicating with a Bitcoin client.Parameters: |
|
type 'a
monad_t
val addnode : ?conn:Bitcoin.conn_t ->
Bitcoin.node_t -> Bitcoin.addnodeop_t -> unit monad_t
val backupwallet : ?conn:Bitcoin.conn_t -> string -> unit monad_t
val createmultisig : ?conn:Bitcoin.conn_t ->
int ->
Bitcoin.pub_t list ->
(Bitcoin.address_t * Bitcoin.hexspk_t) monad_t
createmultisig num pubs
where List.length pubs >= num
returns an address that requires the private keys of at least num
members of pubs
for spending.val createrawtransaction : ?conn:Bitcoin.conn_t ->
Bitcoin.txoutput_t list ->
(Bitcoin.address_t * Bitcoin.amount_t) list ->
Bitcoin.hextx_t monad_t
createrawtransaction inputs outputs
creates a raw transaction that transfers the given inputs
(a list of transaction outputs) to the given outputs (a list of addresses and amounts). This
function returns the hex-encoded transaction, but neither does it transmit the transaction to
the network nor does it store the transaction in the wallet. In addition, the transaction inputs
are not signed, and therefore the returned raw transaction cannot be directly transmitted to the
network with Bitcoin.ENGINE.sendrawtransaction
without it being previosuly signed with Bitcoin.ENGINE.signrawtransaction
.
A transaction fee is specified implicitly by making the total output amounts be smaller than the total input amounts (ie, fee = total inputs - total outputs).
Beware that no checks are performed concerning the validity of the transaction. If care is not taken,
it is possible to create a transaction that will not be accepted by the network, either because it
uses invalid inputs, has a greater total amount in the outputs than in the outputs, or does not offer
a sufficient transaction fee.
val decoderawtransaction : ?conn:Bitcoin.conn_t ->
Bitcoin.hextx_t -> Bitcoin.assoc_t monad_t
val dumpprivkey : ?conn:Bitcoin.conn_t ->
Bitcoin.address_t -> Bitcoin.priv_t monad_t
Bitcoin.ENGINE.importprivkey
. (Requires unlocked wallet).val encryptwallet : ?conn:Bitcoin.conn_t -> string -> unit monad_t
Bitcoin.ENGINE.walletpassphrasechange
), and operations requiring an unlocked
wallet must be preceded by a call to Bitcoin.ENGINE.walletpassphrase
.val getaccount : ?conn:Bitcoin.conn_t ->
Bitcoin.address_t -> Bitcoin.account_t monad_t
val getaccountaddress : ?conn:Bitcoin.conn_t ->
Bitcoin.account_t -> Bitcoin.address_t monad_t
val getaddednodeinfo : ?conn:Bitcoin.conn_t ->
?node:Bitcoin.node_t -> unit -> Bitcoin.assoc_t monad_t
Bitcoin.ENGINE.addnode
.val getaddednodeinfo_verbose : ?conn:Bitcoin.conn_t ->
?node:Bitcoin.node_t -> unit -> Bitcoin.assoc_t list monad_t
Bitcoin.ENGINE.addnode
.val getaddressesbyaccount : ?conn:Bitcoin.conn_t ->
Bitcoin.account_t -> Bitcoin.address_t list monad_t
val getbalance : ?conn:Bitcoin.conn_t ->
?account:Bitcoin.account_t ->
?minconf:int -> unit -> Bitcoin.amount_t monad_t
account
is provided, returns the balance available in that account.
If not, returns the total balance of all accounts.val getblock : ?conn:Bitcoin.conn_t ->
Bitcoin.blkhash_t -> Bitcoin.assoc_t monad_t
val getblockcount : ?conn:Bitcoin.conn_t -> unit -> int monad_t
val getblockhash : ?conn:Bitcoin.conn_t -> int -> Bitcoin.blkhash_t monad_t
val getblocktemplate : ?conn:Bitcoin.conn_t ->
?obj:Bitcoin.assoc_t -> unit -> Bitcoin.assoc_t monad_t
val getconnectioncount : ?conn:Bitcoin.conn_t -> unit -> int monad_t
val getdifficulty : ?conn:Bitcoin.conn_t -> unit -> float monad_t
val getgenerate : ?conn:Bitcoin.conn_t -> unit -> bool monad_t
val gethashespersec : ?conn:Bitcoin.conn_t -> unit -> int monad_t
val getinfo : ?conn:Bitcoin.conn_t -> unit -> Bitcoin.assoc_t monad_t
val getmininginfo : ?conn:Bitcoin.conn_t -> unit -> Bitcoin.assoc_t monad_t
val getnewaddress : ?conn:Bitcoin.conn_t ->
?account:Bitcoin.account_t ->
unit -> Bitcoin.address_t monad_t
account
is specified, the returned address is
associated with that account. If not, the address is associated with the default account.val getpeerinfo : ?conn:Bitcoin.conn_t -> unit -> Bitcoin.assoc_t list monad_t
val getrawmempool : ?conn:Bitcoin.conn_t -> unit -> Bitcoin.txid_t list monad_t
val getrawtransaction : ?conn:Bitcoin.conn_t ->
Bitcoin.txid_t -> Bitcoin.hextx_t monad_t
val getrawtransaction_verbose : ?conn:Bitcoin.conn_t ->
Bitcoin.txid_t -> Bitcoin.assoc_t monad_t
Bitcoin.ENGINE.gettransaction
.val getreceivedbyaccount : ?conn:Bitcoin.conn_t ->
?minconf:int -> Bitcoin.account_t -> Bitcoin.amount_t monad_t
Bitcoin.ENGINE.getbalance
for that purpose.val getreceivedbyaddress : ?conn:Bitcoin.conn_t ->
?minconf:int -> Bitcoin.address_t -> Bitcoin.amount_t monad_t
val gettransaction : ?conn:Bitcoin.conn_t ->
Bitcoin.txid_t -> Bitcoin.assoc_t monad_t
val gettxout : ?conn:Bitcoin.conn_t ->
?includemempool:bool ->
Bitcoin.txoutput_t -> Bitcoin.assoc_t monad_t
val gettxoutsetinfo : ?conn:Bitcoin.conn_t -> unit -> Bitcoin.assoc_t monad_t
val getwork_with_data : ?conn:Bitcoin.conn_t -> Bitcoin.hexwork_t -> bool monad_t
val getwork_without_data : ?conn:Bitcoin.conn_t -> unit -> Bitcoin.assoc_t monad_t
val importprivkey : ?conn:Bitcoin.conn_t ->
?account:Bitcoin.account_t ->
?rescan:bool -> Bitcoin.priv_t -> unit monad_t
Bitcoin.ENGINE.dumpprivkey
. If account
is provided, the key is associated with that account.
If not, the key is associated with the default account. The rescan
parameter indicates
whether the blockchain should be rescanned for transactions involving the imported key.
It is true
be default. (Requires unlocked wallet).val keypoolrefill : ?conn:Bitcoin.conn_t -> unit -> unit monad_t
val listaccounts : ?conn:Bitcoin.conn_t ->
?minconf:int ->
unit -> (Bitcoin.account_t * Bitcoin.amount_t) list monad_t
val listaddressgroupings : ?conn:Bitcoin.conn_t ->
unit ->
(Bitcoin.address_t * Bitcoin.amount_t * Bitcoin.account_t) list list
monad_t
val listlockunspent : ?conn:Bitcoin.conn_t ->
unit -> Bitcoin.txoutput_t list monad_t
Bitcoin.ENGINE.lockunspent
, and will not be spent by the system unless explicitly used in a raw transaction.val listreceivedbyaccount : ?conn:Bitcoin.conn_t ->
?minconf:int ->
?includeempty:bool ->
unit ->
(Bitcoin.account_t * Bitcoin.amount_t * int) list monad_t
includeempty
indicates whether accounts with nothing received will be included
in the returned list (defaults to false
).val listreceivedbyaddress : ?conn:Bitcoin.conn_t ->
?minconf:int ->
?includeempty:bool ->
unit ->
(Bitcoin.address_t * Bitcoin.account_t * Bitcoin.amount_t * int) list
monad_t
includeempty
indicates whether accounts with nothing received will be included in the returned
list (defaults to false
).val listsinceblock : ?conn:Bitcoin.conn_t ->
?blockhash:Bitcoin.blkhash_t ->
?minconf:int ->
unit -> (Bitcoin.assoc_t list * Bitcoin.blkhash_t) monad_t
blockhash
parameter limits the list of transactions to those occurring after
(and not including) that block. Note that if you want to provide a value for parameter minconf
,
then you must also provide blockhash
.val listtransactions : ?conn:Bitcoin.conn_t ->
?account:Bitcoin.account_t ->
?count:int ->
?from:int -> unit -> Bitcoin.assoc_t list monad_t
count
most recent transactions skipping the first from
transactions for account
.
If account
is not provided, then all recent transactions from all accounts will be returned.
Note that count
and from
default to 10 and 0, respectively.val listunspent : ?conn:Bitcoin.conn_t ->
?minconf:int ->
?maxconf:int ->
?addresses:Bitcoin.address_t list ->
unit -> Bitcoin.assoc_t list monad_t
minconf
and maxconf
confirmations
(these default to 1 and 999_999, respectively). If addresses
is provided, the returned list is filtered
to only include transaction outputs paid to the specified addresses.val lockunspent : ?conn:Bitcoin.conn_t ->
?outputs:Bitcoin.txoutput_t list ->
Bitcoin.lockop_t -> bool monad_t
`Lock
, this function
will lock the specified outputs, preventing them from being spent outside of a raw transaction. If the operation
is `Unlock
, this function will unlock the specified previously locked outputs. To unlock all currently locked
outputs, set the operation to `Unlock
and do not provide any list of outputs. Returns a boolean indicating
whether the operation was successfull.val move : ?conn:Bitcoin.conn_t ->
?minconf:int ->
?comment:string ->
Bitcoin.account_t ->
Bitcoin.account_t -> Bitcoin.amount_t -> bool monad_t
move ?minconf ?comment from_account to_account amount
transfers the given amount from one account to another.
If provided, comment
allows you to record a comment associated with the move. Note that this is operation
only rearranges the internal balances on your wallet, and is not communicated to the Bitcoin network.val sendfrom : ?conn:Bitcoin.conn_t ->
?minconf:int ->
?comment:string ->
?recipient:string ->
Bitcoin.account_t ->
Bitcoin.address_t ->
Bitcoin.amount_t -> Bitcoin.txid_t monad_t
comment
allows you to record an arbitrary comment about this transaction, whereas the
also optional recipient
assigns a string identifier to the recipient address. Note that sendfrom
is only performed if the account balance is sufficient to fund the transfer. (Requires unlocked wallet).val sendmany : ?conn:Bitcoin.conn_t ->
?minconf:int ->
?comment:string ->
Bitcoin.account_t ->
(Bitcoin.address_t * Bitcoin.amount_t) list ->
Bitcoin.txid_t monad_t
comment
allows you to record an arbitrary comment about this transaction. Note that sendmany
is only performed if the account balance is sufficient to fund the transfer. (Requires unlocked wallet).val sendrawtransaction : ?conn:Bitcoin.conn_t ->
Bitcoin.hextx_t -> Bitcoin.txid_t monad_t
val sendtoaddress : ?conn:Bitcoin.conn_t ->
?comment:string ->
?recipient:string ->
Bitcoin.address_t ->
Bitcoin.amount_t -> Bitcoin.txid_t monad_t
comment
allows you to record an arbitrary comment about this transaction, whereas
the also optional recipient
assigns a string identifier to the recipient address. Note that
sendtoaddress
is only performed if the total balance (not the balance of the default account!)
is sufficient to fund the transfer. (Requires unlocked wallet).val setaccount : ?conn:Bitcoin.conn_t ->
Bitcoin.address_t -> Bitcoin.account_t -> unit monad_t
val setgenerate : ?conn:Bitcoin.conn_t ->
?genproclimit:int -> bool -> unit monad_t
genproclimit
limits the number of CPUs to be used for generating.val settxfee : ?conn:Bitcoin.conn_t -> Bitcoin.amount_t -> bool monad_t
val signmessage : ?conn:Bitcoin.conn_t ->
Bitcoin.address_t -> string -> Bitcoin.sig_t monad_t
Bitcoin.ENGINE.validateaddress
. (Requires unlocked wallet).val signrawtransaction : ?conn:Bitcoin.conn_t ->
?parents:(Bitcoin.txoutput_t * Bitcoin.hexspk_t) list ->
?keys:Bitcoin.priv_t list ->
?sighash:Bitcoin.sigcomp_t * bool ->
Bitcoin.hextx_t -> (Bitcoin.hextx_t * bool) monad_t
Bitcoin.ENGINE.createrawtransaction
must be signed before broadcasting to the network with Bitcoin.ENGINE.sendrawtransaction
. The
optional parameters parents
, keys
, and sighash
are only required if you wish to chain transactions
or if the private keys required for signing do not reside in the wallet. Note that these optional parameters
have the particularity that providing a value for parameter n requires also providing a value for n-1.val submitblock : ?conn:Bitcoin.conn_t -> Bitcoin.hexblk_t -> unit monad_t
val validateaddress : ?conn:Bitcoin.conn_t ->
Bitcoin.address_t -> Bitcoin.assoc_t option monad_t
None
otherwise.val verifymessage : ?conn:Bitcoin.conn_t ->
Bitcoin.address_t -> Bitcoin.sig_t -> string -> bool monad_t
Bitcoin.ENGINE.signmessage
for signing messages.val walletlock : ?conn:Bitcoin.conn_t -> unit -> unit monad_t
Bitcoin.ENGINE.walletpassphrase
. Note that this function may
not be called on an already locked wallet or in one which is altogether unencrypted.val walletpassphrase : ?conn:Bitcoin.conn_t -> string -> int -> unit monad_t
walletpassphrase passphrase timeout
unlocks an encrypted wallet, storing the decryption key
in memory. If your wallet is encrypted (see Bitcoin.ENGINE.encryptwallet
) then you must invoke this function
prior to calling any of the functions which require an unlocked wallet. Note that the unlocking
expires after timeout
seconds. Regardless of the timeout, you may at any moment lock again the
wallet with Bitcoin.ENGINE.walletlock
.val walletpassphrasechange : ?conn:Bitcoin.conn_t -> string -> string -> unit monad_t
walletpassphrasechange old_passphrase new_passphrase
changes the wallet passphrase from
old_passphrase
to new_passphrase
. Must only be called for an encrypted wallet.