Versions in this module Expand all Collapse all v1 v1.0.0 Jul 29, 2022 Changes in this version + const MaxCollectableEntityNum + const NumGenesisBlocks + const ProposingTimeTolerance + const TimestampToleranceFuture + const TimestampTolerancePast + const TimestampToleranceVariance + var DPB = make(map[uint32][7]float64) + var ErrDuplicateGenerateIDTxn = errors.New("duplicate GenerateID txns") + var ErrDuplicateIssueAssetTxn = errors.New("duplicate IssueAsset txns") + var ErrIDRegistered = errors.New("id has been registered") + var MiningRewards = make(map[uint32]common.Fixed64) + func CanVerifyHeight(height uint32) bool + func GetNextBlockSigner(height uint32, timestamp int64) ([]byte, []byte, pb.WinnerType, error) + func GetNextMiningSigChainTxnHash(height uint32) (common.Uint256, pb.WinnerType, error) + func GetPercentageByDuration(duration uint32) [7]float64 + func GetRewardByHeight(height uint32) (common.Fixed64, [7]common.Fixed64) + func GetSwapRate() int64 + func HeaderCheck(header *block.Header, fastSync bool) error + func NextBlockProposerCheck(header *block.Header) error + func SignerCheck(header *block.Header) error + func TimestampCheck(header *block.Header, soft bool) error + func TransactionCheck(ctx context.Context, block *block.Block, fastSync bool) error + func VerifyTransactionWithLedger(txn *transaction.Transaction, height uint32) error + type BlockValidationState struct + func NewBlockValidationState() *BlockValidationState + func (bvs *BlockValidationState) CleanSubmittedTransactions(txns []*transaction.Transaction) error + func (bvs *BlockValidationState) Close() + func (bvs *BlockValidationState) Commit() + func (bvs *BlockValidationState) GetSubscribers(topic string) []string + func (bvs *BlockValidationState) GetSubscribersWithMeta(topic string) map[string]string + func (bvs *BlockValidationState) RefreshBlockValidationState(txns []*transaction.Transaction) map[common.Uint256]error + func (bvs *BlockValidationState) Reset() + func (bvs *BlockValidationState) VerifyTransactionWithBlock(txn *transaction.Transaction, height uint32) (e error) + type Blockchain struct + AssetID common.Uint256 + BlockHeight uint32 + BlockPersistTime map[common.Uint256]int64 + func NewBlockchain(height uint32, asset common.Uint256) *Blockchain + func NewBlockchainWithGenesisBlock(store ILedgerStore) (*Blockchain, error) + func (bc *Blockchain) AddBlock(block *block.Block, pruning, fastSync bool) error + func (bc *Blockchain) AddHeader(header *block.Header, fastSync bool) error + func (bc *Blockchain) GetHeader(hash common.Uint256) (*block.Header, error) + func (bc *Blockchain) SaveBlock(block *block.Block, pruning, fastSync bool) error + type BuiltinMining struct + func NewBuiltinMining(account *vault.Account, txnCollector *TxnCollector) *BuiltinMining + func (bm *BuiltinMining) BuildBlock(ctx context.Context, height uint32, chordID []byte, winnerHash common.Uint256, ...) (*block.Block, error) + func (bm *BuiltinMining) CreateCoinbaseTransaction(TotalReward common.Fixed64, distributedRewardsPerRole [7]common.Fixed64, ...) *transaction.Transaction + func (bm *BuiltinMining) SignBlock(b *block.Block, timestamp int64) error + type ILedgerStore interface + AddHeader func(header *block.Header) error + Close func() + FastSyncDone func(syncRootHash common.Uint256, fastSyncHeight uint32) error + GenerateStateRoot func(ctx context.Context, b *block.Block, ...) (common.Uint256, error) + GetAsset func(assetID common.Uint256) (name, symbol string, totalSupply common.Fixed64, precision uint32, err error) + GetBalance func(addr common.Uint160) common.Fixed64 + GetBalanceByAssetID func(addr common.Uint160, assetID common.Uint256) common.Fixed64 + GetBlock func(hash common.Uint256) (*block.Block, error) + GetBlockByHeight func(height uint32) (*block.Block, error) + GetBlockHash func(height uint32) (common.Uint256, error) + GetCurrentBlockHash func() common.Uint256 + GetCurrentHeaderHash func() common.Uint256 + GetDatabase func() db.IStore + GetDonation func() (common.Fixed64, error) + GetFastSyncStateRoot func() (common.Uint256, error) + GetHeader func(hash common.Uint256) (*block.Header, error) + GetHeaderByHeight func(height uint32) (*block.Header, error) + GetHeaderHashByHeight func(height uint32) common.Uint256 + GetHeaderHeight func() uint32 + GetHeaderWithCache func(hash common.Uint256) (*block.Header, error) + GetHeight func() uint32 + GetHeightByBlockHash func(hash common.Uint256) (uint32, error) + GetID func(publicKey []byte, height uint32) ([]byte, error) + GetIDVersion func(publicKey []byte) ([]byte, byte, error) + GetName_legacy func(registrant []byte) (string, error) + GetNanoPay func(addr common.Uint160, recipient common.Uint160, nonce uint64) (common.Fixed64, uint32, error) + GetNonce func(addr common.Uint160) uint64 + GetRDCBalance func(addr common.Uint160) common.Fixed64 + GetRegistrant func(name string) ([]byte, uint32, error) + GetRegistrant_legacy func(name string) ([]byte, error) + GetSigChainWithCache func(hash common.Uint256) (*pb.SigChain, error) + GetSubscribers func(topic string, bucket, offset, limit uint32, subscriberHashPrefix []byte, ...) ([]string, error) + GetSubscribersCount func(topic string, bucket uint32, subscriberHashPrefix []byte, ctx context.Context) (int, error) + GetSubscribersWithMeta func(topic string, bucket, offset, limit uint32, subscriberHashPrefix []byte, ...) (map[string]string, error) + GetSubscription func(topic string, bucket uint32, subscriber []byte, identifier string) (string, uint32, error) + GetSyncRootHeight func() (uint32, error) + GetTransaction func(hash common.Uint256) (*transaction.Transaction, error) + InitLedgerStoreWithGenesisBlock func(genesisblock *block.Block) (uint32, error) + IsBlockInStore func(hash common.Uint256) bool + IsDoubleSpend func(tx *transaction.Transaction) bool + IsSubscribed func(topic string, bucket uint32, subscriber []byte, identifier string) (bool, error) + IsTxHashDuplicate func(txhash common.Uint256) bool + PrepareFastSync func(fastSyncHeight uint32, fastSyncRootHash common.Uint256) error + Rollback func(b *block.Block) error + SaveBlock func(b *block.Block, pruning, fastSync bool) error + ShouldFastSync func(syncStopHeight uint32) bool + type Ledger struct + Blockchain *Blockchain + Store ILedgerStore + var DefaultLedger *Ledger + func GetDefaultLedger() (*Ledger, error) + func (l *Ledger) BlockInLedger(hash common.Uint256) bool + func (l *Ledger) GetBlockWithHash(hash common.Uint256) (*block.Block, error) + func (l *Ledger) GetBlockWithHeight(height uint32) (*block.Block, error) + func (l *Ledger) GetLocalBlockChainHeight() uint32 + func (l *Ledger) GetTransactionWithHash(hash common.Uint256) (*transaction.Transaction, error) + func (l *Ledger) IsDoubleSpend(Tx *transaction.Transaction) bool + type Mining interface + BuildBlock func(ctx context.Context, height uint32, chordID []byte, winnerHash common.Uint256, ...) (*block.Block, error) + SignBlock func(b *block.Block, timestamp int64) error + type TransactionArray []*transaction.Transaction + func (iterable TransactionArray) Iterate(handler func(item *transaction.Transaction) error) error + type TxnCollection struct + func NewTxnCollection(txnLists map[common.Uint160][]*transaction.Transaction) *TxnCollection + func (tc *TxnCollection) Peek() *transaction.Transaction + func (tc *TxnCollection) Pop() *transaction.Transaction + func (tc *TxnCollection) Update() error + type TxnCollector struct + TxnNum int + TxnSource TxnSource + func NewTxnCollector(source TxnSource, num int) *TxnCollector + func (tc *TxnCollector) Cleanup(txns []*transaction.Transaction) error + func (tc *TxnCollector) Collect() (*TxnCollection, error) + func (tc *TxnCollector) GetTransaction(hash common.Uint256) *transaction.Transaction + type TxnSource interface + AppendTxnPool func(txn *transaction.Transaction) error + CleanSubmittedTransactions func(txns []*transaction.Transaction) error + GetAllTransactionLists func() map[common.Uint160][]*transaction.Transaction + GetTransaction func(hash common.Uint256) *transaction.Transaction + GetTxnByCount func(num int) (map[common.Uint256]*transaction.Transaction, error) + type VBlock struct + Block *block.Block + ReceiveTime int64