blockchain

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: May 2, 2020 License: MIT Imports: 2 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Block

type Block struct {
	Data          string
	PrevBlockHash string
	Hash          string
}

Block keeps block headers

func NewBlock

func NewBlock(data string, prevBlockHash string) *Block

NewBlock creates and returns Block

func NewGenesisBlock

func NewGenesisBlock() *Block

NewGenesisBlock creates and returns genesis Block

type Blockchain

type Blockchain struct {
	Blocks []*Block
}

Blockchain keeps a sequence of Blocks

func NewBlockchain

func NewBlockchain() *Blockchain

NewBlockchain creates a new Blockchain with genesis Block

func (*Blockchain) AddBlock

func (bc *Blockchain) AddBlock(data string) *Block

AddBlock saves provided data as a block in the blockchain

Jump to

Keyboard shortcuts

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