classes

package
v0.0.0-...-2d974e4 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2018 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const TargetBits = 16

Variables

This section is empty.

Functions

func NewBlock

func NewBlock(txs []*models.TransactionModel, prev *models.BlockModel) *models.BlockModel

func NewCoinBaseTX

func NewCoinBaseTX(to, data string) *models.TransactionModel

func NewGenesisBlock

func NewGenesisBlock(db *gorm.DB, odb *gorm.DB, address string) *models.BlockModel

func NewTransaction

func NewTransaction(from, to string, amount int, bc *Blockchain, ws *models.Wallets) *models.TransactionModel

Types

type Blockchain

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

func GetBlockChainFromGenesis

func GetBlockChainFromGenesis(db *gorm.DB, odb *gorm.DB) *Blockchain

func NewBlockChain

func NewBlockChain(db *gorm.DB, odb *gorm.DB, address string) *Blockchain

func (*Blockchain) AddBlock

func (b *Blockchain) AddBlock(txs []*models.TransactionModel)

func (*Blockchain) DisplayBlockChain

func (b *Blockchain) DisplayBlockChain()

func (*Blockchain) FindOutputs

func (b *Blockchain) FindOutputs(PubKeyHash []byte, amount int) (int, map[string][]int)

func (*Blockchain) FindTransaction

func (b *Blockchain) FindTransaction(Txid string) (*models.TransactionModel, error)

func (*Blockchain) GetUnspentOutputs

func (b *Blockchain) GetUnspentOutputs(PubKeyHash []byte) []models.TXOutput

func (*Blockchain) GetUnspentTransactions

func (b *Blockchain) GetUnspentTransactions(PubKeyHash []byte) []models.TransactionModel

func (*Blockchain) MineBlock

func (b *Blockchain) MineBlock(transactions []*models.TransactionModel)

func (*Blockchain) SetOutputsDB

func (b *Blockchain) SetOutputsDB(db *gorm.DB)

func (*Blockchain) SignTransaction

func (b *Blockchain) SignTransaction(transaction *models.TransactionModel, privKey *ecdsa.PrivateKey)

func (*Blockchain) UpdateBlocks

func (b *Blockchain) UpdateBlocks()

func (*Blockchain) VerifyTransaction

func (b *Blockchain) VerifyTransaction(transaction *models.TransactionModel) bool

type ProofOfWork

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

func NewProofOfWork

func NewProofOfWork(b *models.BlockModel) *ProofOfWork

func (*ProofOfWork) Run

func (pow *ProofOfWork) Run() (int, [32]byte)

func (*ProofOfWork) Validate

func (pow *ProofOfWork) Validate() bool

Jump to

Keyboard shortcuts

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