bitcoin-block-0.13.1: Utility functions for manipulating bitcoin blocks

Safe HaskellNone




decode Source


:: HexString

The hexadecimal representation of the transaction

-> Block

The decoded Transaction object

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

encode Source


:: Block

The Transaction we would like to encode to hex

-> HexString

The hexadecimal representation of the transaction

Encodes a Block object into a hex representation.

headerHash :: Block -> HexString Source

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

data BlockHeader Source

Data type recording information on a Block. The hash of a block is defined as the hash of this data structure. The block mining process involves finding a partial hash collision by varying the nonce in the BlockHeader and/or additional randomness in the Coinbase of this Block. Variations in the Coinbase will result in different merkle roots in the BlockHeader.




_blockVersion :: Word32

Block version information, based on the version of the software creating this block.

_prevBlock :: BlockHash

Hash of the previous block (parent) referenced by this block.

_merkleRoot :: Word256

Root of the merkle tree of all transactions pertaining to this block.

_blockTimestamp :: Word32

Unix timestamp recording when this block was created

_blockBits :: Word32

The difficulty target being used for this block

_bhNonce :: Word32

A random nonce used to generate this block. Additional randomness is included in the coinbase transaction of this block.

data Block Source

Data type describing a block in the bitcoin protocol.




_blockHeader :: BlockHeader

Header information for this block.

_blockCoinbaseTx :: Coinbase

Coinbase transaction of this block.

_blockTxns :: [Transaction]

List of transactions pertaining to this block.