Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BitcoinNet ¶
type BitcoinNet uint32
BitcoinNet represents which bitcoin network a message belongs to.
const ( // MainNet represents the main bitcoin network. MainNet BitcoinNet = 0xd9b4bef9 // TestNet represents the regression test network. TestNet BitcoinNet = 0xdab5bffa // TestNet3 represents the test network (version 3). TestNet3 BitcoinNet = 0x0709110b // SimNet represents the simulation test network. SimNet BitcoinNet = 0x12141c16 )
Constants used to indicate the message bitcoin network. They can also be used to seek to the next message when a stream's state is unknown, but this package does not provide that functionality since it's generally a better idea to simply disconnect clients that are misbehaving over TCP.
type BlockHeader ¶
type BlockHeader struct { // Version of the block. This is not the same as the protocol version. Version int32 // Hash of the previous block header in the block chain. PrevBlock chainhash.Hash // Merkle tree reference to hash of all transactions for the block. MerkleRoot chainhash.Hash // Time the block was created. This is, unfortunately, encoded as a // uint32 on the wire and therefore is limited to 2106. Timestamp time.Time // Difficulty target for the block. Bits uint32 // Nonce used to generate the block. Nonce uint32 }
BlockHeader defines information about a block and is used in the bitcoin block (MsgBlock) and headers (MsgHeaders) messages.
type MsgBlock ¶
type MsgBlock struct { Header BlockHeader Transactions []*MsgTx }
MsgBlock implements the Message interface and represents a bitcoin block message. It is used to deliver block and transaction information in response to a getdata message (MsgGetData) for a given block hash.
type MsgTx ¶
MsgTx implements the Message interface and represents a bitcoin tx message. It is used to deliver transaction information in response to a getdata message (MsgGetData) for a given transaction.
Use the AddTxIn and AddTxOut functions to build up the list of transaction inputs and outputs.
type OutPoint ¶
OutPoint defines a bitcoin data type that is used to track previous transaction outputs.
type TxIn ¶
type TxIn struct { PreviousOutPoint OutPoint SignatureScript []byte Witness TxWitness Sequence uint32 }
TxIn defines a bitcoin transaction input.