Documentation ¶
Index ¶
- Constants
- func Signer(tx *Transaction, sig []byte) (ethcmn.Address, error)
- type Action
- type AppHeader
- type BlockAccount
- type CommitResult
- type ExecuteInvalidTx
- type ExecuteResult
- type NewRoundResult
- type QueryBase
- type Result
- func (res Result) AppendLog(log string) Result
- func (res Result) Error() string
- func (res *Result) FromJSON(j string) *Result
- func (res Result) IsErr() bool
- func (res Result) IsOK() bool
- func (res Result) PrependLog(log string) Result
- func (res Result) SetData(data []byte) Result
- func (res Result) SetLog(log string) Result
- func (res Result) String() string
- func (res Result) ToJSON() string
- type Transaction
- type TransactionData
- type TxQuery
- type TxSignature
- type Validator
Constants ¶
View Source
const ( CodeType_OK uint32 = 0 // General response codes, 0 ~ 99 CodeType_InternalError uint32 = 1 //内部错误 CodeType_EncodingError uint32 = 2 //编解码错误 CodeType_BadNonce uint32 = 3 //nonce错误 CodeType_InsufficientFunds uint32 = 5 //资金不足 CodeType_UnknownRequest uint32 = 6 //未知请求 CodeType_InvalidTx uint32 = 7 //交易不合法 CodeType_UnknownAccount uint32 = 8 //未知帐户 CodeType_AccountExist uint32 = 9 //帐户已存在 CodeType_AccountNotFound uint32 = 10 //帐户不存在 CodeType_OutOfOrder uint32 = 11 //action顺序错误 CodeType_UnknownError uint32 = 12 //未知错误 CodeType_SignerFaild uint32 = 13 //签名错误 )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AppHeader ¶
type AppHeader struct { PrevHash ethcmn.Hash // global, just used to calculate header-hash StateRoot ethcmn.Hash // fill after statedb commit BlockHash ethcmn.Hash //区块hash Height uint64 // refresh by new block TxCount uint64 // fill when ready to save OpCount uint64 // fill when ready to save ClosedAt time.Time // refresh by new block }
type BlockAccount ¶
type CommitResult ¶
type ExecuteInvalidTx ¶
type ExecuteResult ¶
type ExecuteResult struct { ValidTxs [][]byte InvalidTxs []ExecuteInvalidTx Error error }
type NewRoundResult ¶
type NewRoundResult struct { }
type Result ¶
type Result struct { Code uint32 `json:"Code"` //Data []byte `json:"Data"` Data []byte `json:"Data"` Log string `json:"Log"` // Can be non-deterministic }
CONTRACT: a zero Result is OK.
func NewResultOK ¶
NOTE: if data == nil and log == "", same as zero Result.
func (Result) PrependLog ¶
type Transaction ¶
通过Transaction 计算txhash
func (*Transaction) CheckSig ¶
func (tx *Transaction) CheckSig() error
func (Transaction) Len ¶
func (p Transaction) Len() int
func (Transaction) Less ¶
func (p Transaction) Less(i, j int) bool
func (*Transaction) SigHash ¶
func (tx *Transaction) SigHash() (h ethcmn.Hash)
SigHash Hash方法 本方法不能随意修改 因为Hash会变,链上也用的这个hash作为交易hash
func (*Transaction) Sign ¶
func (tx *Transaction) Sign(privkeys []*ecdsa.PrivateKey) error
func (*Transaction) String ¶
func (p *Transaction) String() string
func (Transaction) Swap ¶
func (p Transaction) Swap(i, j int)
type TransactionData ¶
type TransactionData struct { TxID uint64 `json:"tx_id"` //交易ID TxHash ethcmn.Hash `json:"tx_hash"` //交易HASH - 重复交易不会被处理 BlockHeight uint64 `json:"block_height"` //区块高度 BlockHash ethcmn.Hash `json:"block_hash"` //区块HASH ActionCount uint32 `json:"action_count"` //一笔交易多个action ActionID uint32 `json:"action_id"` //action id Src ethcmn.Address `json:"src"` //用户ID (if dir==0,uid 表示转入方,否则表示转出方) Dst ethcmn.Address `json:"dst"` //关联的用户ID Nonce uint64 `json:"nonce"` //对应操作源帐户(转出方)NONCE Amount *big.Int `json:"amount"` //金额 ResultCode uint `json:"result_code"` //应答码 0-success ResultMsg string `json:"result_msg"` //应答消息 CreateAt uint64 `json:"created_at"` //入库时间 JData string `json:"jdata"` //数据部分 建议JSON序列化 Memo string `json:"memo"` //交易备注 }
TransactionData 交易表 一次HTTP请求算一笔交易,拥有唯一的交易HASH 单笔交易可以携带多个ACTION,每次ACTION有一个ID,ACTIONID由调用方指定,注意JSON Array没有顺序 每个ACTION保护出让方和受让方,“创建帐户”不是ACTION 单笔交易多个ACTION时可以部分失败,部分失败返回{成功的action列表,失败的action列表}
type TxSignature ¶
type TxSignature struct {
Sig []byte
}
Click to show internal directories.
Click to hide internal directories.