Versions in this module Expand all Collapse all v0 v0.0.15 Dec 13, 2023 Changes in this version + const Claim + const DefaultFreeClaimDuration + const DefaultFreeClaimStorage + const DefaultFreeClaimUnits + const DefaultLookbackWindow + const DefaultValueUnitSize + const Delete + const HashLen + const Lifeline + const LotteryRewardDivisor + const MinBlockCost + const Move + const Reward + const Set + const Transfer + var CompactRanges = []*CompactRange + var ErrAddressMismatch = errors.New("address does not match decoded space") + var ErrBlockTooBig = errors.New("block too big") + var ErrDuplicateTx = errors.New("duplicate transaction") + var ErrInsufficientPrice = errors.New("insufficient price") + var ErrInsufficientSurplus = errors.New("insufficient surplus fee") + var ErrInvalidBalance = errors.New("invalid balance") + var ErrInvalidBlockID = errors.New("invalid blockID") + var ErrInvalidBlockRate = errors.New("invalid block rate") + var ErrInvalidCost = errors.New("invalid block cost") + var ErrInvalidKey = errors.New("key is invalid") + var ErrInvalidKeyFormat = errors.New("invalid key format") + var ErrInvalidMagic = errors.New("invalid magic") + var ErrInvalidPrice = errors.New("invalid price") + var ErrInvalidSignature = errors.New("invalid signature") + var ErrInvalidType = errors.New("invalid tx type") + var ErrKeyMissing = errors.New("key missing") + var ErrNoTxs = errors.New("no transactions") + var ErrNonActionable = errors.New("transaction doesn't do anything") + var ErrParentBlockNotVerified = errors.New("parent block not verified or accepted") + var ErrSpaceExpired = errors.New("space expired") + var ErrSpaceMissing = errors.New("space missing") + var ErrSpaceNotExpired = errors.New("space not expired") + var ErrTimestampTooEarly = errors.New("block timestamp too early") + var ErrTimestampTooLate = errors.New("block timestamp too late") + var ErrTypedDataKeyMissing = errors.New("typed data key missing") + var ErrUnauthorized = errors.New("sender is not authorized") + var ErrValueEmpty = errors.New("value empty") + var ErrValueTooBig = errors.New("value too big") + func ApplyReward(db database.Database, blkID ids.ID, txID ids.ID, sender common.Address, ...) (common.Address, bool, error) + func BuildBlock(vm VM, preferred ids.ID) (snowman.Block, error) + func CompactablePrefixKey(pfx byte) []byte + func DeleteSpaceKey(db database.Database, space []byte, key []byte) error + func DeriveSender(dh []byte, sig []byte) (*ecdsa.PublicKey, error) + func DigestHash(utx UnsignedTransaction) ([]byte, error) + func ExpireNext(db database.Database, rparent int64, rcurrent int64, bootstrapped bool) (err error) + func ExpiryDataValue(address common.Address, space []byte) (v []byte) + func GetAllOwned(db database.Database, owner common.Address) (spaces []string, err error) + func GetBalance(db database.KeyValueReader, address common.Address) (uint64, error) + func GetLastAccepted(db database.KeyValueReader) (ids.ID, error) + func GetValue(db database.KeyValueReader, space []byte, key []byte) ([]byte, bool, error) + func HasLastAccepted(db database.Database) (bool, error) + func HasSpace(db database.KeyValueReader, space []byte) (bool, error) + func HasSpaceKey(db database.KeyValueReader, space []byte, key []byte) (bool, error) + func HasTransaction(db database.KeyValueReader, txID ids.ID) (bool, error) + func Marshal(source interface{}) ([]byte, error) + func ModifyBalance(db database.KeyValueReaderWriter, address common.Address, add bool, ...) (uint64, error) + func MoveSpaceInfo(db database.KeyValueWriterDeleter, oldOwner common.Address, space []byte, ...) error + func PrefixBalanceKey(address common.Address) (k []byte) + func PrefixBlockKey(blockID ids.ID) (k []byte) + func PrefixExpiryKey(expiry uint64, rspace ids.ShortID) (k []byte) + func PrefixOwnedKey(address common.Address, space []byte) (k []byte) + func PrefixPruningKey(expired uint64, rspace ids.ShortID) (k []byte) + func PrefixTxKey(txID ids.ID) (k []byte) + func PrefixTxValueKey(txID ids.ID) (k []byte) + func PruneNext(db database.Database, limit int) (removals int, err error) + func PutSpaceInfo(db database.KeyValueWriterDeleter, space []byte, i *SpaceInfo, ...) error + func PutSpaceKey(db database.KeyValueReaderWriter, space []byte, key []byte, vmeta *ValueMeta) error + func RangeTimeKey(p byte, t uint64) (k []byte) + func RawSpace(space []byte, blockTime uint64) (ids.ShortID, error) + func SetBalance(db database.KeyValueWriter, address common.Address, bal uint64) error + func SetLastAccepted(db database.KeyValueWriter, block *StatelessBlock) error + func SetTransaction(db database.KeyValueWriter, tx *Transaction) error + func Sign(dh []byte, priv *ecdsa.PrivateKey) ([]byte, error) + func SpaceInfoKey(space []byte) (k []byte) + func SpaceValueKey(rspace ids.ShortID, key []byte) (k []byte) + func Unmarshal(source []byte, destination interface{}) (uint16, error) + type Activity struct + Key string + Sender string + Space string + Tmstmp int64 + To string + TxID ids.ID + Typ string + Units uint64 + type Airdrop struct + Address common.Address + type BaseTx struct + BlockID ids.ID + Magic uint64 + Price uint64 + func (b *BaseTx) Copy() *BaseTx + func (b *BaseTx) ExecuteBase(g *Genesis) error + func (b *BaseTx) FeeUnits(g *Genesis) uint64 + func (b *BaseTx) GetBlockID() ids.ID + func (b *BaseTx) GetMagic() uint64 + func (b *BaseTx) GetPrice() uint64 + func (b *BaseTx) LoadUnits(g *Genesis) uint64 + func (b *BaseTx) SetBlockID(bid ids.ID) + func (b *BaseTx) SetMagic(magic uint64) + func (b *BaseTx) SetPrice(price uint64) + type ClaimTx struct + Space string + func (c *ClaimTx) Activity() *Activity + func (c *ClaimTx) Copy() UnsignedTransaction + func (c *ClaimTx) Execute(t *TransactionContext) error + func (c *ClaimTx) FeeUnits(g *Genesis) uint64 + func (c *ClaimTx) LoadUnits(g *Genesis) uint64 + func (c *ClaimTx) TypedData() *tdata.TypedData + type CompactRange struct + Limit []byte + Start []byte + type Context struct + Costs []uint64 + NextCost uint64 + NextPrice uint64 + Prices []uint64 + RecentBlockIDs set.Set[ids.ID] + RecentLoadUnits uint64 + RecentTxIDs set.Set[ids.ID] + type CustomAllocation struct + Address common.Address + Balance uint64 + type DeleteTx struct + Key string + Space string + func (d *DeleteTx) Activity() *Activity + func (d *DeleteTx) Copy() UnsignedTransaction + func (d *DeleteTx) Execute(t *TransactionContext) error + func (d *DeleteTx) TypedData() *tdata.TypedData + type Genesis struct + AirdropHash string + AirdropUnits uint64 + BaseTxUnits uint64 + BlockCostEnabled bool + ClaimExpiryUnits uint64 + ClaimLoadMultiplier uint64 + ClaimReward uint64 + CustomAllocation []*CustomAllocation + LookbackWindow int64 + LotteryRewardMultipler uint64 + Magic uint64 + MaxBlockSize uint64 + MaxValueSize uint64 + MinClaimFee uint64 + MinPrice uint64 + SpaceDesirabilityMultiplier uint64 + SpaceRenewalDiscount uint64 + TargetBlockRate int64 + TargetBlockSize uint64 + ValueExpiryDiscount uint64 + ValueUnitSize uint64 + func DefaultGenesis() *Genesis + func (g *Genesis) Load(db database.Database, airdropData []byte) error + func (g *Genesis) StatefulBlock() *StatefulBlock + func (g *Genesis) Verify() error + type Input struct + Key string + Space string + To common.Address + Typ string + Units uint64 + Value []byte + func (i *Input) Decode() (UnsignedTransaction, error) + type KeyValueMeta struct + Key string + ValueMeta *ValueMeta + func GetAllValueMetas(db database.Database, rspace ids.ShortID) (kvs []*KeyValueMeta, err error) + type LifelineTx struct + Space string + Units uint64 + func (l *LifelineTx) Activity() *Activity + func (l *LifelineTx) Copy() UnsignedTransaction + func (l *LifelineTx) Execute(t *TransactionContext) error + func (l *LifelineTx) FeeUnits(g *Genesis) uint64 + func (l *LifelineTx) LoadUnits(g *Genesis) uint64 + func (l *LifelineTx) TypedData() *tdata.TypedData + type Mempool interface + Add func(*Transaction) bool + Len func() int + NewTxs func(uint64) []*Transaction + PopMax func() (*Transaction, uint64) + Prune func(set.Set[ids.ID]) + type MockMempool struct + func NewMockMempool(ctrl *gomock.Controller) *MockMempool + func (m *MockMempool) Add(arg0 *Transaction) bool + func (m *MockMempool) EXPECT() *MockMempoolMockRecorder + func (m *MockMempool) Len() int + func (m *MockMempool) NewTxs(arg0 uint64) []*Transaction + func (m *MockMempool) PopMax() (*Transaction, uint64) + func (m *MockMempool) Prune(arg0 set.Set[ids.ID]) + type MockMempoolMockRecorder struct + func (mr *MockMempoolMockRecorder) Add(arg0 interface{}) *gomock.Call + func (mr *MockMempoolMockRecorder) Len() *gomock.Call + func (mr *MockMempoolMockRecorder) NewTxs(arg0 interface{}) *gomock.Call + func (mr *MockMempoolMockRecorder) PopMax() *gomock.Call + func (mr *MockMempoolMockRecorder) Prune(arg0 interface{}) *gomock.Call + type MockUnsignedTransaction struct + func NewMockUnsignedTransaction(ctrl *gomock.Controller) *MockUnsignedTransaction + func (m *MockUnsignedTransaction) Activity() *Activity + func (m *MockUnsignedTransaction) Copy() UnsignedTransaction + func (m *MockUnsignedTransaction) EXPECT() *MockUnsignedTransactionMockRecorder + func (m *MockUnsignedTransaction) Execute(arg0 *TransactionContext) error + func (m *MockUnsignedTransaction) ExecuteBase(arg0 *Genesis) error + func (m *MockUnsignedTransaction) FeeUnits(arg0 *Genesis) uint64 + func (m *MockUnsignedTransaction) GetBlockID() ids.ID + func (m *MockUnsignedTransaction) GetMagic() uint64 + func (m *MockUnsignedTransaction) GetPrice() uint64 + func (m *MockUnsignedTransaction) LoadUnits(arg0 *Genesis) uint64 + func (m *MockUnsignedTransaction) SetBlockID(arg0 ids.ID) + func (m *MockUnsignedTransaction) SetMagic(arg0 uint64) + func (m *MockUnsignedTransaction) SetPrice(arg0 uint64) + func (m *MockUnsignedTransaction) TypedData() *tdata.TypedData + type MockUnsignedTransactionMockRecorder struct + func (mr *MockUnsignedTransactionMockRecorder) Activity() *gomock.Call + func (mr *MockUnsignedTransactionMockRecorder) Copy() *gomock.Call + func (mr *MockUnsignedTransactionMockRecorder) Execute(arg0 interface{}) *gomock.Call + func (mr *MockUnsignedTransactionMockRecorder) ExecuteBase(arg0 interface{}) *gomock.Call + func (mr *MockUnsignedTransactionMockRecorder) FeeUnits(arg0 interface{}) *gomock.Call + func (mr *MockUnsignedTransactionMockRecorder) GetBlockID() *gomock.Call + func (mr *MockUnsignedTransactionMockRecorder) GetMagic() *gomock.Call + func (mr *MockUnsignedTransactionMockRecorder) GetPrice() *gomock.Call + func (mr *MockUnsignedTransactionMockRecorder) LoadUnits(arg0 interface{}) *gomock.Call + func (mr *MockUnsignedTransactionMockRecorder) SetBlockID(arg0 interface{}) *gomock.Call + func (mr *MockUnsignedTransactionMockRecorder) SetMagic(arg0 interface{}) *gomock.Call + func (mr *MockUnsignedTransactionMockRecorder) SetPrice(arg0 interface{}) *gomock.Call + func (mr *MockUnsignedTransactionMockRecorder) TypedData() *gomock.Call + type MockVM struct + func NewMockVM(ctrl *gomock.Controller) *MockVM + func (m *MockVM) Accepted(arg0 *StatelessBlock) + func (m *MockVM) EXPECT() *MockVMMockRecorder + func (m *MockVM) ExecutionContext(currentTime int64, parent *StatelessBlock) (*Context, error) + func (m *MockVM) Genesis() *Genesis + func (m *MockVM) GetStatelessBlock(arg0 ids.ID) (*StatelessBlock, error) + func (m *MockVM) IsBootstrapped() bool + func (m *MockVM) Mempool() Mempool + func (m *MockVM) Rejected(arg0 *StatelessBlock) + func (m *MockVM) State() database.Database + func (m *MockVM) Verified(arg0 *StatelessBlock) + type MockVMMockRecorder struct + func (mr *MockVMMockRecorder) Accepted(arg0 interface{}) *gomock.Call + func (mr *MockVMMockRecorder) ExecutionContext(currentTime, parent interface{}) *gomock.Call + func (mr *MockVMMockRecorder) Genesis() *gomock.Call + func (mr *MockVMMockRecorder) GetStatelessBlock(arg0 interface{}) *gomock.Call + func (mr *MockVMMockRecorder) IsBootstrapped() *gomock.Call + func (mr *MockVMMockRecorder) Mempool() *gomock.Call + func (mr *MockVMMockRecorder) Rejected(arg0 interface{}) *gomock.Call + func (mr *MockVMMockRecorder) State() *gomock.Call + func (mr *MockVMMockRecorder) Verified(arg0 interface{}) *gomock.Call + type MoveTx struct + Space string + To common.Address + func (m *MoveTx) Activity() *Activity + func (m *MoveTx) Copy() UnsignedTransaction + func (m *MoveTx) Execute(c *TransactionContext) error + func (m *MoveTx) TypedData() *tdata.TypedData + type SetTx struct + Key string + Space string + Value []byte + func (s *SetTx) Activity() *Activity + func (s *SetTx) Copy() UnsignedTransaction + func (s *SetTx) Execute(t *TransactionContext) error + func (s *SetTx) FeeUnits(g *Genesis) uint64 + func (s *SetTx) LoadUnits(g *Genesis) uint64 + func (s *SetTx) TypedData() *tdata.TypedData + type SpaceInfo struct + Created uint64 + Expiry uint64 + Owner common.Address + RawSpace ids.ShortID + Units uint64 + Updated uint64 + func GetSpaceInfo(db database.KeyValueReader, space []byte) (*SpaceInfo, bool, error) + type StatefulBlock struct + Cost uint64 + Hght uint64 + Price uint64 + Prnt ids.ID + Tmstmp int64 + Txs []*Transaction + func GetBlock(db database.KeyValueReader, bid ids.ID) (*StatefulBlock, error) + func (b *StatefulBlock) Dummy() bool + type StatelessBlock struct + Winners map[ids.ID]*Activity + func DummyBlock(tmstp int64, tx *Transaction) *StatelessBlock + func NewBlock(vm VM, parent snowman.Block, tmstp int64, context *Context) *StatelessBlock + func ParseBlock(source []byte, status choices.Status, vm VM) (*StatelessBlock, error) + func ParseStatefulBlock(blk *StatefulBlock, source []byte, status choices.Status, vm VM) (*StatelessBlock, error) + func (b *StatelessBlock) Accept(ctx context.Context) error + func (b *StatelessBlock) Bytes() []byte + func (b *StatelessBlock) Height() uint64 + func (b *StatelessBlock) ID() ids.ID + func (b *StatelessBlock) Parent() ids.ID + func (b *StatelessBlock) Reject(ctx context.Context) error + func (b *StatelessBlock) SetChildrenDB(db database.Database) error + func (b *StatelessBlock) Status() choices.Status + func (b *StatelessBlock) Timestamp() time.Time + func (b *StatelessBlock) Verify(ctx context.Context) error + type Transaction struct + Signature []byte + func NewTx(utx UnsignedTransaction, sig []byte) *Transaction + func (t *Transaction) Activity() *Activity + func (t *Transaction) Bytes() []byte + func (t *Transaction) Copy() *Transaction + func (t *Transaction) DigestHash() []byte + func (t *Transaction) Execute(g *Genesis, db database.Database, blk *StatelessBlock, context *Context) error + func (t *Transaction) ID() ids.ID + func (t *Transaction) Init(g *Genesis) error + func (t *Transaction) Sender() common.Address + func (t *Transaction) Size() uint64 + type TransactionContext struct + BlockTime uint64 + Database database.Database + Genesis *Genesis + Sender common.Address + TxID ids.ID + type TransferTx struct + To common.Address + Units uint64 + func (t *TransferTx) Activity() *Activity + func (t *TransferTx) Copy() UnsignedTransaction + func (t *TransferTx) Execute(c *TransactionContext) error + func (t *TransferTx) TypedData() *tdata.TypedData + type UnsignedTransaction interface + Activity func() *Activity + Copy func() UnsignedTransaction + Execute func(*TransactionContext) error + ExecuteBase func(*Genesis) error + FeeUnits func(*Genesis) uint64 + GetBlockID func() ids.ID + GetMagic func() uint64 + GetPrice func() uint64 + LoadUnits func(*Genesis) uint64 + SetBlockID func(ids.ID) + SetMagic func(uint64) + SetPrice func(uint64) + TypedData func() *tdata.TypedData + func ParseTypedData(td *tdata.TypedData) (UnsignedTransaction, error) + type VM interface + Accepted func(*StatelessBlock) + ExecutionContext func(currentTime int64, parent *StatelessBlock) (*Context, error) + Genesis func() *Genesis + GetStatelessBlock func(ids.ID) (*StatelessBlock, error) + IsBootstrapped func() bool + Mempool func() Mempool + Rejected func(*StatelessBlock) + State func() database.Database + Verified func(*StatelessBlock) + type ValueMeta struct + Created uint64 + Size uint64 + TxID ids.ID + Updated uint64 + func GetValueMeta(db database.KeyValueReader, space []byte, key []byte) (*ValueMeta, bool, error)