lib

package
v0.0.0-...-f093799 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2024 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BlockConsumer

func BlockConsumer(node *dst.Node, neighboors *dst.Neighboors, _mapNodeId map[string]uint32)

func BlockPublisher

func BlockPublisher(_blockToPublish dst.Block, _node *dst.Node)

func BoostrapInformationConsumer

func BoostrapInformationConsumer(neighboors *dst.Neighboors, loop chan *dst.Neighboors, _mapNodeId map[string]uint32)

func BootStrapBlockInitialize

func BootStrapBlockInitialize(node *dst.Node, wallet Wallet)

Creates the genesis block, updates bootstrap nodes balance and adds genesis block to the blockchain.

func BootstrapInitTransactionAndBlockChain

func BootstrapInitTransactionAndBlockChain(loop chan *dst.Neighboors, node *dst.Node, wallet Wallet)

func LogError

func LogError(err error, msg string)

func MineBlock

func MineBlock(seed *string, neighboors *dst.Neighboors) string

func NodeHttpService

func NodeHttpService(node *dst.Node, neighboors *dst.Neighboors, wallet *Wallet)

func NodeInformationConsumer

func NodeInformationConsumer(neighboors *dst.Neighboors, node *dst.Node, _mapNodeId map[string]uint32)

func NodeInformationPublisher

func NodeInformationPublisher(node *dst.Node)

func TransactionConsumer

func TransactionConsumer(node *dst.Node, neighboors *dst.Neighboors, wallet Wallet, _mapNodeId map[string]uint32)

func ValidateTransaction

func ValidateTransaction(t *dst.Transaction, neighboors *dst.Neighboors, node *dst.Node, _mapNodeId map[string]uint32) bool

Types

type UnsignedTransaction

type UnsignedTransaction struct {
	SenderAddress     string
	RecipientAddress  string
	TypeOfTransaction string
	Amount            float64
	Message           string
	Nonce             uint32
}

type Wallet

type Wallet struct {
	PublicKey  *rsa.PublicKey
	PrivateKey *rsa.PrivateKey
}

func GenerateWallet

func GenerateWallet() (wallet Wallet)

Creates a new wallet, a pair of public/private key.

func (Wallet) PrivateKeyToString

func (_w Wallet) PrivateKeyToString() string

func (Wallet) PublicKeyToString

func (_w Wallet) PublicKeyToString() string

func (Wallet) SignTransaction

func (_w Wallet) SignTransaction(_t UnsignedTransaction) (transactionID string, signature []byte)

Jump to

Keyboard shortcuts

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