core

package
v0.0.0-...-6db25f1 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Block

type Block struct {
	Height       uint64
	Timestamp    int64
	PrevHash     []byte
	Hash         []byte
	Transactions []*Transaction
	MerkleRoot   []byte
	Nonce        uint64
	Difficulty   uint32
	MinerReward  float64
}

func NewBlock

func NewBlock(height uint64, prevHash []byte, transactions []*Transaction) *Block

type Blockchain

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

func NewBlockchain

func NewBlockchain() *Blockchain

func (*Blockchain) AddBlock

func (bc *Blockchain) AddBlock(block *Block) error

type Transaction

type Transaction struct {
	ID        []byte
	Inputs    []TxInput
	Outputs   []TxOutput
	Signature []byte
}

func NewTransaction

func NewTransaction(from, to string, amount float64, blockchain *Blockchain) *Transaction

func (*Transaction) Hash

func (tx *Transaction) Hash() []byte

type TxInput

type TxInput struct {
	TxID      []byte
	OutIndex  int
	PublicKey []byte
}

type TxOutput

type TxOutput struct {
	Value      float64
	PubKeyHash []byte
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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