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 ¶
- type BasicTransaction
- type Block
- func (b *Block) ComputeMerkleRoot() common.Hash
- func (b *Block) GetDelegate() []byte
- func (b *Block) GetDelegateSign() []byte
- func (b *Block) GetMerkleRoot() common.Hash
- func (b *Block) GetNumber() uint64
- func (b *Block) GetPrevBlockHash() common.Hash
- func (b *Block) GetTimestamp() uint64
- func (b *Block) GetTransactionByHash(hash common.Hash) *BlockTransaction
- func (b *Block) Hash() common.Hash
- func (b *Block) SignVote(account string, vote *Validator) (*Validator, error)
- type BlockDetail
- type BlockTransaction
- type BlockV0
- type DerivedTransaction
- type HandledTransaction
- type Header
- func (m *Header) GetDelegate() []byte
- func (m *Header) GetDelegateChanges() []string
- func (m *Header) GetDelegateSign() []byte
- func (m *Header) GetMerkleRoot() []byte
- func (m *Header) GetNumber() uint64
- func (m *Header) GetPrevBlockHash() []byte
- func (m *Header) GetTimestamp() uint64
- func (m *Header) GetVersion() uint32
- func (h *Header) Hash() common.Hash
- type P2PTransaction
- type ResourceReceipt
- type Transaction
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) GetTransactionByHash ¶
func (b *Block) GetTransactionByHash(hash common.Hash) *BlockTransaction
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 ¶
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) 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
Source Files
¶
- block-role.go
- transaction-role.go
Click to show internal directories.
Click to hide internal directories.