Documentation
¶
Index ¶
- Constants
- func IsValidPoS(block *Block, stake *big.Int) bool
- type Block
- type Chain
- type Persistance
- func (p *Persistance) Get(key []byte) ([]byte, error)
- func (p *Persistance) GetLastHash() ([]byte, error)
- func (p *Persistance) Init(path string, genesisFn func() (Serializable, []byte)) ([]byte, error)
- func (p *Persistance) Iterate(prefix []byte, block Serializable, callback func(value []byte) error) error
- func (p *Persistance) SaveBlock(hash []byte, block Serializable) error
- type ProofOfStake
- type Serializable
Constants ¶
View Source
const Difficulty = int64(21)
Difficulty Implementation of the difficulty rate
View Source
const (
KeyLastHash = "last_hash"
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Block ¶
type Block struct { Data []byte // this block's data Hash []byte // this block's hash Link []byte // the hash of the last block in the chain. this is the key part that links the blocks together Nonce int64 // the nonce used to sing the block. useful for verification }
func (*Block) Deserialize ¶
type Chain ¶
type Chain struct { LastHash []byte // contains filtered or unexported fields }
func (*Chain) GetLastBlock ¶
func (*Chain) IterateLink ¶
func (*Chain) UpdateLastHash ¶
type Persistance ¶
type Persistance struct {
// contains filtered or unexported fields
}
func (*Persistance) GetLastHash ¶
func (p *Persistance) GetLastHash() ([]byte, error)
func (*Persistance) Init ¶
func (p *Persistance) Init(path string, genesisFn func() (Serializable, []byte)) ([]byte, error)
func (*Persistance) Iterate ¶
func (p *Persistance) Iterate(prefix []byte, block Serializable, callback func(value []byte) error) error
func (*Persistance) SaveBlock ¶
func (p *Persistance) SaveBlock(hash []byte, block Serializable) error
type ProofOfStake ¶
func (*ProofOfStake) Run ¶
func (pos *ProofOfStake) Run() (int64, []byte)
Click to show internal directories.
Click to hide internal directories.