Documentation ¶
Index ¶
- Constants
- Variables
- func CheckProofOfWork(header *network.BlockHeader) bool
- func ComputeMerkleRoot(hashes []*utils.Hash) *utils.Hash
- func DoubleHash(a, b *utils.Hash) *utils.Hash
- func WriteUtxoEntry(writer io.Writer, entry *UtxoEntry) error
- type Block
- type Blockchain
- func (blockchain *Blockchain) CalcNextBlockDifficulty(timestamp time.Time, ancestorTimestamp time.Time, ancestorTarget *big.Int) (*big.Int, error)
- func (blockchain *Blockchain) FetchAllUtxos() (*Utxos, error)
- func (blockchain *Blockchain) FetchStxojEntry(blockHash *utils.Hash) ([]*UtxoEntry, error)
- func (blockchain *Blockchain) FetchUtxos(tx *Tx) (*Utxos, []*network.Outpoint, error)
- func (blockchain *Blockchain) FindBestBlock() (*Block, error)
- func (blockchain *Blockchain) FindBlockByHash(hash *utils.Hash) (*Block, error)
- func (blockchain *Blockchain) FindBlockHashesStartingAt(hash *utils.Hash, limit int) ([]*utils.Hash, error)
- func (blockchain *Blockchain) FindOrphan(hash *utils.Hash) (*Block, error)
- func (blockchain *Blockchain) GenerateBlockLocator() ([]*utils.Hash, error)
- func (blockchain *Blockchain) GetAncestor(blockHash *utils.Hash) (*utils.Hash, error)
- func (blockchain *Blockchain) GetBlockHashAtHeight(height uint32) (*utils.Hash, error)
- func (blockchain *Blockchain) GetFollowing(blockHash *utils.Hash) (*utils.Hash, error)
- func (blockchain *Blockchain) HaveBlock(hash *utils.Hash) (bool, error)
- func (blockchain *Blockchain) Load() error
- func (blockchain *Blockchain) ProcessBlock(block *Block) (error, error)
- func (blockchain *Blockchain) Stop() error
- func (blockchain *Blockchain) ValidateBlock(block *Block) (error, error)
- func (blockchain *Blockchain) Validatetx(tx *Tx, block *Block, utxos *Utxos) (bool, uint64, error)
- type BlockchainStats
- type Config
- type Tx
- type UtxoEntry
- type Utxos
- func (utxos *Utxos) AddEntry(outpoint *network.Outpoint, entry *UtxoEntry)
- func (utxos *Utxos) AddEntryWithTx(outpoint *network.Outpoint, tx *Tx, blockHeight uint32)
- func (utxos *Utxos) FindEntry(outpoint *network.Outpoint) *UtxoEntry
- func (utxos *Utxos) RemoveEntry(outpoint *network.Outpoint) *UtxoEntry
- type ValidationError
Constants ¶
View Source
const FT byte = 0x00
Variables ¶
View Source
var GenesisBlock = genesisBlock
Functions ¶
func CheckProofOfWork ¶
func CheckProofOfWork(header *network.BlockHeader) bool
Types ¶
type Block ¶
type Block struct { Msg *network.BlockMessage Txs []*Tx }
func NewBlockFromBlockMessage ¶
func NewBlockFromBlockMessage(msg *network.BlockMessage) *Block
func (*Block) CalcBlockSubsidy ¶
func (*Block) MarshalBinary ¶
func (*Block) UnmarshalBinary ¶
type Blockchain ¶
type Blockchain struct { GenesisBlock *Block // contains filtered or unexported fields }
func NewBlockchain ¶
func NewBlockchain(config *Config) *Blockchain
func (*Blockchain) CalcNextBlockDifficulty ¶
func (*Blockchain) FetchAllUtxos ¶
func (blockchain *Blockchain) FetchAllUtxos() (*Utxos, error)
func (*Blockchain) FetchStxojEntry ¶
func (blockchain *Blockchain) FetchStxojEntry(blockHash *utils.Hash) ([]*UtxoEntry, error)
func (*Blockchain) FetchUtxos ¶
func (*Blockchain) FindBestBlock ¶
func (blockchain *Blockchain) FindBestBlock() (*Block, error)
func (*Blockchain) FindBlockByHash ¶
func (blockchain *Blockchain) FindBlockByHash(hash *utils.Hash) (*Block, error)
func (*Blockchain) FindBlockHashesStartingAt ¶
func (*Blockchain) FindOrphan ¶
func (blockchain *Blockchain) FindOrphan(hash *utils.Hash) (*Block, error)
func (*Blockchain) GenerateBlockLocator ¶
func (blockchain *Blockchain) GenerateBlockLocator() ([]*utils.Hash, error)
func (*Blockchain) GetAncestor ¶
func (*Blockchain) GetBlockHashAtHeight ¶
func (blockchain *Blockchain) GetBlockHashAtHeight(height uint32) (*utils.Hash, error)
func (*Blockchain) GetFollowing ¶
func (*Blockchain) HaveBlock ¶
func (blockchain *Blockchain) HaveBlock(hash *utils.Hash) (bool, error)
func (*Blockchain) Load ¶
func (blockchain *Blockchain) Load() error
func (*Blockchain) ProcessBlock ¶
func (blockchain *Blockchain) ProcessBlock(block *Block) (error, error)
func (*Blockchain) Stop ¶
func (blockchain *Blockchain) Stop() error
func (*Blockchain) ValidateBlock ¶
func (blockchain *Blockchain) ValidateBlock(block *Block) (error, error)
func (*Blockchain) Validatetx ¶
type BlockchainStats ¶
type Tx ¶
func NewTxFromTxMessage ¶
func (*Tx) IsCoinBase ¶
IsCoinBase returns true if the transaction is a coinbase.
type UtxoEntry ¶
type UtxoEntry struct {
// contains filtered or unexported fields
}
func (*UtxoEntry) BlockHeight ¶
func (*UtxoEntry) IsCoinBase ¶
func (*UtxoEntry) MarshalBinary ¶
func (*UtxoEntry) UnmarshalBinary ¶
type Utxos ¶
type Utxos struct {
// contains filtered or unexported fields
}
func (*Utxos) AddEntryWithTx ¶
type ValidationError ¶
type ValidationError struct {
Reason string
}
func (*ValidationError) Error ¶
func (err *ValidationError) Error() string
Click to show internal directories.
Click to hide internal directories.