role

package
v0.0.0-...-46cf522 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2018 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Miner

type Miner struct {
	Address         rsa.PublicKey
	TransactionPool []*core.Transaction
	// contains filtered or unexported fields
}

func CreateMiner

func CreateMiner(chain core.Blockchain) *Miner

func (*Miner) GetBlockChain

func (miner *Miner) GetBlockChain() *core.Blockchain

func (*Miner) GetPrivateKey

func (miner *Miner) GetPrivateKey() *rsa.PrivateKey

func (*Miner) GetShortIdentity

func (miner *Miner) GetShortIdentity() string

func (*Miner) SendTo

func (miner *Miner) SendTo(receipt *User, amount uint64, fee uint64)

func (*Miner) StartMining

func (miner *Miner) StartMining()

* StartMining starts to propose and confirm block in the chain * Here assume we only have one miner, otherwise this function need to handle multi-threading

type User

type User struct {
	Address rsa.PublicKey
	// contains filtered or unexported fields
}

func CreateBoostUser

func CreateBoostUser() *User

* CreateBoostUser to create the first user before boosting the chain

func CreateUser

func CreateUser(chain core.Blockchain) *User

func (*User) Balance

func (user *User) Balance() uint64

func (*User) BroadcastTransaction

func (user *User) BroadcastTransaction(tran *core.Transaction)

* BroadcastTransaction broadcasts the transaction to all miners * TODO: The broadcast should be based on msg in real world

func (*User) GetPrivateKey

func (user *User) GetPrivateKey() *rsa.PrivateKey

func (*User) GetShortIdentity

func (user *User) GetShortIdentity() string

func (*User) RegisterBoostUser

func (user *User) RegisterBoostUser(chain core.Blockchain)

* RegisterBoostUser used to register the boost user after initialize the blockchain

func (*User) SendTo

func (user *User) SendTo(receipt *User, amount uint64, fee uint64)

Jump to

Keyboard shortcuts

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