goblock

package module
v0.0.0-...-ff7df16 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2023 License: MIT Imports: 6 Imported by: 0

README

goblock

Go package educational package, implementing blockchain functions.

Installation

go get github.com/vvshulga/goblock

Usage

Create Blockchain:

miningDificulty int8 = 2
blockchain := CreateBlockchain(miningDificulty)

Add block to blockchain:

from := "Alice"
to   := "Bob"
amount := 5
blockchain.addBlock(from, to, amount)

Check if blockchain is valid:

blockchain.isValid()

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Block

type Block struct {
	// contains filtered or unexported fields
}

type Blockchain

type Blockchain struct {
	// contains filtered or unexported fields
}

func CreateBlockchain

func CreateBlockchain(difficulty int) Blockchain

func (*Blockchain) AddBlock

func (b *Blockchain) AddBlock(from, to string, amount float64)

func (Blockchain) IsValid

func (b Blockchain) IsValid() bool

Jump to

Keyboard shortcuts

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