bitcoin-api-0.12.1: Provides access to the RPC API of Bitcoin Core

Safe HaskellNone
LanguageHaskell2010

Network.Bitcoin.Api.Transaction

Description

This module provides functionality to manipulate raw transaction. It automatically interprets transactions using the `bitcoin-tx` package, so you can work with actual Transaction objects rather than their serialized format.

Synopsis

Documentation

create Source

Arguments

:: Client

The client session we are using

-> [UnspentTransaction]

The inputs we are using for this transaction

-> [(Address, Btc)]

A key/value pair which associates a destination address with a specific amount of bitcoins to send.

-> IO Transaction 

Creates a new transaction, but does not sign or submit it yet. You provide a set of unspent transactions that you have the authority to spend, and you provide a destination for all your bitcoins.

WARNING: Check your math! If the sum of the Btc in unspent transactions of your request is more than the sum of the Btc in the destinations, this will be the miner's fee. It is reasonable to leave a small amount for the miners, but if there is a large discrepancy between input and output, there are no guarantees you will be warned.

All this function does is create a default script on how to spend coins from one or more inputs to one or more outputs. Checking and verifying the transaction will only happen when you actually submit the transaction to the network.

sign Source

Arguments

:: Client

Our client context

-> Transaction

The transaction to sign

-> Maybe [UnspentTransaction]

Previous outputs being spent by this transaction

-> Maybe [PrivateKey]

Private keys to use for signing.

-> IO (Transaction, Bool)

The signed transaction, and a boolean that is true when the signing is complete or and is false when more signatures are required.

Signs a raw transaction with configurable parameters.

send :: Client -> Transaction -> IO TransactionId Source

Sends a transaction through the Bitcoin network

list Source

Arguments

:: Client

Our client session context

-> Maybe Integer

The offset / height we should start listing transactions

-> Maybe Integer

Minimum amount of confirmations for a transaction to have. Should be 1 or higher. A default value of 6 is used.

-> IO [Transaction] 

Returns a list of transactions that occured since a certain block height. If no block height was provided, the genisis block with height 0 is assumed. The transactions returned are listed chronologically.