Documentation ¶
Index ¶
- Constants
- func ApplyTx(tx SignedTx, s *State) error
- func InitDataDirIfNotExists(dataDir string, genesis []byte) error
- func IsBlockHashValid(hash Hash, miningDifficulty uint) bool
- func NewAccount(value string) common.Address
- func ValidateTx(tx SignedTx, s *State) error
- type Block
- type BlockFS
- type BlockHeader
- type Genesis
- type Hash
- type SignedTx
- type State
- func (s *State) AddBlock(b Block) (Hash, error)
- func (s *State) ChangeMiningDifficulty(newDifficulty uint)
- func (s *State) Close() error
- func (s *State) Copy() State
- func (s *State) GetBlocks() ([]Block, error)
- func (s *State) GetForkedBlock(peerBlocks []Block) (Block, error)
- func (s *State) GetNextAccountNonce(account common.Address) uint
- func (s *State) LatestBlock() Block
- func (s *State) LatestBlockHash() Hash
- func (s *State) NextBlockNumber() uint64
- func (s *State) RemoveBlocks(fromBlock Block) error
- type Tx
Constants ¶
View Source
const BlockReward = 100
View Source
const TxFee = uint(50)
Variables ¶
This section is empty.
Functions ¶
func InitDataDirIfNotExists ¶
func IsBlockHashValid ¶
func NewAccount ¶
func ValidateTx ¶
Types ¶
type Block ¶
type Block struct { Header BlockHeader `json:"header"` TXs []SignedTx `json:"payload"` }
type BlockFS ¶
func GetBlockByHeightOrHash ¶
GetBlockByHeightOrHash returns the requested block by hash or height. It uses cached data in the State struct (HashCache / HeightCache)
type BlockHeader ¶
type State ¶
type State struct { Balances map[common.Address]uint Account2Nonce map[common.Address]uint // position of block in file db HashCache map[string]int64 HeightCache map[uint64]int64 // contains filtered or unexported fields }
func NewStateFromDisk ¶
func (*State) ChangeMiningDifficulty ¶
func (*State) GetNextAccountNonce ¶
func (*State) LatestBlock ¶
func (*State) LatestBlockHash ¶
func (*State) NextBlockNumber ¶
func (*State) RemoveBlocks ¶
Click to show internal directories.
Click to hide internal directories.