Safe Haskell | None |
---|---|
Language | Haskell98 |
An interface to bitcoind's available raw transaction-related RPC calls. The implementation of these functions can be found at https://github.com/bitcoin/bitcoin/blob/master/src/rpcrawtransaction.cpp.
If any APIs are missing, patches are always welcome. If you look at the source of this module, you'll see that the interface code is trivial.
Also, documentation for this module is scarce. I would love the addition of more documentation by anyone who knows what these things are.
- type Client = ByteString -> IO ByteString
- getClient :: String -> ByteString -> ByteString -> IO Client
- type RawTransaction = HexString
- getRawTransaction :: Client -> TransactionID -> IO RawTransaction
- data TxIn
- = TxCoinbase { }
- | TxIn { }
- data TxnOutputType
- data ScriptPubKey
- data ScriptSig = ScriptSig {}
- data TxOut = TxOut {}
- data BlockInfo
- = ConfirmedBlock { }
- | UnconfirmedBlock
- data RawTransactionInfo = RawTransactionInfo {}
- getRawTransactionInfo :: Client -> TransactionID -> IO RawTransactionInfo
- data UnspentTransaction = UnspentTransaction {}
- listUnspent :: Client -> Maybe Int -> Maybe Int -> Vector Address -> IO (Vector UnspentTransaction)
- createRawTransaction :: Client -> Vector UnspentTransaction -> Vector (Address, BTC) -> IO HexString
- data DecodedRawTransaction = DecodedRawTransaction {}
- decodeRawTransaction :: Client -> RawTransaction -> IO DecodedRawTransaction
- data WhoCanPay
- data RawSignedTransaction = RawSignedTransaction {}
- signRawTransaction :: Client -> RawTransaction -> Maybe (Vector UnspentTransaction) -> Maybe (Vector HexString) -> Maybe WhoCanPay -> IO RawSignedTransaction
- sendRawTransaction :: Client -> RawTransaction -> IO TransactionID
Documentation
type Client = ByteString -> IO ByteString Source
Client
describes authentication credentials and host info for
making API requests to the Bitcoin daemon.
getClient :: String -> ByteString -> ByteString -> IO Client Source
getClient
takes a url, rpc username, and rpc password
and returns a Client that can be used to make API calls. Each
Client encloses a Manager (from http-client) that re-uses
connections for requests, so long as the same Client is
is used for each call.
type RawTransaction = HexString Source
Just like most binary data retrieved from bitcoind, a raw transaction is represented by a hexstring.
This is a serialized, hex-encoded transaction.
getRawTransaction :: Client -> TransactionID -> IO RawTransaction Source
Get a raw transaction from its unique ID.
A transaction into an account. This can either be a coinbase transaction, or a standard transaction with another account.
TxCoinbase | |
TxIn | |
|
data TxnOutputType Source
The type of a transaction out.
More documentation is needed here. Submit a patch if you know what this is about!
TxnPubKey | JSON of "pubkey" received. |
TxnPubKeyHash | JSON of "pubkeyhash" received. |
TxnScriptHash | JSON of "scripthash" received. |
TxnMultisig | JSON of "multisig" received. |
data ScriptPubKey Source
A public key of someone we sent money to.
NonStandardScriptPubKey | |
StandardScriptPubKey | |
|
A script signature.
A transaction out of an account.
TxOut | |
|
Information on a single block.
ConfirmedBlock | |
UnconfirmedBlock | An unconfirmed block is boring, but a possibility. |
data RawTransactionInfo Source
The raw transaction info for a given transaction ID.
RawTransactionInfo | |
|
getRawTransactionInfo :: Client -> TransactionID -> IO RawTransactionInfo Source
Get raw transaction info for a given transaction ID. The data structure returned is quite sprawling and undocumented, so any patches to help simplify things would be greatly appreciated.
:: Client | |
-> Maybe Int | minconf. Defaults to 1 if |
-> Maybe Int | maxconf. Defaults to 9999999 if |
-> Vector Address | Use |
-> IO (Vector UnspentTransaction) |
Returns an array of unspent transaction outputs with between minconf and maxconf (inclusive) confirmations. If addresses are given, the result will be filtered to include only those addresses.
:: Client | |
-> Vector UnspentTransaction | The unspent transactions we'll be using as our output. |
-> Vector (Address, BTC) | The addresses we're sending money to, along with how much each of them gets. |
-> IO HexString |
Create a transaction spending given inputs, sending to given addresses.
Note that the transaction's inputs are not signed, and it is not stored in the wallet or transmitted to the network.
Also, there is no checking to see if it's possible to send that much to the targets specified. In the future, such a scenario might throw an exception.
data DecodedRawTransaction Source
A successfully decoded raw transaction, from a given serialized, hex-encoded transaction.
DecodedRawTransaction | |
|
decodeRawTransaction :: Client -> RawTransaction -> IO DecodedRawTransaction Source
Decodes a raw transaction into a more accessible data structure.
Who can pay for a given transaction.
data RawSignedTransaction Source
A raw signed transaction contains the raw, signed hexstring and whether or not this transaction has a complete signature set.
:: Client | |
-> RawTransaction | The raw transaction whose inputs we're signing. |
-> Maybe (Vector UnspentTransaction) | An optional list of previous transaction outputs that this transaction depends on but may not yet be in the block chain. |
-> Maybe (Vector HexString) | An array of base58-encoded private keys that, if given, will be the only keys used to sign the transaction. |
-> Maybe WhoCanPay | Who can pay for this transaction? |
-> IO RawSignedTransaction | Returns |
Sign inputs for a raw transaction.