Documentation ¶
Index ¶
- type Blockchain
- func (b *Blockchain) GetBlockByHash(hash *felt.Felt) (block *core.Block, err error)
- func (b *Blockchain) GetBlockByNumber(number uint64) (block *core.Block, err error)
- func (b *Blockchain) GetBlockHeaderByHash(hash *felt.Felt) (header *core.Header, err error)
- func (b *Blockchain) GetBlockHeaderByNumber(number uint64) (header *core.Header, err error)
- func (b *Blockchain) GetReceipt(hash *felt.Felt) (receipt *core.TransactionReceipt, blockHash *felt.Felt, blockNumber uint64, ...)
- func (b *Blockchain) GetStateUpdateByHash(hash *felt.Felt) (update *core.StateUpdate, err error)
- func (b *Blockchain) GetStateUpdateByNumber(number uint64) (update *core.StateUpdate, err error)
- func (b *Blockchain) GetTransactionByBlockNumberAndIndex(blockNumber, index uint64) (transaction core.Transaction, err error)
- func (b *Blockchain) GetTransactionByHash(hash *felt.Felt) (transaction core.Transaction, err error)
- func (b *Blockchain) Head() (head *core.Block, err error)
- func (b *Blockchain) HeadsHeader() (*core.Header, error)
- func (b *Blockchain) Height() (height uint64, err error)
- func (b *Blockchain) Network() utils.Network
- func (b *Blockchain) SanityCheckNewHeight(block *core.Block, stateUpdate *core.StateUpdate) error
- func (b *Blockchain) StateCommitment() (commitment *felt.Felt, err error)
- func (b *Blockchain) Store(block *core.Block, stateUpdate *core.StateUpdate, ...) error
- func (b *Blockchain) VerifyBlock(block *core.Block) error
- type ErrIncompatibleBlock
- type ErrIncompatibleBlockAndStateUpdate
- type Reader
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Blockchain ¶
type Blockchain struct {
// contains filtered or unexported fields
}
Blockchain is responsible for keeping track of all things related to the Starknet blockchain
func (*Blockchain) GetBlockByHash ¶
func (*Blockchain) GetBlockByNumber ¶
func (b *Blockchain) GetBlockByNumber(number uint64) (block *core.Block, err error)
func (*Blockchain) GetBlockHeaderByHash ¶
func (*Blockchain) GetBlockHeaderByNumber ¶
func (b *Blockchain) GetBlockHeaderByNumber(number uint64) (header *core.Header, err error)
func (*Blockchain) GetReceipt ¶
func (b *Blockchain) GetReceipt(hash *felt.Felt) (receipt *core.TransactionReceipt, blockHash *felt.Felt, blockNumber uint64, err error)
GetReceipt gets the transaction receipt for a given transaction hash.
func (*Blockchain) GetStateUpdateByHash ¶
func (b *Blockchain) GetStateUpdateByHash(hash *felt.Felt) (update *core.StateUpdate, err error)
func (*Blockchain) GetStateUpdateByNumber ¶
func (b *Blockchain) GetStateUpdateByNumber(number uint64) (update *core.StateUpdate, err error)
func (*Blockchain) GetTransactionByBlockNumberAndIndex ¶
func (b *Blockchain) GetTransactionByBlockNumberAndIndex(blockNumber, index uint64) (transaction core.Transaction, err error)
GetTransactionByBlockNumberAndIndex gets the transaction for a given block number and index.
func (*Blockchain) GetTransactionByHash ¶
func (b *Blockchain) GetTransactionByHash(hash *felt.Felt) (transaction core.Transaction, err error)
GetTransactionByHash gets the transaction for a given hash.
func (*Blockchain) HeadsHeader ¶
func (b *Blockchain) HeadsHeader() (*core.Header, error)
func (*Blockchain) Height ¶
func (b *Blockchain) Height() (height uint64, err error)
Height returns the latest block height. If blockchain is empty nil is returned.
func (*Blockchain) Network ¶
func (b *Blockchain) Network() utils.Network
func (*Blockchain) SanityCheckNewHeight ¶
func (b *Blockchain) SanityCheckNewHeight(block *core.Block, stateUpdate *core.StateUpdate) error
SanityCheckNewHeight checks integrity of a block and resulting state update
func (*Blockchain) StateCommitment ¶
func (b *Blockchain) StateCommitment() (commitment *felt.Felt, err error)
StateCommitment returns the latest block state commitment. If blockchain is empty zero felt is returned.
func (*Blockchain) Store ¶
func (b *Blockchain) Store(block *core.Block, stateUpdate *core.StateUpdate, declaredClasses map[felt.Felt]*core.Class) error
Store takes a block and state update and performs sanity checks before putting in the database.
func (*Blockchain) VerifyBlock ¶
func (b *Blockchain) VerifyBlock(block *core.Block) error
VerifyBlock assumes the block has already been sanity-checked.
type ErrIncompatibleBlock ¶
type ErrIncompatibleBlock struct {
Err error
}
func (ErrIncompatibleBlock) Error ¶
func (e ErrIncompatibleBlock) Error() string
func (ErrIncompatibleBlock) Unwrap ¶
func (e ErrIncompatibleBlock) Unwrap() error
type ErrIncompatibleBlockAndStateUpdate ¶
type ErrIncompatibleBlockAndStateUpdate struct {
Err error
}
func (ErrIncompatibleBlockAndStateUpdate) Error ¶
func (e ErrIncompatibleBlockAndStateUpdate) Error() string
func (ErrIncompatibleBlockAndStateUpdate) Unwrap ¶
func (e ErrIncompatibleBlockAndStateUpdate) Unwrap() error
type Reader ¶
type Reader interface { Height() (height uint64, err error) Head() (head *core.Block, err error) GetBlockByNumber(number uint64) (block *core.Block, err error) GetBlockByHash(hash *felt.Felt) (block *core.Block, err error) HeadsHeader() (header *core.Header, err error) GetBlockHeaderByNumber(number uint64) (header *core.Header, err error) GetBlockHeaderByHash(hash *felt.Felt) (header *core.Header, err error) GetTransactionByHash(hash *felt.Felt) (transaction core.Transaction, err error) GetTransactionByBlockNumberAndIndex(blockNumber, index uint64) (transaction core.Transaction, err error) GetReceipt(hash *felt.Felt) (receipt *core.TransactionReceipt, blockHash *felt.Felt, blockNumber uint64, err error) GetStateUpdateByNumber(number uint64) (update *core.StateUpdate, err error) GetStateUpdateByHash(hash *felt.Felt) (update *core.StateUpdate, err error) }