Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CalculateHash ¶
CalculateHash computes the hash of a block using its transaction, nonce, and previous hash.
func ChangeBlock ¶
ChangeBlock updates a block with a new transaction and resets the nonce.
func DisplayBlocks ¶
func DisplayBlocks(blocks []*Block)
DisplayBlocks prints information about each block in the blockchain.
func ValidateProofOfWork ¶
ValidateProofOfWork checks if the block's current hash satisfies the proof of work requirement.
func VerifyChain ¶
VerifyChain checks if the blockchain is valid by verifying previous hashes and proof of work.
Types ¶
type Block ¶
type Block struct { Transaction string // The data or transaction stored in the block. Nonce int // A random number used in the proof of work process. PreviousHash string // The hash of the previous block in the chain. CurrentHash string // The hash of the current block. }
Block represents a single block in the blockchain.
Click to show internal directories.
Click to hide internal directories.