Documentation ¶
Index ¶
- Constants
- Variables
- func PubkeyToAddress(pub PublicKey) ethcmn.Address
- func ValidAddress(s string) bool
- func ValidPublicKey(s string) bool
- type ABCIValidator
- type Address
- type AppHeader
- type BeanAccount
- type BeanContract
- type BeanDPOSPool
- type BeanEvmCallResult
- type BeanValidator
- type BeanVot
- type BeanVoter
- type BeanVots
- type Config
- type DPOSPoolLog
- type DPOSQuery
- type DPOSRankLog
- type DPOSTcnLog
- type DPOSTinLog
- type LastBlockInfo
- type MinePool
- type MultisigEvmTx
- func (tx *MultisigEvmTx) AddSign(signature string) error
- func (tx *MultisigEvmTx) Cost() *big.Int
- func (tx *MultisigEvmTx) FromBytes(bs []byte) error
- func (tx *MultisigEvmTx) Hash() ethcmn.Hash
- func (tx *MultisigEvmTx) SigHash() ethcmn.Hash
- func (tx *MultisigEvmTx) Sign(privkey string) error
- func (tx MultisigEvmTx) Signer() []ethcmn.Address
- func (tx *MultisigEvmTx) ToBytes() []byte
- func (tx *MultisigEvmTx) Verify() bool
- type Multisignature
- type PubKeyMultisigThreshold
- type PublicKey
- func (a PublicKey) Big() *big.Int
- func (a PublicKey) Bytes() []byte
- func (pk PublicKey) Equals(pk1 PublicKey) bool
- func (a PublicKey) Format(s fmt.State, c rune)
- func (a PublicKey) Hex() string
- func (a PublicKey) IsAddress() bool
- func (a PublicKey) MarshalText() ([]byte, error)
- func (a *PublicKey) SetBytes(b []byte)
- func (a PublicKey) String() string
- func (pk PublicKey) ToAddress() Address
- func (a *PublicKey) UnmarshalJSON(input []byte) error
- func (a *PublicKey) UnmarshalText(input []byte) error
- func (pk PublicKey) VerifyBytes(msg, signature []byte) bool
- 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 Signature
- type TxBatch
- func (tx *TxBatch) Cost() *big.Int
- func (tx *TxBatch) FromBytes(bs []byte) error
- func (tx *TxBatch) GasWanted() int64
- func (tx *TxBatch) Hash() ethcmn.Hash
- func (tx *TxBatch) SigHash() ethcmn.Hash
- func (tx *TxBatch) Sign(privkey string) ([]byte, error)
- func (tx *TxBatch) ToBytes() []byte
- func (tx *TxBatch) Verify() bool
- type TxEvm
- type TxEvmCommon
- type TxManage
- type TxNodeDelegate
- func (tx *TxNodeDelegate) Cost() *big.Int
- func (tx *TxNodeDelegate) FromBytes(bs []byte) error
- func (tx *TxNodeDelegate) GasWanted() int64
- func (tx *TxNodeDelegate) Hash() ethcmn.Hash
- func (tx *TxNodeDelegate) Sign(privkey []byte) []byte
- func (tx *TxNodeDelegate) ToBytes() []byte
- func (tx *TxNodeDelegate) Verify() bool
- type TxOp
- type TxParams
- type TxResult
- type TxUserDelegate
- func (tx *TxUserDelegate) Cost() *big.Int
- func (tx *TxUserDelegate) FromBytes(bs []byte) error
- func (tx *TxUserDelegate) GasWanted() int64
- func (tx *TxUserDelegate) Hash() ethcmn.Hash
- func (tx *TxUserDelegate) SigHash() ethcmn.Hash
- func (tx *TxUserDelegate) Sign(privkey string) ([]byte, error)
- func (tx *TxUserDelegate) ToBytes() []byte
- func (tx *TxUserDelegate) Verify() bool
- type Validator
- func (v *Validator) AddVoter(address common.Address, amount *big.Int)
- func (v *Validator) Address() crypto.Address
- func (v *Validator) Equal(to *Validator) bool
- func (v *Validator) FromBytes(b []byte)
- func (v *Validator) FromJSON(data []byte) error
- func (v *Validator) PublicKeyStr() string
- func (v *Validator) RemoveVoter(address common.Address)
- func (v *Validator) String() string
- func (v *Validator) TCNShare() *big.Int
- func (v *Validator) TINShare() *big.Int
- func (v *Validator) ToBytes() []byte
- func (v *Validator) ToJSON() ([]byte, error)
- func (v *Validator) ToPrettyJSON() ([]byte, error)
- func (v *Validator) TotalShare() *big.Int
- func (v *Validator) UpdateVoter(address common.Address, amount *big.Int)
- type Vot
- type Voter
- func (v *Voter) CanRemove() bool
- func (v *Voter) Equal(to *Voter) bool
- func (v *Voter) FromBytes(b []byte)
- func (v *Voter) FromJSON(data []byte) error
- func (v *Voter) RealMortgaged() *big.Int
- func (v *Voter) String() string
- func (v *Voter) ToBytes() []byte
- func (v *Voter) ToJSON() ([]byte, error)
- func (v *Voter) TotalShare() *big.Int
Constants ¶
const ( CodeType_OK uint32 = 0 // General response codes, 0 ~ 99 CodeType_InternalError uint32 = 1 // 内部错误 CodeType_EncodingError uint32 = 2 // 编解码错误 CodeType_UnsupportedTx uint32 = 3 // 不支持的tx类型 CodeType_BadSignature uint32 = 4 // 签名错误 CodeType_BadArgument uint32 = 5 // 参数错误 CodeType_ExecuteTx uint32 = 6 // tx执行错误 CodeType_Deadline uint32 = 7 // 交易过期 CodeType_SenderNotExist uint32 = 11 // 帐户不存在 CodeType_BadNonce uint32 = 12 // nonce错误 CodeType_InsufficientFunds uint32 = 13 // 资金不足 CodeType_ReceiverNotExist uint32 = 14 // 帐户不存在 // manage tx CodeType_ValidatorNotExist uint32 = 20 // 节点不存在 CodeType_ValidatorIsNotGenesis uint32 = 21 // 不是创世节点 CodeType_ValidatorPowerNotEnough uint32 = 22 // 投票权不足 CodeType_ValidatorDoubleUpdate uint32 = 23 // 节点并发更新 CodeType_ValidatorChangeSelf uint32 = 24 // 不能操作自己 CodeType_ValidatorNotFound uint32 = 25 // 没有该节点 // evm tx CodeType_ContractExecuteErr uint32 = 30 // 合约执行错误 CodeType_ContractExecuteFailed uint32 = 31 // 合约执行失败 // delegate tx CodeType_NodeNotExist uint32 = 41 // 节点不存在 CodeType_NodeNotRunFor uint32 = 42 // 节点未参与竞选 CodeType_Delegate_Limit uint32 = 43 // 代理限制 CodeType_InsufficientProfit uint32 = 44 // 收益不足 CodeType_VoterNotExist uint32 = 45 // 投票人不存在 )
const ( API_V2_QUERY_ACCOUNT = "/v2/account" API_V2_CONTRACT_QUERY_ACCOUNT = "/v2/contract/account" API_V2_CONTRACT_QUERY_LOGS = "/v2/contract/logs" API_V2_CONTRACT_CALL = "/v2/contract/call" API_V3_QUERY_NODE = "/v3/node/account" API_V3_QUERY_NODES = "/v3/node/accounts" API_V3_QUERY_NODEVOTERS = "/v3/node/account/voters" API_V3_QUERY_VOTER = "/v3/voter/account" API_V3_QUERY_DPOS_POOL = "/v3/dpos/pool" API_V3_QUERY_DPOS_POOLLOG = "/v3/dpos/poollog" API_V3_QUERY_DPOS_TCNLOG = "/v3/dpos/tcnlog" API_V3_QUERY_DPOS_TINLOG = "/v3/dpos/tinlog" API_V3_QUERY_DPOS_RANKLOG = "/v3/dpos/ranklog" )
const ( NODE_OPTYPE_NULL = uint8(iota) NODE_OPTYPE_MORTGAGE NODE_OPTYPE_REEDEM NODE_OPTYPE_COLLECT NODE_OPTYPE_WITHDRAW )
const ( KEY_DPOSBeginHeight = "DPOSBeginHeight" // 从此高度开启DPOS机制 必须>1 KEY_DPOSEachHeight = "DPOSEachHeight" // 每多少高度清算一次 10240 KEY_DPOSMaxNodeNum = "DPOSMaxNodeNum" // 超级节点数量 KEY_NodeWorkMortgage = "NodeWorkMortgage" // 节点至少抵押该数字才会参与DPOS KEY_NodeMinMortgage = "NodeMinMortgage" // 节点最小单笔抵押金额 KEY_NodeMinCollect = "NodeMinCollect" // 节点最小单笔收集收益金额 KEY_UserMinMortgage = "UserMinMortgage" // 用户最小抵押金额 KEY_UserMinCollect = "UserMinCollect" // 用户最小单笔收集收益金额 KEY_UpgradeHeight = "KEY_UpgradeHeight" // 升级高度 )
const ( USER_OPTYPE_NULL = uint8(iota) USER_OPTYPE_MORTGAGE USER_OPTYPE_REEDEM USER_OPTYPE_COLLECT )
const PubKeyLength = 33
const (
TxGas = int64(21000) // tx gas
)
Variables ¶
var ( ZERO_ADDRESS = ethcmn.Address{} ZERO_HASH = ethcmn.Hash{} ZERO_PUBLICKEY = PublicKey{} )
var ( ErrUnsupportedTx = errors.New("unsupported tx") ErrInvalidSignature = errors.New("signature verify failed") ErrInvalidOperations = errors.New("too little/much operations") ErrInvalidGasLimit = errors.New("invalid gasLimit") ErrInvalidGasPrice = errors.New("invalid gasPrice") ErrNotFoundSender = errors.New("sender not exist") ErrNotFoundReceiver = errors.New("receiver not exist") ErrInsufficientBalance = errors.New("insufficient balance") ErrInsufficientPermissions = errors.New("insufficient permissions") ErrDeadline = errors.New("tx deadline") )
var ( TxTagAppInit = []byte{0, 0} // 账户迁移,采用与batch相同的交易结构,但是不收取手续费 v4废弃 TxTagTinInit = []byte{0, 1} // v3初始化TIN用户 v4废弃 TxTagAppOLO = []byte{1, 1} // 原生交易 v1 - v3废弃 TxTagAppEvm = []byte{1, 2} // 合约交易 TxTagAppFee = []byte{1, 3} // 收取手续费 - v3废弃 TxTagAppBatch = []byte{1, 4} // 批量交易 TxTagNodeDelegate = []byte{2, 1} // 节点抵押赎回提现 TxTagUserDelegate = []byte{2, 2} // 用户抵押赎回提现 TxTagAppEvmMultisig = []byte{3, 2} // EVM多签交易 TxTagAppParams = []byte{255, 0} // 修改APP参数 TxTagAppMgr = []byte{255, 255} // 节点管理交易 )
var ( // 竞选超级节点 OpType_SetRunFor = uint8(1) // 更改投票权 OpType_SetPower = uint8(2) // 转移genesis权限 OpType_SetGenesis = uint8(3) )
var DefaultConfig = Config{
DPOSBeginHeight: 150000,
DPOSEachHeight: 20480,
DPOSMaxNodeNum: 13,
NodeWorkMortgage: 50000,
NodeMinMortgage: 10000 * 1e8,
NodeMinCollect: 10 * 1e8,
UserMinMortgage: 100 * 1e8,
UserMinCollect: 10 * 1e8,
UpgradeHeight: 0,
}
Functions ¶
func PubkeyToAddress ¶
func ValidAddress ¶
func ValidPublicKey ¶
Types ¶
type ABCIValidator ¶
type Address ¶
func (Address) MarshalText ¶
type AppHeader ¶
type AppHeader struct { Height *big.Int // refresh by new block ClosedAt time.Time // ON abci beginBlock BlockHash ethcmn.Hash // fill on new block Validator ethcmn.Address // refresh by new block StateRoot ethcmn.Hash // fill after statedb commit XStateRoot ethcmn.Hash // fill after xstatedb commit TxCount uint64 // fill when ready to save PrevHash ethcmn.Hash // global, just used to calculate header-hash MinePool *MinePool Params *Config }
AppHeader ledger header for app
type BeanAccount ¶
type BeanContract ¶
type BeanDPOSPool ¶
type BeanEvmCallResult ¶
type BeanValidator ¶
type BeanValidator struct { Address string `json:"address"` // 节点公钥 Nonce uint64 `json:"nonce"` // nonce Power uint64 `json:"power"` // 投票权 Genesis bool `json:"genesis"` // 是否是创世节点 RunFor bool `json:"runFor"` // 参与竞选 Balance string `json:"balance"` // 余额(累积收益) Profit string `json:"-"` // 本轮收益 Mortgaged string `json:"mortgaged"` // 已抵押 ToMortgage string `json:"toMortgage"` // 待抵押 Redeem bool `json:"redeem"` // 待赎回 Voters int `json:"voters"` // 投票人数 Voted string `json:"voted"` // 选民贡献 }
func (*BeanValidator) ToPrettyJSON ¶
func (v *BeanValidator) ToPrettyJSON() ([]byte, error)
type BeanVoter ¶
type BeanVoter struct { Address string `json:"address"` // 选民地址 Balance string `json:"balance"` // 累积收益余额 Validator string `json:"validator"` // 节点地址 Mortgaged string `json:"mortgaged"` // 已抵押 ToMortgage string `json:"toMortgage"` // 待抵押 Burned string `json:"burned"` // 已燃烧 Redeem bool `json:"redeem"` // 赎回标志 }
type BeanVots ¶
type BeanVots struct { Address string `json:"address"` // 节点公钥 Voted string `json:"voted"` // 选民贡献 Voters []BeanVot `json:"voters"` // 选民列表 }
func (*BeanVots) ToPrettyJSON ¶
type Config ¶
type Config struct { DPOSBeginHeight int64 // 从此高度开启DPOS机制 必须>1 DPOSEachHeight int64 // 每多少高度清算一次 10240 DPOSMaxNodeNum int // 超级节点数量 NodeWorkMortgage int64 // 节点至少抵押该数字才会参与DPOS NodeMinMortgage int64 // 节点最小单笔抵押金额 NodeMinCollect int64 // 节点最小单笔收集收益金额 UserMinMortgage int64 // 用户最小抵押金额 UserMinCollect int64 // 用户最小单笔收集收益金额 UpgradeHeight int64 // 升级高度,如果不为0,在此高度的EndBlock会Panic等待升级 }
type DPOSPoolLog ¶
type DPOSPoolLog struct { Id uint64 `db:"id" json:"id"` // 数据库自增id Height uint64 `db:"height" json:"height"` // 去看高度 Balance string `db:"balance" json:"balance"` // 矿池余额 Mined string `db:"mined" json:"mined"` // 挖矿量 Released string `db:"released" json:"released"` // 实际释放量,实际释放量约等于挖矿量 Total string `db:"total" json:"total"` // 总股权 BlockAt time.Time `db:"blockat" json:"blockAt"` // 区块时间 }
type DPOSRankLog ¶
type DPOSRankLog struct { Id uint64 `db:"id" json:"id"` // 数据库自增id Height uint64 `db:"height" json:"height"` // 区块高度 Address string `db:"address" json:"address"` // 节点地址 Mortgaged string `db:"mortgaged" json:"mortgaged"` // 节点抵押量 Voted string `db:"voted" json:"voted"` // 用户投票量 Voters uint64 `db:"voters" json:"voters"` // 投票用户数 Total string `db:"total" json:"total"` // 总股权 Rank uint32 `db:"rank" json:"rank"` // 排名 BlockAt time.Time `db:"blockat" json:"blockAt"` // 区块时间 }
type DPOSTcnLog ¶
type DPOSTcnLog struct { Id uint64 `db:"id" json:"id"` // 数据库自增id Height uint64 `db:"height" json:"height"` // 区块高度 Address string `db:"address" json:"address"` // 节点地址 Mortgaged string `db:"mortgaged" json:"mortgaged"` // 节点抵押量 Voted string `db:"voted" json:"voted"` // 用户投票量 Voters uint64 `db:"voters" json:"voters"` // 投票用户数 Profit string `db:"profit" json:"profit"` // 收益 BlockAt time.Time `db:"blockat" json:"blockAt"` // 区块时间 }
type DPOSTinLog ¶
type DPOSTinLog struct { Id uint64 `db:"id" json:"id"` // 数据库自增id Height uint64 `db:"height" json:"height"` // 区块高度 Address string `db:"address" json:"address"` // 用户地址 Validator string `db:"validator" json:"validator"` // 用户选举的节点地址 Mortgaged string `db:"mortgaged" json:"mortgaged"` // 用户抵押量 Profit string `db:"profit" json:"profit"` // 收益 BlockAt time.Time `db:"blockat" json:"blockAt"` // 区块时间 }
type LastBlockInfo ¶
type LastBlockInfo struct { Height int64 StateRoot ethcmn.Hash XStateRoot ethcmn.Hash AppHash ethcmn.Hash PrevHash ethcmn.Hash ValidatorUpdates []ABCIValidator }
func (*LastBlockInfo) FromBytes ¶
func (block *LastBlockInfo) FromBytes(bz []byte)
func (*LastBlockInfo) ToBytes ¶
func (block *LastBlockInfo) ToBytes() []byte
type MinePool ¶
type MultisigEvmTx ¶
type MultisigEvmTx struct { Deadline uint64 // 有效期 截止时间 秒 GasLimit uint64 // gas限额 GasPrice *big.Int // gas价格 From ethcmn.Address // 多签账户地址 Nonce uint64 // 多签账户nonce To ethcmn.Address // 交易接收方地址 Value *big.Int // 交易金额 Load []byte // 合约交易负荷 Memo []byte // 备注信息 Signature Signature // 签名信息 // contains filtered or unexported fields }
func NewMultisigEvmTx ¶
func NewMultisigEvmTx(k int, pks []PublicKey) *MultisigEvmTx
func (*MultisigEvmTx) AddSign ¶
func (tx *MultisigEvmTx) AddSign(signature string) error
func (*MultisigEvmTx) Cost ¶
func (tx *MultisigEvmTx) Cost() *big.Int
func (*MultisigEvmTx) FromBytes ¶
func (tx *MultisigEvmTx) FromBytes(bs []byte) error
func (*MultisigEvmTx) Hash ¶
func (tx *MultisigEvmTx) Hash() ethcmn.Hash
func (*MultisigEvmTx) SigHash ¶
func (tx *MultisigEvmTx) SigHash() ethcmn.Hash
func (*MultisigEvmTx) Sign ¶
func (tx *MultisigEvmTx) Sign(privkey string) error
func (MultisigEvmTx) Signer ¶
func (tx MultisigEvmTx) Signer() []ethcmn.Address
func (*MultisigEvmTx) ToBytes ¶
func (tx *MultisigEvmTx) ToBytes() []byte
func (*MultisigEvmTx) Verify ¶
func (tx *MultisigEvmTx) Verify() bool
type Multisignature ¶
type Multisignature struct { BitArray *bitarray.CompactBitArray Sigs [][]byte }
Multisignature is used to represent the signature object used in the multisigs. Sigs is a list of signatures, sorted by corresponding index.
func NewMultisig ¶
func NewMultisig(n int) *Multisignature
NewMultisig returns a new Multisignature of size n.
func (*Multisignature) AddSignature ¶
func (mSig *Multisignature) AddSignature(sig []byte, index int)
AddSignature adds a signature to the multisig, at the corresponding index. If the signature already exists, replace it.
func (*Multisignature) AddSignatureFromPubKey ¶
func (mSig *Multisignature) AddSignatureFromPubKey(sig []byte, pubkey PublicKey, keys []PublicKey) error
AddSignatureFromPubKey adds a signature to the multisig, at the index in keys corresponding to the provided pubkey.
func (*Multisignature) Marshal ¶
func (mSig *Multisignature) Marshal() []byte
Marshal the multisignature with RLP
func (*Multisignature) UnMarshal ¶
func (mSig *Multisignature) UnMarshal(bz []byte) error
type PubKeyMultisigThreshold ¶
type PubKeyMultisigThreshold struct { K uint `json:"threshold"` PubKeys []PublicKey `json:"pubkeys"` }
func NewPubKeyMultisigThreshold ¶
func NewPubKeyMultisigThreshold(k int, pubkeys []PublicKey) PubKeyMultisigThreshold
func (PubKeyMultisigThreshold) Address ¶
func (pk PubKeyMultisigThreshold) Address() ethcmn.Address
func (PubKeyMultisigThreshold) Bytes ¶
func (pk PubKeyMultisigThreshold) Bytes() []byte
func (PubKeyMultisigThreshold) Hash ¶
func (pk PubKeyMultisigThreshold) Hash() (sum ethcmn.Hash)
func (PubKeyMultisigThreshold) VerifyBytes ¶
func (pk PubKeyMultisigThreshold) VerifyBytes(msg []byte, marshalledSig []byte) bool
type PublicKey ¶
type PublicKey [PubKeyLength]byte
func BytesToPubkey ¶
func HexToPubkey ¶
func (PublicKey) Format ¶
Format implements fmt.Formatter, forcing the byte slice to be formatted as is, without going through the stringer interface used for logging.
func (PublicKey) MarshalText ¶
MarshalText returns the hex representation of a.
func (*PublicKey) SetBytes ¶
SetBytes sets the address to the value of b. If b is larger than len(a) it will panic.
func (*PublicKey) UnmarshalJSON ¶
UnmarshalJSON parses a hash in hex syntax.
func (*PublicKey) UnmarshalText ¶
UnmarshalText parses a hash in hex syntax.
func (PublicKey) VerifyBytes ¶
type Result ¶
type Result struct { Code uint32 `json:"Code"` 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 Signature ¶
type Signature struct { PubKey PubKeyMultisigThreshold MultiSig *Multisignature }
type TxBatch ¶
type TxBatch struct { CreatedAt uint64 // 交易发起时间 GasLimit uint64 // gas限额 GasPrice *big.Int // gas价格 Nonce uint64 // 交易发起者nonce Sender PublicKey // 交易发起者公钥 Ops []TxOp // 交易列表 Memo []byte // 备注 Signature []byte // 交易签名 // contains filtered or unexported fields }
1对多批量交易
func NewTxBatch ¶
func NewTxBatch() *TxBatch
type TxEvm ¶
type TxEvm struct { CreatedAt uint64 // 交易发起时间 GasLimit uint64 // gas限额 GasPrice *big.Int // gas价格 Nonce uint64 // 交易发起者nonce Sender PublicKey // 交易发起者公钥 Body TxEvmCommon // 交易结构 Signature []byte // 交易签名 // contains filtered or unexported fields }
evm交易时sender和receiver都传public key,如果是合约帐户,receiver填写最后20个字节,前12字节填0
type TxEvmCommon ¶
type TxManage ¶
type TxManage struct { CreatedAt uint64 // 时间戳 Sender ed25519.PubKey // 交易发起者公钥 Nonce uint64 // 交易发起者nonce Receiver ed25519.PubKey // 交易接受者公钥 OpType uint8 // 操作类型 1-设置RunFor 2-设置POWER 3-设置Genesis权限 OpValue uint64 // Op对应的值 OpType=1时(OpValue=0,取消runFor;OpValue=1,设置runFor);OpType=2时是TMCore票权 Signature []byte // signature // contains filtered or unexported fields }
type TxNodeDelegate ¶
type TxNodeDelegate struct { CreatedAt uint64 // 交易发起时间 Sender ed25519.PubKey // 交易发起者公钥 Nonce uint64 // 交易发起者nonce OpType uint8 // 操作类型 1-抵押 2-赎回 3-领取收益 4-提现 OpValue *big.Int // Op对应的值 OpType=1时为抵押金额;OpType=4时为体现金额 Receiver []byte // 提现地址,OpType=4时有效 Signature []byte // 交易签名 // contains filtered or unexported fields }
func NewNodeDelegateTx ¶
func NewNodeDelegateTx() *TxNodeDelegate
func (*TxNodeDelegate) Cost ¶
func (tx *TxNodeDelegate) Cost() *big.Int
func (*TxNodeDelegate) FromBytes ¶
func (tx *TxNodeDelegate) FromBytes(bs []byte) error
func (*TxNodeDelegate) GasWanted ¶
func (tx *TxNodeDelegate) GasWanted() int64
func (*TxNodeDelegate) Hash ¶
func (tx *TxNodeDelegate) Hash() ethcmn.Hash
func (*TxNodeDelegate) Sign ¶
func (tx *TxNodeDelegate) Sign(privkey []byte) []byte
func (*TxNodeDelegate) ToBytes ¶
func (tx *TxNodeDelegate) ToBytes() []byte
func (*TxNodeDelegate) Verify ¶
func (tx *TxNodeDelegate) Verify() bool
type TxParams ¶
type TxParams struct { CreatedAt uint64 // 时间戳 Sender ed25519.PubKey // 交易发起者公钥 Nonce uint64 // 交易发起者nonce Key []byte // 参数名称 Value []byte // 参数值 Signature []byte // signature // contains filtered or unexported fields }
unsafe
func NewTxParams ¶
func NewTxParams() *TxParams
type TxResult ¶
type TxResult struct { Ret []byte `json:"ret"` // 返回数据 Hash common.Hash `json:"hash"` // tx hash Reversed []byte `json:"reversed"` // 保留 }
注意amino的兼容类型
type TxUserDelegate ¶
type TxUserDelegate struct { CreatedAt uint64 // 交易发起时间 Sender PublicKey // 交易发起者公钥 Nonce uint64 // 交易发起者nonce OpType uint8 // 操作类型 1-抵押选举 2-赎回 3-领取收益 OpValue *big.Int // Op对应的值,OpType=1时为抵押金额 Receiver []byte // 接受者地址 OpType=1时为节点地址 Signature []byte // 交易签名 // contains filtered or unexported fields }
func NewUserDelegateTx ¶
func NewUserDelegateTx() *TxUserDelegate
func (*TxUserDelegate) Cost ¶
func (tx *TxUserDelegate) Cost() *big.Int
func (*TxUserDelegate) FromBytes ¶
func (tx *TxUserDelegate) FromBytes(bs []byte) error
func (*TxUserDelegate) GasWanted ¶
func (tx *TxUserDelegate) GasWanted() int64
func (*TxUserDelegate) Hash ¶
func (tx *TxUserDelegate) Hash() ethcmn.Hash
func (*TxUserDelegate) SigHash ¶
func (tx *TxUserDelegate) SigHash() ethcmn.Hash
func (*TxUserDelegate) ToBytes ¶
func (tx *TxUserDelegate) ToBytes() []byte
func (*TxUserDelegate) Verify ¶
func (tx *TxUserDelegate) Verify() bool
type Validator ¶
type Validator struct { PubKey ed25519.PubKey // 节点公钥 Nonce uint64 // nonce Power uint64 // 投票权 Genesis bool // 是否是创世节点 RunFor bool // 参与竞选 Balance *big.Int // 余额(累积收益) Profit *big.Int // 本轮收益 Mortgaged *big.Int // 已抵押 ToMortgage *big.Int // 待抵押 Redeem bool // 待赎回 Voters []Vot // 选民列表 Voted *big.Int // 选民贡献 }
func NewValidator ¶
func NewValidator() *Validator
func (*Validator) PublicKeyStr ¶
func (*Validator) RemoveVoter ¶
func (*Validator) ToPrettyJSON ¶
func (*Validator) TotalShare ¶
Source Files ¶
- address.go
- app_header.go
- bean.go
- config.go
- const.go
- lastblock.go
- minepool.go
- model.go
- multisignatrue.go
- pubkey.go
- query.go
- query_result.go
- threshold_pubkey.go
- transaction.go
- transaction_batch.go
- transaction_evm.go
- transaction_evm_multisig.go
- transaction_manage.go
- transaction_node_delegate.go
- transaction_param.go
- transaction_result.go
- transaction_user_delegate.go
- utils.go
- validator.go
- voter.go