Versions in this module Expand all Collapse all v1 v1.2.4 Apr 23, 2021 Changes in this version + const API_V2_CONTRACT_CALL + const API_V2_CONTRACT_QUERY_ACCOUNT + const API_V2_CONTRACT_QUERY_LOGS + const API_V2_QUERY_ACCOUNT + const API_V3_QUERY_DPOS_POOL + const API_V3_QUERY_DPOS_POOLLOG + const API_V3_QUERY_DPOS_RANKLOG + const API_V3_QUERY_DPOS_TCNLOG + const API_V3_QUERY_DPOS_TINLOG + const API_V3_QUERY_NODE + const API_V3_QUERY_NODES + const API_V3_QUERY_NODEVOTERS + const API_V3_QUERY_VOTER + const CodeType_BadArgument + const CodeType_BadNonce + const CodeType_BadSignature + const CodeType_ContractExecuteErr + const CodeType_ContractExecuteFailed + const CodeType_Deadline + const CodeType_Delegate_Limit + const CodeType_EncodingError + const CodeType_ExecuteTx + const CodeType_InsufficientFunds + const CodeType_InsufficientProfit + const CodeType_InternalError + const CodeType_NodeNotExist + const CodeType_NodeNotRunFor + const CodeType_OK + const CodeType_ReceiverNotExist + const CodeType_SenderNotExist + const CodeType_UnsupportedTx + const CodeType_ValidatorChangeSelf + const CodeType_ValidatorDoubleUpdate + const CodeType_ValidatorIsNotGenesis + const CodeType_ValidatorNotExist + const CodeType_ValidatorNotFound + const CodeType_ValidatorPowerNotEnough + const CodeType_VoterNotExist + const KEY_DPOSBeginHeight + const KEY_DPOSEachHeight + const KEY_DPOSMaxNodeNum + const KEY_NodeMinCollect + const KEY_NodeMinMortgage + const KEY_NodeWorkMortgage + const KEY_UpgradeHeight + const KEY_UserMinCollect + const KEY_UserMinMortgage + const NODE_OPTYPE_COLLECT + const NODE_OPTYPE_MORTGAGE + const NODE_OPTYPE_NULL + const NODE_OPTYPE_REEDEM + const NODE_OPTYPE_WITHDRAW + const PubKeyLength + const TxGas + const USER_OPTYPE_COLLECT + const USER_OPTYPE_MORTGAGE + const USER_OPTYPE_NULL + const USER_OPTYPE_REEDEM + var DefaultConfig = Config + var ErrDeadline = errors.New("tx deadline") + var ErrInsufficientBalance = errors.New("insufficient balance") + var ErrInsufficientPermissions = errors.New("insufficient permissions") + var ErrInvalidGasLimit = errors.New("invalid gasLimit") + var ErrInvalidGasPrice = errors.New("invalid gasPrice") + var ErrInvalidOperations = errors.New("too little/much operations") + var ErrInvalidSignature = errors.New("signature verify failed") + var ErrNotFoundReceiver = errors.New("receiver not exist") + var ErrNotFoundSender = errors.New("sender not exist") + var ErrUnsupportedTx = errors.New("unsupported tx") + var OpType_SetGenesis = uint8(3) + var OpType_SetPower = uint8(2) + var OpType_SetRunFor = uint8(1) + var TxTagAppBatch = []byte + var TxTagAppEvm = []byte + var TxTagAppEvmMultisig = []byte + var TxTagAppFee = []byte + var TxTagAppInit = []byte + var TxTagAppMgr = []byte + var TxTagAppOLO = []byte + var TxTagAppParams = []byte + var TxTagNodeDelegate = []byte + var TxTagTinInit = []byte + var TxTagUserDelegate = []byte + var ZERO_ADDRESS = ethcmn.Address + var ZERO_HASH = ethcmn.Hash + var ZERO_PUBLICKEY = PublicKey + func PubkeyToAddress(pub PublicKey) ethcmn.Address + func ValidAddress(s string) bool + func ValidPublicKey(s string) bool + type ABCIValidator struct + Power int64 + PubKey [32]byte + type Address struct + func (a Address) MarshalText() ([]byte, error) + type AppHeader struct + BlockHash ethcmn.Hash + ClosedAt time.Time + Height *big.Int + MinePool *MinePool + Params *Config + PrevHash ethcmn.Hash + StateRoot ethcmn.Hash + TxCount uint64 + Validator ethcmn.Address + XStateRoot ethcmn.Hash + func (h *AppHeader) Hash() []byte + func (h *AppHeader) String() string + type BeanAccount struct + Address string + Balance string + Nonce uint64 + type BeanContract struct + Address string + Balance string + Code string + Nonce uint64 + Suicided bool + type BeanDPOSPool struct + CurrentHeight int64 + LastHeight int64 + NextHeight int64 + type BeanEvmCallResult = struct + Code uint32 + GasUsed uint64 + Msg string + Ret string + type BeanValidator struct + Address string + Balance string + Genesis bool + Mortgaged string + Nonce uint64 + Power uint64 + Profit string + Redeem bool + RunFor bool + ToMortgage string + Voted string + Voters int + func (v *BeanValidator) ToPrettyJSON() ([]byte, error) + type BeanVot struct + Address string + Amount string + type BeanVoter struct + Address string + Balance string + Burned string + Mortgaged string + Redeem bool + ToMortgage string + Validator string + type BeanVots struct + Address string + Voted string + Voters []BeanVot + func (v *BeanVots) ToPrettyJSON() ([]byte, error) + type Config struct + DPOSBeginHeight int64 + DPOSEachHeight int64 + DPOSMaxNodeNum int + NodeMinCollect int64 + NodeMinMortgage int64 + NodeWorkMortgage int64 + UpgradeHeight int64 + UserMinCollect int64 + UserMinMortgage int64 + func (p *Config) FromBytes(bz []byte) + func (p *Config) ToBytes() []byte + type DPOSPoolLog struct + Balance string + BlockAt time.Time + Height uint64 + Id uint64 + Mined string + Released string + Total string + type DPOSQuery struct + Address ethcmn.Address + Height uint64 + func (q *DPOSQuery) FromBytes(bz []byte) error + func (q *DPOSQuery) ToBytes() []byte + type DPOSRankLog struct + Address string + BlockAt time.Time + Height uint64 + Id uint64 + Mortgaged string + Rank uint32 + Total string + Voted string + Voters uint64 + type DPOSTcnLog struct + Address string + BlockAt time.Time + Height uint64 + Id uint64 + Mortgaged string + Profit string + Voted string + Voters uint64 + type DPOSTinLog struct + Address string + BlockAt time.Time + Height uint64 + Id uint64 + Mortgaged string + Profit string + Validator string + type LastBlockInfo struct + AppHash ethcmn.Hash + Height int64 + PrevHash ethcmn.Hash + StateRoot ethcmn.Hash + ValidatorUpdates []ABCIValidator + XStateRoot ethcmn.Hash + func (block *LastBlockInfo) FromBytes(bz []byte) + func (block *LastBlockInfo) ToBytes() []byte + type MinePool struct + GenesisTime time.Time + LastBlockHeight int64 + LastBlockTime time.Time + func (pool *MinePool) FromBytes(bz []byte) + func (pool *MinePool) ToBytes() []byte + type MultisigEvmTx struct + Deadline uint64 + From ethcmn.Address + GasLimit uint64 + GasPrice *big.Int + Load []byte + Memo []byte + Nonce uint64 + Signature Signature + To ethcmn.Address + Value *big.Int + func NewMultisigEvmTx(k int, pks []PublicKey) *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) ToBytes() []byte + func (tx *MultisigEvmTx) Verify() bool + func (tx MultisigEvmTx) Signer() []ethcmn.Address + type Multisignature struct + BitArray *bitarray.CompactBitArray + Sigs [][]byte + func NewMultisig(n int) *Multisignature + func (mSig *Multisignature) AddSignature(sig []byte, index int) + func (mSig *Multisignature) AddSignatureFromPubKey(sig []byte, pubkey PublicKey, keys []PublicKey) error + func (mSig *Multisignature) Marshal() []byte + func (mSig *Multisignature) UnMarshal(bz []byte) error + type PubKeyMultisigThreshold struct + K uint + PubKeys []PublicKey + func NewPubKeyMultisigThreshold(k int, pubkeys []PublicKey) PubKeyMultisigThreshold + func (pk PubKeyMultisigThreshold) Address() ethcmn.Address + func (pk PubKeyMultisigThreshold) Bytes() []byte + func (pk PubKeyMultisigThreshold) Hash() (sum ethcmn.Hash) + func (pk PubKeyMultisigThreshold) VerifyBytes(msg []byte, marshalledSig []byte) bool + type PublicKey [PubKeyLength]byte + func BytesToPubkey(b []byte) (PublicKey, error) + func HexToPubkey(s string) (PublicKey, error) + func (a *PublicKey) SetBytes(b []byte) + func (a *PublicKey) UnmarshalJSON(input []byte) error + func (a *PublicKey) UnmarshalText(input []byte) error + func (a PublicKey) Big() *big.Int + func (a PublicKey) Bytes() []byte + 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) String() string + func (pk PublicKey) Equals(pk1 PublicKey) bool + func (pk PublicKey) ToAddress() Address + func (pk PublicKey) VerifyBytes(msg, signature []byte) bool + type QueryBase struct + Begin uint64 + Cursor uint64 + End uint64 + Limit uint64 + Order string + type Result struct + Code uint32 + Data []byte + Log string + func NewError(code uint32, log string) Result + func NewResultOK(data []byte, log string) Result + func (res *Result) FromJSON(j string) *Result + func (res Result) AppendLog(log string) Result + func (res Result) Error() string + 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 struct + MultiSig *Multisignature + PubKey PubKeyMultisigThreshold + type TxBatch struct + CreatedAt uint64 + GasLimit uint64 + GasPrice *big.Int + Memo []byte + Nonce uint64 + Ops []TxOp + Sender PublicKey + Signature []byte + func NewTxBatch() *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 struct + Body TxEvmCommon + CreatedAt uint64 + GasLimit uint64 + GasPrice *big.Int + Nonce uint64 + Sender PublicKey + Signature []byte + func NewTxEvm() *TxEvm + func (tx *TxEvm) Cost() *big.Int + func (tx *TxEvm) FromBytes(bs []byte) error + func (tx *TxEvm) Hash() ethcmn.Hash + func (tx *TxEvm) SigHash() ethcmn.Hash + func (tx *TxEvm) Sign(privkey string) ([]byte, error) + func (tx *TxEvm) ToBytes() []byte + func (tx *TxEvm) Verify() bool + type TxEvmCommon struct + Load []byte + Memo []byte + To PublicKey + Value *big.Int + type TxManage struct + CreatedAt uint64 + Nonce uint64 + OpType uint8 + OpValue uint64 + Receiver ed25519.PubKey + Sender ed25519.PubKey + Signature []byte + func NewMgrTx() *TxManage + func (tx *TxManage) FromBytes(bs []byte) error + func (tx *TxManage) Hash() ethcmn.Hash + func (tx *TxManage) Sign(privkey []byte) []byte + func (tx *TxManage) ToBytes() []byte + func (tx *TxManage) Verify() bool + type TxNodeDelegate struct + CreatedAt uint64 + Nonce uint64 + OpType uint8 + OpValue *big.Int + Receiver []byte + Sender ed25519.PubKey + Signature []byte + func NewNodeDelegateTx() *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 struct + To PublicKey + Value *big.Int + type TxParams struct + CreatedAt uint64 + Key []byte + Nonce uint64 + Sender ed25519.PubKey + Signature []byte + Value []byte + func NewTxParams() *TxParams + func (tx *TxParams) FromBytes(bs []byte) error + func (tx *TxParams) Hash() ethcmn.Hash + func (tx *TxParams) Sign(privkey []byte) []byte + func (tx *TxParams) ToBytes() []byte + func (tx *TxParams) Verify() bool + type TxResult struct + Hash common.Hash + Ret []byte + Reversed []byte + func NewTxResult(ret []byte, hash common.Hash) *TxResult + func (tx *TxResult) FromBytes(bs []byte) error + func (tx TxResult) Copy() *TxResult + func (tx TxResult) ToBytes() []byte + type TxUserDelegate struct + CreatedAt uint64 + Nonce uint64 + OpType uint8 + OpValue *big.Int + Receiver []byte + Sender PublicKey + Signature []byte + func NewUserDelegateTx() *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 struct + Balance *big.Int + Genesis bool + Mortgaged *big.Int + Nonce uint64 + Power uint64 + Profit *big.Int + PubKey ed25519.PubKey + Redeem bool + RunFor bool + ToMortgage *big.Int + Voted *big.Int + Voters []Vot + func NewValidator() *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 struct + Address common.Address + Amount *big.Int + type Voter struct + Address common.Address + Balance *big.Int + Burned *big.Int + Mortgaged *big.Int + Redeem bool + ToMortgage *big.Int + Validator common.Address + func NewVoter() *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