Documentation ¶
Overview ¶
Package blockchain contains the "Blockchain" struct that holds all mined blocks. It is also responsible for the "Block" struct and all methods that are related with hashing, validating etc.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HashBlockValues ¶
func HashBlockValues(timestamp int64, lastHash string, txs []t.Transaction, difficulty uint64, nonce int) (string, error)
HashBlockValues takes values of a Block, plus a nonce, and receives the derived hash string.
func NewGenesisBlock ¶
NewGenesisBlock returns a "Block" that contains static data. Can be used to initialize a new chain.
Types ¶
type State ¶
State contains the general blockchain state, most importantly all mined blocks.
func New ¶
func New() State
New returns a "State" struct with the genesis block as the first and only value in it's "Blocks" slice.
func (*State) IsValidChain ¶
IsValidChain validates if all blocks contain valid hashes and are chained properly through their "lastHash".