Documentation
¶
Index ¶
- type Block
- type BlockHeader
- type Chain
- func (c *Chain) AddBlock(block *Block) error
- func (c *Chain) AddTransaction(tx types.Transaction) error
- func (c *Chain) GetBlock(height uint64) (*Block, error)
- func (c *Chain) GetHeight() uint64
- func (c *Chain) GetTransaction(hash types.Hash) (*types.Transaction, error)
- func (c *Chain) Start(ctx context.Context) error
- type ConsensusParams
- type CrossChainData
- type Transaction
- func (tx *Transaction) Decode(data []byte) error
- func (tx *Transaction) Encode() ([]byte, error)
- func (tx *Transaction) GasCost() uint64
- func (tx *Transaction) Hash() types.Hash
- func (tx *Transaction) Sign(privateKey []byte) error
- func (tx *Transaction) TotalCost() uint64
- func (tx *Transaction) Verify() error
- type TxPool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Block ¶
type Block struct {
Height uint64
Timestamp time.Time
PreviousHash types.Hash
Transactions []types.Transaction
StateRoot types.Hash
ValidatorSet []types.ValidatorAddress
Signature []byte
Hash types.Hash
}
func (*Block) CalculateHash ¶
func (*Block) GetHeader ¶
func (b *Block) GetHeader() BlockHeader
type BlockHeader ¶
type Chain ¶
type Chain struct {
ID string
// contains filtered or unexported fields
}
func NewChain ¶
func NewChain(id string, store store.BlockStore, params ConsensusParams) *Chain
func (*Chain) AddTransaction ¶
func (c *Chain) AddTransaction(tx types.Transaction) error
func (*Chain) GetTransaction ¶
type ConsensusParams ¶
type CrossChainData ¶
type Transaction ¶
type Transaction struct {
Version uint32
SourceChain string
DestChain string
Nonce uint64
From types.Address
To types.Address
Amount uint64
Gas uint64
GasPrice uint64
Data []byte
Timestamp time.Time
Signature []byte
}
func NewTransaction ¶
func (*Transaction) Decode ¶
func (tx *Transaction) Decode(data []byte) error
func (*Transaction) Encode ¶
func (tx *Transaction) Encode() ([]byte, error)
func (*Transaction) GasCost ¶
func (tx *Transaction) GasCost() uint64
func (*Transaction) Hash ¶
func (tx *Transaction) Hash() types.Hash
func (*Transaction) Sign ¶
func (tx *Transaction) Sign(privateKey []byte) error
func (*Transaction) TotalCost ¶
func (tx *Transaction) TotalCost() uint64
func (*Transaction) Verify ¶
func (tx *Transaction) Verify() error
type TxPool ¶
type TxPool struct {
// contains filtered or unexported fields
}
func (*TxPool) GetPending ¶
func (p *TxPool) GetPending(limit uint64) []types.Transaction
Click to show internal directories.
Click to hide internal directories.