Documentation ¶
Index ¶
- Constants
- Variables
- func ComputeSeedHash(seed uint64, prevHash types.Hash, timestamp *time.Time) types.Hash
- func IsReceiveBlock(blockType byte) bool
- func IsSendBlock(blockType byte) bool
- type Account
- type AccountBlock
- func (ab *AccountBlock) ComputeHash() types.Hash
- func (ab *AccountBlock) ComputeSendHash(hostBlock *AccountBlock, index uint8) types.Hash
- func (ab *AccountBlock) Copy() *AccountBlock
- func (ab *AccountBlock) DeProto(pb *vitepb.AccountBlock) error
- func (ab *AccountBlock) Deserialize(buf []byte) error
- func (ab *AccountBlock) IsReceiveBlock() bool
- func (ab *AccountBlock) IsSendBlock() bool
- func (ab *AccountBlock) Producer() types.Address
- func (ab *AccountBlock) Proto() *vitepb.AccountBlock
- func (ab *AccountBlock) Serialize() ([]byte, error)
- func (ab *AccountBlock) VerifySignature() bool
- type AccountInfo
- type Block
- type CompressedFileMeta
- type ContractMeta
- type HashHeight
- type SnapshotBlock
- func (sb *SnapshotBlock) ComputeHash() types.Hash
- func (sb *SnapshotBlock) DeProto(pb *vitepb.SnapshotBlock) error
- func (sb *SnapshotBlock) Deserialize(buf []byte) error
- func (sb *SnapshotBlock) Producer() types.Address
- func (sb *SnapshotBlock) Proto() *vitepb.SnapshotBlock
- func (sb *SnapshotBlock) Serialize() ([]byte, error)
- func (sb *SnapshotBlock) VerifySignature() bool
- type SnapshotChunk
- type SnapshotContent
- type SnapshotContentBytesList
- type TokenBalanceInfo
- type VmLog
- type VmLogList
Examples ¶
Constants ¶
View Source
const ( BlockTypeSendCreate = byte(1) // send BlockTypeSendCall = byte(2) // send BlockTypeSendReward = byte(3) // send BlockTypeReceive = byte(4) // receive BlockTypeReceiveError = byte(5) // receive BlockTypeSendRefund = byte(6) // send BlockTypeGenesisReceive = byte(7) // receive )
View Source
const LengthBeforeSeedFork = types.GidSize + 1 + types.HashSize + 1
View Source
const ScItemBytesLen = types.AddressSize + types.HashSize + 8
Variables ¶
View Source
var GenesisAccountAddress, _ = types.HexToAddress("vite_60e292f0ac471c73d914aeff10bb25925e13b2a9fddb6e6122")
View Source
var VCPTokenId, _ = types.HexToTokenTypeId("tti_251a3e67a41b5ea2373936c8")
View Source
var ViteTokenId = types.TokenTypeId{'V', 'I', 'T', 'E', ' ', 'T', 'O', 'K', 'E', 'N'}
Functions ¶
func ComputeSeedHash ¶
func IsReceiveBlock ¶
func IsSendBlock ¶
Types ¶
type Account ¶
func (*Account) Deserialize ¶
type AccountBlock ¶
type AccountBlock struct { BlockType byte `json:"blockType"` // 1 Hash types.Hash `json:"hash"` PrevHash types.Hash `json:"prevHash"` // 2 Height uint64 `json:"height"` // 3 AccountAddress types.Address `json:"accountAddress"` // 4 PublicKey ed25519.PublicKey `json:"publicKey"` ToAddress types.Address `json:"toAddress"` // 5 Amount *big.Int `json:"amount"` // 6 padding 32 bytes TokenId types.TokenTypeId `json:"tokenId"` // 7 FromBlockHash types.Hash `json:"fromBlockHash"` // 8 Data []byte `json:"data"` // 9 hash Quota uint64 `json:"quota"` // quotaUsed = quota + pow quota QuotaUsed uint64 `json:"quotaUsed"` // quotaUsed = quota + pow quota Fee *big.Int `json:"fee"` // 10 padding 32 bytes LogHash *types.Hash `json:"logHash"` // 11 Difficulty *big.Int `json:"difficulty"` Nonce []byte `json:"nonce"` // 12 padding 8 bytes SendBlockList []*AccountBlock `json:"sendBlockList"` // 13 Signature []byte `json:"signature"` // contains filtered or unexported fields }
func (*AccountBlock) ComputeHash ¶
func (ab *AccountBlock) ComputeHash() types.Hash
func (*AccountBlock) ComputeSendHash ¶
func (ab *AccountBlock) ComputeSendHash(hostBlock *AccountBlock, index uint8) types.Hash
func (*AccountBlock) Copy ¶
func (ab *AccountBlock) Copy() *AccountBlock
func (*AccountBlock) DeProto ¶
func (ab *AccountBlock) DeProto(pb *vitepb.AccountBlock) error
func (*AccountBlock) Deserialize ¶
func (ab *AccountBlock) Deserialize(buf []byte) error
func (*AccountBlock) IsReceiveBlock ¶
func (ab *AccountBlock) IsReceiveBlock() bool
func (*AccountBlock) IsSendBlock ¶
func (ab *AccountBlock) IsSendBlock() bool
func (*AccountBlock) Producer ¶
func (ab *AccountBlock) Producer() types.Address
func (*AccountBlock) Proto ¶
func (ab *AccountBlock) Proto() *vitepb.AccountBlock
func (*AccountBlock) Serialize ¶
func (ab *AccountBlock) Serialize() ([]byte, error)
func (*AccountBlock) VerifySignature ¶
func (ab *AccountBlock) VerifySignature() bool
type AccountInfo ¶
type AccountInfo struct { AccountAddress types.Address TotalNumber uint64 TokenBalanceInfoMap map[types.TokenTypeId]*TokenBalanceInfo }
type CompressedFileMeta ¶
type ContractMeta ¶
type ContractMeta struct { Gid types.Gid // belong to the consensus group id SendConfirmedTimes uint8 CreateBlockHash types.Hash // hash of send create block for creating the contract QuotaRatio uint8 // the ratio of quota cost for the send block SeedConfirmedTimes uint8 }
func GetBuiltinContractMeta ¶
func GetBuiltinContractMeta(addr types.Address) *ContractMeta
func (*ContractMeta) Deserialize ¶
func (cm *ContractMeta) Deserialize(buf []byte) error
func (*ContractMeta) Serialize ¶
func (cm *ContractMeta) Serialize() []byte
type HashHeight ¶
Example ¶
var points = make([][2]*HashHeight, 2) points[0] = [2]*HashHeight{ {100, types.Hash{}}, {200, types.Hash{}}, } points[1] = [2]*HashHeight{ {201, types.Hash{}}, {300, types.Hash{}}, } data, err := json.Marshal(points) if err != nil { panic(err) } fmt.Printf("%s\n", data)
Output: [[{"height":100,"hash":"0000000000000000000000000000000000000000000000000000000000000000"},{"height":200,"hash":"0000000000000000000000000000000000000000000000000000000000000000"}],[{"height":201,"hash":"0000000000000000000000000000000000000000000000000000000000000000"},{"height":300,"hash":"0000000000000000000000000000000000000000000000000000000000000000"}]]
func (*HashHeight) DeProto ¶
func (b *HashHeight) DeProto(pb *vitepb.HashHeight) (err error)
func (*HashHeight) Deserialize ¶
func (b *HashHeight) Deserialize(data []byte) error
func (*HashHeight) Proto ¶
func (b *HashHeight) Proto() *vitepb.HashHeight
func (*HashHeight) Serialize ¶
func (b *HashHeight) Serialize() ([]byte, error)
type SnapshotBlock ¶
type SnapshotBlock struct { Hash types.Hash `json:"hash"` PrevHash types.Hash `json:"prevHash"` // 1 Height uint64 `json:"height"` // 2 PublicKey ed25519.PublicKey `json:"publicKey"` Signature []byte `json:"signature"` Timestamp *time.Time `json:"timestamp"` // 3 Seed uint64 `json:"seed"` // 4 SeedHash *types.Hash `json:"seedHash"` // 5 SnapshotContent SnapshotContent `json:"snapshotContent"` // 6 Version uint32 `json:"version"` // contains filtered or unexported fields }
func (*SnapshotBlock) ComputeHash ¶
func (sb *SnapshotBlock) ComputeHash() types.Hash
func (*SnapshotBlock) DeProto ¶
func (sb *SnapshotBlock) DeProto(pb *vitepb.SnapshotBlock) error
func (*SnapshotBlock) Deserialize ¶
func (sb *SnapshotBlock) Deserialize(buf []byte) error
func (*SnapshotBlock) Producer ¶
func (sb *SnapshotBlock) Producer() types.Address
func (*SnapshotBlock) Proto ¶
func (sb *SnapshotBlock) Proto() *vitepb.SnapshotBlock
func (*SnapshotBlock) Serialize ¶
func (sb *SnapshotBlock) Serialize() ([]byte, error)
func (*SnapshotBlock) VerifySignature ¶
func (sb *SnapshotBlock) VerifySignature() bool
type SnapshotChunk ¶
type SnapshotChunk struct { SnapshotBlock *SnapshotBlock `json:"snapshotBlock"` AccountBlocks []*AccountBlock `json:"accountBlocks"` }
type SnapshotContent ¶
type SnapshotContent map[types.Address]*HashHeight
type SnapshotContentBytesList ¶
type SnapshotContentBytesList [][]byte
func NewSnapshotContentBytesList ¶
func NewSnapshotContentBytesList(sc SnapshotContent) SnapshotContentBytesList
func (SnapshotContentBytesList) Len ¶
func (scbList SnapshotContentBytesList) Len() int
func (SnapshotContentBytesList) Less ¶
func (scbList SnapshotContentBytesList) Less(i, j int) bool
func (SnapshotContentBytesList) Swap ¶
func (scbList SnapshotContentBytesList) Swap(i, j int)
type TokenBalanceInfo ¶
type VmLogList ¶
type VmLogList []*VmLog
func VmLogListDeProto ¶
func VmLogListDeserialize ¶
Click to show internal directories.
Click to hide internal directories.