Documentation ¶
Overview ¶
Package chain implements IPFN rootchain.
Index ¶
- func MinDelegatedPower(total uint64) uint64
- func SealPower(delegated uint64) uint64
- type Block
- func (block *Block) EnsureHead() error
- func (block *Block) Exec(op cells.Cell)
- func (block *Block) ExecSize() int
- func (block *Block) HeadHash() *cells.CID
- func (block *Block) Header() (*BlockHeader, error)
- func (block *Block) Height() uint64
- func (block *Block) IsGenesis() bool
- func (block *Block) MarshalJSON() ([]byte, error)
- func (block *Block) Next(opsRoot cells.MutableCell) (*Block, error)
- func (block *Block) PrevHash() *cells.CID
- func (block *Block) Root() cells.Cell
- func (block *Block) Seal() *SignedBlock
- func (block *Block) SetStateHash(c *cells.CID)
- func (block *Block) StateHash() *cells.CID
- type BlockHeader
- type Chain
- type SignedBlock
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MinDelegatedPower ¶
MinDelegatedPower - Returns amount of minimum power delegated.
Types ¶
type Block ¶
type Block struct {
// contains filtered or unexported fields
}
Block - Chain block.
func (*Block) Header ¶
func (block *Block) Header() (*BlockHeader, error)
Header - Creates block header.
func (*Block) MarshalJSON ¶
MarshalJSON - Marshals state to JSON.
func (*Block) SetStateHash ¶
func (block *Block) SetStateHash(c *cells.CID)
SetStateHash - Sets state hash. Resets head hash and signatures.
type BlockHeader ¶
type BlockHeader struct { // Height - Block height. Height uint64 `json:"height,omitempty"` // Timestamp - Block time. Timestamp time.Time `json:"timestamp,omitempty"` // HeadHash - Head content ID. HeadHash *cells.CID `json:"head_hash,omitempty"` // PrevHash - Previous block head hash. PrevHash *cells.CID `json:"prev_hash,omitempty"` // ExecHash - Block execution hash. ExecHash *cells.CID `json:"exec_hash,omitempty"` // StateHash - State trie hash. StateHash *cells.CID `json:"state_hash,omitempty"` // SignedHash - Signed head hash. SignedHash *cells.CID `json:"signed_hash,omitempty"` }
BlockHeader - Block header.
type SignedBlock ¶
type SignedBlock struct { *Block // contains filtered or unexported fields }
SignedBlock - Signed chain block.
func NewSignedBlock ¶
func NewSignedBlock(block *Block) *SignedBlock
NewSignedBlock - Creates new signed block.
func (*SignedBlock) Header ¶
func (block *SignedBlock) Header() (header *BlockHeader, err error)
Header - Creates block header with signed hash.
func (*SignedBlock) MarshalJSON ¶
func (block *SignedBlock) MarshalJSON() ([]byte, error)
MarshalJSON - Marshals state to JSON.
func (*SignedBlock) Sign ¶
func (block *SignedBlock) Sign(key *btcec.PrivateKey) (err error)
Sign - Signs state with given private key. Computes new signed header hash.
func (*SignedBlock) Signatures ¶
func (block *SignedBlock) Signatures() [][]byte
Signatures - Returns state signatures.
func (*SignedBlock) SignedHash ¶
func (block *SignedBlock) SignedHash() *cells.CID
SignedHash - Returns signed head CID.
Click to show internal directories.
Click to hide internal directories.