ledger

package
v1.0.1-txapi Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 16, 2018 License: GPL-3.0 Imports: 11 Imported by: 67

Documentation

Index

Constants

View Source
const (
	AccountTypeError    = 0
	AccountTypeNotExist = 1
	AccountTypeGeneral  = 2
	AccountTypeContract = 3
)
View Source
const (
	BlockTypeSendCreate byte = iota + 1
	BlockTypeSendCall
	BlockTypeSendReward
	BlockTypeReceive
	BlockTypeReceiveError
)

Variables

View Source
var GenesisAccountAddress, _ = types.HexToAddress("vite_60e292f0ac471c73d914aeff10bb25925e13b2a9fddb6e6122")
View Source
var ViteTokenId = types.TokenTypeId{'V', 'I', 'T', 'E', ' ', 'T', 'O', 'K', 'E', 'N'}

Functions

This section is empty.

Types

type Account

type Account struct {
	AccountAddress types.Address
	AccountId      uint64
	PublicKey      ed25519.PublicKey
}

func (*Account) DeProto

func (account *Account) DeProto(pb *vitepb.Account)

func (*Account) Deserialize

func (account *Account) Deserialize(buf []byte) error

func (*Account) Proto

func (account *Account) Proto() *vitepb.Account

func (*Account) Serialize

func (account *Account) Serialize() ([]byte, error)

type AccountBlock

type AccountBlock struct {
	Meta *AccountBlockMeta `json:"-"`

	BlockType byte       `json:"blockType"`
	Hash      types.Hash `json:"hash"`
	Height    uint64     `json:"height"`
	PrevHash  types.Hash `json:"prevHash"`

	AccountAddress types.Address `json:"accountAddress"`

	PublicKey     ed25519.PublicKey `json:"publicKey"`
	ToAddress     types.Address     `json:"toAddress"`
	FromBlockHash types.Hash        `json:"fromBlockHash"`

	Amount  *big.Int          `json:"amount"`
	TokenId types.TokenTypeId `json:"tokenId"`

	Quota uint64   `json:"quota"`
	Fee   *big.Int `json:"fee"`

	SnapshotHash types.Hash `json:"snapshotHash"`
	Data         []byte     `json:"data"`

	Timestamp *time.Time `json:"timestamp"`
	StateHash types.Hash `json:"-"`

	LogHash *types.Hash `json:"logHash"`

	Difficulty *big.Int `json:"difficulty"`
	Nonce      []byte   `json:"nonce"`
	Signature  []byte   `json:"signature"`
	// contains filtered or unexported fields
}

func (*AccountBlock) ComputeHash

func (ab *AccountBlock) ComputeHash() types.Hash

func (*AccountBlock) Copy

func (ab *AccountBlock) Copy() *AccountBlock

func (*AccountBlock) DbDeserialize

func (ab *AccountBlock) DbDeserialize(buf []byte) error

func (*AccountBlock) DbProto

func (ab *AccountBlock) DbProto() *vitepb.AccountBlock

func (*AccountBlock) DbSerialize

func (ab *AccountBlock) DbSerialize() ([]byte, error)

func (*AccountBlock) DeProto

func (ab *AccountBlock) DeProto(pb *vitepb.AccountBlock)

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 AccountBlockMeta

type AccountBlockMeta struct {
	// Account id
	AccountId uint64 `json:"accountId"`

	// Height
	Height uint64 `json:"height"`

	// Block status, 1 means open, 2 means closed
	ReceiveBlockHeights []uint64 `json:"receiveBlockHeights"`

	// Height of Snapshot block which confirm this account block
	SnapshotHeight uint64 `json:"snapshotHeight"`

	// Height of Snapshot block which pointed by this account block
	RefSnapshotHeight uint64 `json:"refSnapshotHeight"`
}

func (*AccountBlockMeta) Copy

func (abm *AccountBlockMeta) Copy() *AccountBlockMeta

func (*AccountBlockMeta) DeProto

func (abm *AccountBlockMeta) DeProto(pb *vitepb.AccountBlockMeta)

func (*AccountBlockMeta) Deserialize

func (abm *AccountBlockMeta) Deserialize(buf []byte) error

func (*AccountBlockMeta) Proto

func (*AccountBlockMeta) Serialize

func (abm *AccountBlockMeta) Serialize() ([]byte, error)

type Block

type Block interface {
	Serialize() ([]byte, error)
	Deserialize([]byte) error
}

type CompressedFileMeta

type CompressedFileMeta struct {
	StartHeight uint64
	EndHeight   uint64

	Filename string
	FileSize int64

	BlockNumbers uint64
}

func (*CompressedFileMeta) Deproto

func (*CompressedFileMeta) Deserialize

func (f *CompressedFileMeta) Deserialize(buf []byte) error

func (*CompressedFileMeta) Proto

func (*CompressedFileMeta) Serialize

func (f *CompressedFileMeta) Serialize() ([]byte, error)

type HashHeight

type HashHeight struct {
	Height uint64     `json:"height"`
	Hash   types.Hash `json:"hash"`
}

func (*HashHeight) DeProto

func (b *HashHeight) DeProto(pb *vitepb.BlockID)

func (*HashHeight) Deserialize

func (b *HashHeight) Deserialize(data []byte) error

func (*HashHeight) Equal

func (b *HashHeight) Equal(hash types.Hash, height uint64) bool

func (*HashHeight) Proto

func (b *HashHeight) Proto() *vitepb.BlockID

func (*HashHeight) Serialize

func (b *HashHeight) Serialize() ([]byte, error)

type SnapshotBlock

type SnapshotBlock struct {
	Hash types.Hash `json:"hash"`

	PrevHash types.Hash `json:"prevHash"`
	Height   uint64     `json:"height"`

	PublicKey ed25519.PublicKey `json:"publicKey"`
	Signature []byte            `json:"signature"`

	Timestamp *time.Time `json:"timestamp"`

	StateHash types.Hash `json:"stateHash"`
	StateTrie *trie.Trie `json:"-"`

	SnapshotContent SnapshotContent `json:"snapshotContent"`
	// contains filtered or unexported fields
}

func (*SnapshotBlock) ComputeHash

func (sb *SnapshotBlock) ComputeHash() types.Hash

func (*SnapshotBlock) DbSerialize

func (sb *SnapshotBlock) DbSerialize() ([]byte, error)

func (*SnapshotBlock) DeProto

func (sb *SnapshotBlock) DeProto(pb *vitepb.SnapshotBlock)

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 SnapshotContent

type SnapshotContent map[types.Address]*HashHeight

func (SnapshotContent) DeProto

func (sc SnapshotContent) DeProto(pb *vitepb.SnapshotContent)

func (*SnapshotContent) Deserialize

func (sc *SnapshotContent) Deserialize(buf []byte) error

func (SnapshotContent) Proto

func (*SnapshotContent) Serialize

func (sc *SnapshotContent) Serialize() ([]byte, error)

type VmLog

type VmLog struct {
	Topics []types.Hash
	Data   []byte
}

type VmLogList

type VmLogList []*VmLog

func VmLogListDeProto

func VmLogListDeProto(pb *vitepb.VmLogList) VmLogList

func VmLogListDeserialize

func VmLogListDeserialize(buf []byte) (VmLogList, error)

func (VmLogList) Hash

func (vll VmLogList) Hash() *types.Hash

func (VmLogList) Proto

func (vll VmLogList) Proto() *vitepb.VmLogList

func (VmLogList) Serialize

func (vll VmLogList) Serialize() ([]byte, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL