Documentation
¶
Overview ¶
Package block contains the block struct and functions to transform a block
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractContractsFromBlock ¶
ExtractContractsFromBlock returns contract slice based on block data
func HashBlockHeader ¶
func HashBlockHeader(b BlockHeader) []byte
Concatenate all the fields of the block header and return its SHA256 hash
Types ¶
type Block ¶
type Block struct { Version uint16 // Version is the version of the software this block was created with Height uint64 // Height is the distance from the bottom of the tree, with the genesis block starting with height 0 Timestamp int64 // Timestamp is the time of creation for this block PreviousHash []byte // PreviousHash is the hash of the previous block in the blockchain, MerkleRootHash []byte // MerkleRootHash is the hash of the MerkleRoot of all inputs DataLen uint16 // DataLen is the number of objects in the following Data variable Data [][]byte // Data is an abritrary variable, holding the actual contents of this block }
Block is a struct that represents a block in a blockchain.
func Deserialize ¶
Converts a block in byte form into a block struct, returns the struct
func (*Block) Equals ¶
Compares two block structs and returns true if all the fields in both blocks are equal, false otherwise
func (*Block) GetHeader ¶
func (b *Block) GetHeader() BlockHeader
type BlockHeader ¶
Click to show internal directories.
Click to hide internal directories.