types

package
v3.8.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2020 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Package types is definition of common type

  • file description: transaction
  • @Author: Gong Zibin
  • @Date: 2017-12-07
  • @Last Modified by:
  • @Last Modified time:

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BasicTransaction

type BasicTransaction struct {
	Version     uint32
	CursorNum   uint64
	CursorLabel uint32
	Lifetime    uint64
	Sender      string
	Contract    string
	Method      string
	Param       []byte
	SigAlg      uint32
}

BasicTransaction define transaction struct for transaction signature

type Block

type Block struct {
	Header            *Header
	BlockTransactions []*BlockTransaction
	//Transactions []*Transaction
	ValidatorSet []*Validator
}

how to add field when upgrade version: NewField uint64 `version:"x.x.x"`,x.x.x is new version

func NewBlock

func NewBlock(h *Header, txs []*BlockTransaction) *Block

func (*Block) ComputeMerkleRoot

func (b *Block) ComputeMerkleRoot() common.Hash

func (*Block) GetDelegate

func (b *Block) GetDelegate() []byte

func (*Block) GetDelegateSign

func (b *Block) GetDelegateSign() []byte

func (*Block) GetMerkleRoot

func (b *Block) GetMerkleRoot() common.Hash

func (*Block) GetNumber

func (b *Block) GetNumber() uint64

func (*Block) GetPrevBlockHash

func (b *Block) GetPrevBlockHash() common.Hash

func (*Block) GetTimestamp

func (b *Block) GetTimestamp() uint64

func (*Block) GetTransactionByHash

func (b *Block) GetTransactionByHash(hash common.Hash) *BlockTransaction

func (*Block) Hash

func (b *Block) Hash() common.Hash

func (*Block) SignVote

func (b *Block) SignVote(account string, vote *Validator) (*Validator, error)

type BlockDetail

type BlockDetail struct {
	BlockVersion     uint32         `json:"block_version"`
	PrevBlockHash    string         `json:"prev_block_hash"`
	BlockNum         uint64         `json:"block_num"`
	BlockHash        string         `json:"block_hash"`
	CursorBlockLabel uint32         `json:"cursor_block_label"`
	BlockTime        uint64         `json:"block_time"`
	TrxMerkleRoot    string         `json:"trx_merkle_root"`
	Delegate         string         `json:"delegate"`
	DelegateSign     string         `json:"delegate_sign"`
	Trxs             []*interface{} `json:"trxs"`
}

type BlockTransaction

type BlockTransaction struct {
	Transaction     *Transaction
	ResourceReceipt *ResourceReceipt
}

func (*BlockTransaction) Hash

func (trx *BlockTransaction) Hash() common.Hash

Hash transaction hash

type BlockV0

type BlockV0 struct {
	Header       *Header
	Transactions []*Transaction
	ValidatorSet []*Validator
}

type DerivedTransaction

type DerivedTransaction struct {
	Transaction *Transaction
	DerivedTrx  []*DerivedTransaction
}

DerivedTransaction define transaction which is derived from raw transaction

type HandledTransaction

type HandledTransaction struct {
	Transaction *Transaction
	DerivedTrx  []*DerivedTransaction
}

HandledTransaction define transaction which is handled

type Header struct {
	Version         uint32
	PrevBlockHash   []byte
	Number          uint64
	Timestamp       uint64
	MerkleRoot      []byte
	Delegate        []byte
	DelegateSign    []byte
	DelegateChanges []string
}

func NewHeader

func NewHeader() *Header

func (*Header) GetDelegate

func (m *Header) GetDelegate() []byte

func (*Header) GetDelegateChanges

func (m *Header) GetDelegateChanges() []string

func (*Header) GetDelegateSign

func (m *Header) GetDelegateSign() []byte

func (*Header) GetMerkleRoot

func (m *Header) GetMerkleRoot() []byte

func (*Header) GetNumber

func (m *Header) GetNumber() uint64

func (*Header) GetPrevBlockHash

func (m *Header) GetPrevBlockHash() []byte

func (*Header) GetTimestamp

func (m *Header) GetTimestamp() uint64

func (*Header) GetVersion

func (m *Header) GetVersion() uint32

func (*Header) Hash

func (h *Header) Hash() common.Hash

type P2PTransaction

type P2PTransaction struct {
	Transaction *Transaction
	TTL         uint16
}

type ResourceReceipt

type ResourceReceipt struct {
	AccountName    string `json:"account_name"`
	SpaceTokenCost uint64 `json:"space_token_cost"`
	TimeTokenCost  uint64 `json:"time_token_cost"`
}

ResourceReceipt

type Transaction

type Transaction struct {
	Version     uint32
	CursorNum   uint64
	CursorLabel uint32
	Lifetime    uint64
	Sender      string // max length 21
	Contract    string // max length 21
	Method      string // max length 21
	Param       []byte
	SigAlg      uint32
	Signature   []byte
}

Transaction define transaction struct for bottos protocol

func (*Transaction) Hash

func (trx *Transaction) Hash() common.Hash

Hash transaction hash

func (*Transaction) Sign

func (trx *Transaction) Sign(param []byte, privkey []byte) ([]byte, error)

Sign sign a transaction with privkey

func (*Transaction) VerifySignature

func (trx *Transaction) VerifySignature(pubkey []byte) bool

VerifySignature verify signature

Jump to

Keyboard shortcuts

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