bitcoin-tx-0.13.1: Utility functions for manipulating bitcoin transactions

Safe HaskellNone
LanguageHaskell2010

Data.Bitcoin.Transaction

Synopsis

Documentation

decode Source

Arguments

:: HexString

The hexadecimal representation of the transaction

-> Transaction

The decoded Transaction object

Decodes a hex representation of a transaction into a Transaction object.

encode Source

Arguments

:: Transaction

The Transaction we would like to encode to hex

-> HexString

The hexadecimal representation of the transaction

Encodes a Transaction object into a hex representation.

transactionId :: Transaction -> TransactionId Source

Calculates the transaction id of a Transaction as a TransactionId so it can be used in RPC interfaces.

data TxnOutputType Source

Constructors

TxnPubKey

JSON of "pubkey" received.

TxnPubKeyHash

JSON of "pubkeyhash" received.

TxnScriptHash

JSON of "scripthash" received.

TxnMultisig

JSON of "multisig" received.

data OutPoint Source

The OutPoint is used inside a transaction input to reference the previous transaction output that it is spending.

Constructors

OutPoint 

Fields

_outPointHash :: TransactionHash

The hash of the referenced transaction.

_outPointIndex :: Word32

The position of the specific output in the transaction. The first output position is 0.

data TransactionIn Source

Data type representing a transaction input.

Constructors

TransactionIn 

Fields

_prevOutput :: OutPoint

Reference the previous transaction output (hash + position)

_scriptInput :: Script

Script providing the requirements of the previous transaction output to spend those coins.

_txInSequence :: Word32

Transaction version as defined by the sender of the transaction. The intended use is for replacing transactions with new information before the transaction is included in a block.

data TransactionOut Source

Data type representing a transaction output.

Constructors

TransactionOut 

Fields

_outValue :: Word64

Transaction output value.

_scriptOutput :: Script

Script specifying the conditions to spend this output.

data Transaction Source

Data type representing a bitcoin transaction

Constructors

Transaction 

Fields

_txVersion :: Word32

Transaction data format version

_txIn :: [TransactionIn]

List of transaction inputs

_txOut :: [TransactionOut]

List of transaction outputs

_txLockTime :: Word32

The block number of timestamp at which this transaction is locked

data Coinbase Source

Data type representing the coinbase transaction of a Block. Coinbase transactions are special types of transactions which are created by miners when they find a new block. Coinbase transactions have no inputs. They have outputs sending the newly generated bitcoins together with all the block's fees to a bitcoin address (usually the miners address). Data can be embedded in a Coinbase transaction which can be chosen by the miner of a block. This data also typically contains some randomness which is used, together with the nonce, to find a partial hash collision on the block's hash.

Constructors

Coinbase 

Fields

_cbVersion :: Word32

Transaction data format version.

_cbPrevOutput :: OutPoint

Previous outpoint. This is ignored for coinbase transactions but preserved for computing the correct txid.

_cbData :: ByteString

Data embedded inside the coinbase transaction.

_cbInSequence :: Word32

Transaction sequence number. This is ignored for coinbase transactions but preserved for computing the correct txid.

_cbOut :: [TransactionOut]

List of transaction outputs.

_cbLockTime :: Word32

The block number of timestamp at which this transaction is locked.