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) AddBlocks(blocks []Block) error
- func (s *State) ChangeMiningDifficulty(newDifficulty uint)
- func (s *State) Close() error
- func (s *State) Copy() State
- func (s *State) GetNextAccountNonce(account common.Address) uint
- func (s *State) LatestBlock() Block
- func (s *State) LatestBlockHash() Hash
- func (s *State) NextBlockNumber() uint64
- type Tx
Constants ¶
View Source
const BlockReward = 100
View Source
const TxFee = uint(50)
View Source
const TxGas = 1
View Source
const TxGasPriceDefault = 1
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 BlockHeader ¶
type State ¶
type State struct { Balances map[common.Address]uint AccountToNonce map[common.Address]uint 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 ¶
type Tx ¶
type Tx struct { From common.Address `json:"from"` To common.Address `json:"to"` Gas uint `json:"gas"` GasPrice uint `json:"gas_price"` Value uint `json:"value"` Nonce uint `json:"nonce"` Data string `json:"data"` Time uint64 `json:"time"` }
func (Tx) MarshalJSON ¶
MarshalJson is the source of truth when it comes to encoding a transactionfor hash calculations
Click to show internal directories.
Click to hide internal directories.