node

package
v0.0.0-...-77fbf23 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2019 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Node

type Node struct {
	PrivK      *ecdsa.PrivateKey
	Addr       core.Address
	Bc         *core.Blockchain
	Miner      bool // indicates if the node is running as a miner
	PendingTxs []core.Tx
}

Node

func NewNode

func NewNode(privK *ecdsa.PrivateKey, bc *core.Blockchain, isMiner bool) (*Node, error)

NewNode creates a new node

func (*Node) AddToPendingTxs

func (node *Node) AddToPendingTxs(tx core.Tx)

AddToPendingTxs adds a transaction the the node.PendingTxs

func (*Node) BlockFromPendingTxs

func (node *Node) BlockFromPendingTxs() (*core.Block, error)

BlockFromPendingTxs creates a new block from the pending transactions

func (*Node) CreateGenesis

func (node *Node) CreateGenesis(pubK *ecdsa.PublicKey, amount uint64) (*core.Block, error)

CreateGenesis creates the genesis block pubK is the wallet where the first coins will be created amount is the amount of coins that will be created

func (*Node) NewBlock

func (node *Node) NewBlock(txs []core.Tx) (*core.Block, error)

NewBlock creates a new block with the given txs

func (*Node) ParseReceivedBlock

func (node *Node) ParseReceivedBlock(block *core.Block) error

ParseReceivedBlock is just a caller of node.Bc.AddBlock() at the Node level

func (*Node) Sign

func (node *Node) Sign(m []byte) (*core.Signature, error)

SignBlock performs a signature of a byte array with the node private key

func (*Node) SignBlock

func (node *Node) SignBlock(block *core.Block) error

SignBlock performs a signature of a block with the node private key

Jump to

Keyboard shortcuts

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