Documentation ¶
Index ¶
- func CreateGenesisBlock(balanceAlloc map[string]*big.Int, db *dbstore.DB) *types.Block
- func StartBlockchain(config *config.Config)
- type Blockchain
- func (bc *Blockchain) AddBlock(data []byte, txs []*types.Transaction, mineInterrupt chan bool, ...) error
- func (bc *Blockchain) AddExternalBlock(block *types.Block) error
- func (bc *Blockchain) Current() *types.Block
- func (bc *Blockchain) GetBlockByHash(h *util.Hash) (*types.Block, error)
- func (bc *Blockchain) GetBlockByNumber(b *big.Int) (*types.Block, error)
- func (bc *Blockchain) ImportBlockLoop()
- func (bc *Blockchain) RemoveLastBlock()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateGenesisBlock ¶
Mine the genesis block and do initial balance allocation.
func StartBlockchain ¶
Types ¶
type Blockchain ¶
type Blockchain struct { LastBlock *types.Block Consensus consensus.Consensus Mutex *sync.RWMutex LastHash *util.Hash BlockchainDb *dbstore.BlockchainDB StateDB *dbstore.StateDB Txpool *txpool.TxPool RPCServer *rpc.RPCServer TxProcessor *executer.TxProcessor Signer *util.Address P2PServer *p2p.P2PServer TxpoolCh chan *types.Transaction BlockCh chan *types.Block TxpoolChSize int BlockChSize int MineInterrupt chan bool MineInterruptSize int }
func NewBlockchain ¶
func NewBlockchain(c *config.Config) *Blockchain
NewBlockchain creates a new blockchain with the given config.
func (*Blockchain) AddBlock ¶
func (bc *Blockchain) AddBlock(data []byte, txs []*types.Transaction, mineInterrupt chan bool, signerPrivateKey *ecdsa.PrivateKey) error
AddBlock mines and adds a new block to the blockchain.
func (*Blockchain) AddExternalBlock ¶
func (bc *Blockchain) AddExternalBlock(block *types.Block) error
AddBlock mines and adds a new block to the blockchain.
func (*Blockchain) Current ¶
func (bc *Blockchain) Current() *types.Block
Current returns the current block in the blockchain.
func (*Blockchain) GetBlockByHash ¶
GetBlockByHash returns the block with the given block hash.
func (*Blockchain) GetBlockByNumber ¶
GetBlockByNumber returns the block with the given block number.
func (*Blockchain) ImportBlockLoop ¶
func (bc *Blockchain) ImportBlockLoop()
func (*Blockchain) RemoveLastBlock ¶
func (bc *Blockchain) RemoveLastBlock()
Click to show internal directories.
Click to hide internal directories.