assignment01bca

package module
v0.0.0-...-401b241 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 9, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalculateHash

func CalculateHash(block *Block) string

Function to calculate the hash of a block

func ChangeBlock

func ChangeBlock(block *Block, newTransaction string)

Function to change an already added block of the blockchain

func DisplayBlocks

func DisplayBlocks(blocks []*Block)

Function to display all blocks of the blockchain

func VerifyChain

func VerifyChain(blocks []*Block) bool

Function to verify the blockchain for any changes

Types

type Block

type Block struct {
	Transaction  string
	Nonce        int
	PreviousHash string
	CurrentHash  string
}

Defining the block structure for the blockchain

func NewBlock

func NewBlock(transaction string, nonce int, previousHash string) *Block

Function to add a new block to the blockchain

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL