Documentation
¶
Index ¶
- func IsProducerAddressValid(producer string) bool
- type BlockProducer
- type DPOS
- func (dpos *DPOS) AddProducer(producer string) error
- func (dpos *DPOS) GetBlockChain() *core.Blockchain
- func (dpos *DPOS) GetDynasty() *Dynasty
- func (dpos *DPOS) GetProducers() []string
- func (dpos *DPOS) GetSlot() *lru.Cache
- func (dpos *DPOS) IsProducingBlock() bool
- func (dpos *DPOS) SetDynasty(dynasty *Dynasty)
- func (dpos *DPOS) SetKey(key string)
- func (dpos *DPOS) Setup(node core.NetService, cbAddr string)
- func (dpos *DPOS) Start()
- func (dpos *DPOS) Stop()
- func (dpos *DPOS) Validate(block *core.Block) bool
- type Delegate
- func (d *Delegate) Beneficiary() string
- func (d *Delegate) IsIdle() bool
- func (d *Delegate) SetPrivateKey(key string)
- func (d *Delegate) SetRequirement(requirement Requirement)
- func (d *Delegate) Setup(bc *core.Blockchain, beneficiaryAddr string, newBlockCh chan *NewBlock)
- func (d *Delegate) Start()
- func (d *Delegate) Stop()
- type Dynasty
- func (dynasty *Dynasty) AddMultipleProducers(producers []string)
- func (dynasty *Dynasty) AddProducer(producer string) error
- func (dynasty *Dynasty) GetDynastyTime() int
- func (dynasty *Dynasty) GetProducerIndex(producer string) int
- func (dynasty *Dynasty) GetProducers() []string
- func (dynasty *Dynasty) IsMyTurn(producer string, now int64) bool
- func (dynasty *Dynasty) ProducerAtATime(time int64) string
- func (dynasty *Dynasty) SetMaxProducers(maxProducers int)
- func (dynasty *Dynasty) SetTimeBetweenBlk(timeBetweenBlk int)
- type Miner
- func (miner *Miner) Beneficiary() string
- func (miner *Miner) IsIdle() bool
- func (miner *Miner) SetPrivateKey(key string)
- func (miner *Miner) SetRequirement(requirement Requirement)
- func (miner *Miner) Setup(bc *core.Blockchain, beneficiaryAddr string, newBlockCh chan *NewBlock)
- func (miner *Miner) Start()
- func (miner *Miner) Stop()
- type NewBlock
- type ProofOfWork
- func (pow *ProofOfWork) AddProducer(producer string) error
- func (pow *ProofOfWork) GetProducers() []string
- func (pow *ProofOfWork) IsProducingBlock() bool
- func (pow *ProofOfWork) SetKey(key string)
- func (pow *ProofOfWork) SetTargetBit(bit int)
- func (pow *ProofOfWork) Setup(node core.NetService, cbAddr string)
- func (pow *ProofOfWork) Start()
- func (pow *ProofOfWork) Stop()
- func (pow *ProofOfWork) Validate(block *core.Block) bool
- type Requirement
- type State
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsProducerAddressValid ¶
Types ¶
type BlockProducer ¶ added in v0.1.2
type BlockProducer interface {
// Setup tells the producer to give rewards to beneficiaryAddr and return the new block through newBlockCh
Setup(bc *core.Blockchain, beneficiaryAddr string, newBlockCh chan *NewBlock)
SetPrivateKey(key string)
// Beneficiary returns the address which receives rewards
Beneficiary() string
// SetRequirement defines the requirement that a new block must fulfill
SetRequirement(requirement Requirement)
Start()
Stop()
IsIdle() bool
}
type DPOS ¶ added in v0.1.2
type DPOS struct {
// contains filtered or unexported fields
}
func (*DPOS) AddProducer ¶ added in v0.1.2
func (*DPOS) GetBlockChain ¶ added in v0.1.2
func (dpos *DPOS) GetBlockChain() *core.Blockchain
func (*DPOS) GetDynasty ¶ added in v0.1.2
func (*DPOS) GetProducers ¶ added in v0.1.2
func (*DPOS) IsProducingBlock ¶ added in v0.1.2
func (*DPOS) SetDynasty ¶ added in v0.1.2
type Delegate ¶ added in v0.1.2
type Delegate struct {
// contains filtered or unexported fields
}
func NewDelegate ¶ added in v0.1.2
func NewDelegate() *Delegate
func (*Delegate) Beneficiary ¶ added in v0.1.2
func (*Delegate) SetPrivateKey ¶ added in v0.1.2
func (*Delegate) SetRequirement ¶ added in v0.1.2
func (d *Delegate) SetRequirement(requirement Requirement)
type Dynasty ¶
type Dynasty struct {
// contains filtered or unexported fields
}
func NewDynasty ¶
func NewDynastyWithConfigProducers ¶ added in v0.1.2
New dynasty from config file
func (*Dynasty) AddMultipleProducers ¶
func (*Dynasty) AddProducer ¶
func (*Dynasty) GetDynastyTime ¶ added in v0.1.2
func (*Dynasty) GetProducerIndex ¶
find the index of the producer. If not found, return -1
func (*Dynasty) GetProducers ¶ added in v0.1.2
func (*Dynasty) ProducerAtATime ¶
func (*Dynasty) SetMaxProducers ¶
func (*Dynasty) SetTimeBetweenBlk ¶
type Miner ¶
type Miner struct {
// contains filtered or unexported fields
}
func (*Miner) Beneficiary ¶ added in v0.1.2
func (*Miner) SetPrivateKey ¶ added in v0.1.2
func (*Miner) SetRequirement ¶ added in v0.1.2
func (miner *Miner) SetRequirement(requirement Requirement)
type ProofOfWork ¶
type ProofOfWork struct {
// contains filtered or unexported fields
}
func NewProofOfWork ¶
func NewProofOfWork() *ProofOfWork
func (*ProofOfWork) AddProducer ¶ added in v0.1.2
func (pow *ProofOfWork) AddProducer(producer string) error
func (*ProofOfWork) GetProducers ¶ added in v0.1.2
func (pow *ProofOfWork) GetProducers() []string
func (*ProofOfWork) IsProducingBlock ¶ added in v0.1.2
func (pow *ProofOfWork) IsProducingBlock() bool
func (*ProofOfWork) SetKey ¶ added in v0.1.2
func (pow *ProofOfWork) SetKey(key string)
func (*ProofOfWork) SetTargetBit ¶
func (pow *ProofOfWork) SetTargetBit(bit int)
func (*ProofOfWork) Setup ¶
func (pow *ProofOfWork) Setup(node core.NetService, cbAddr string)
func (*ProofOfWork) Start ¶
func (pow *ProofOfWork) Start()
func (*ProofOfWork) Stop ¶
func (pow *ProofOfWork) Stop()
type Requirement ¶ added in v0.1.2
Requirement inspects the given block and returns true if it fulfills the requirement
Click to show internal directories.
Click to hide internal directories.