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

Safe HaskellNone
LanguageHaskell2010

Data.Bitcoin.Block

Synopsis

Documentation

decode Source

Arguments

:: 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

Arguments

:: 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 Block Source

Data type describing a block in the bitcoin protocol.

Constructors

Block 

Fields

blockHeader :: BlockHeader

Header information for this block.

blockCoinbaseTx :: Coinbase

Coinbase transaction of this block.

blockTxns :: [Transaction]

List of transactions pertaining to this block.

Instances

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.

Constructors

BlockHeader 

Fields

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.