Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CalculateHash ¶
CalculateHash computes the hash of a block based on its transaction data, nonce, and previous hash.
func ChangeBlock ¶
ChangeBlock updates the transaction data of a block and recalculates its hash.
func DisplayBlocks ¶
func DisplayBlocks(blocks []*Block)
DisplayBlocks prints out the details of each block in the blockchain.
func VerifyChain ¶
VerifyChain checks if the blockchain is valid by verifying hashes and previous block references.
Types ¶
type Block ¶
type Block struct { Transaction string // The transaction data stored in the block. Nonce int // Nonce is a random number used in the mining process. PreviousHash string // PreviousHash is the hash of the previous block. CurrentHash string // CurrentHash is the hash of the current block. }
Block represents a single unit in the blockchain.
Click to show internal directories.
Click to hide internal directories.