Documentation ¶
Index ¶
- Constants
- Variables
- func IsPrecompiledContractAddress(addr Address) bool
- func IsPrecompiledContractWithoutQuotaAddress(addr Address) bool
- func IsValidHexAddress(hexStr string) bool
- func IsValidHexTokenTypeId(hexStr string) bool
- type Address
- func BigToAddress(b *big.Int) (Address, error)
- func BytesToAddress(b []byte) (Address, error)
- func CreateAddress() (Address, ed25519.PrivateKey, error)
- func CreateAddressWithDeterministic(d [32]byte) (Address, ed25519.PrivateKey, error)
- func CreateContractAddress(data ...[]byte) Address
- func HexToAddress(hexStr string) (Address, error)
- func PrikeyToAddress(key ed25519.PrivateKey) Address
- func PubkeyToAddress(pubkey []byte) Address
- type BlockSource
- type ConsensusGroupInfo
- type GetError
- type Gid
- type Hash
- type Registration
- type TokenInfo
- type TokenTypeId
- type VoteInfo
Constants ¶
View Source
const ( AddressPrefix = "vite_" AddressSize = 20 )
View Source
const ( Unkonwn BlockSource = 0 RemoteBroadcast = 10 RemoteFetch = 20 Local = 30 RollbackChain = 40 QueryChain = 41 RemoteSync = 50 )
View Source
const ( TokenTypeIdPrefix = "tti_" TokenTypeIdSize = 10 )
View Source
const (
GidSize = 10
)
View Source
const (
HashSize = 32
)
Variables ¶
View Source
var (
AddressRegister, _ = BytesToAddress([]byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1})
AddressVote, _ = BytesToAddress([]byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2})
AddressPledge, _ = BytesToAddress([]byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3})
AddressConsensusGroup, _ = BytesToAddress([]byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4})
AddressMintage, _ = BytesToAddress([]byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5})
PrecompiledContractAddressList = []Address{AddressRegister, AddressVote, AddressPledge, AddressConsensusGroup, AddressMintage}
PrecompiledContractWithoutQuotaAddressList = []Address{AddressRegister, AddressVote, AddressPledge, AddressConsensusGroup, AddressMintage}
)
View Source
var ( PRIVATE_GID = Gid{0, 0, 0, 0, 0, 0, 0, 0, 0, 0} SNAPSHOT_GID = Gid{0, 0, 0, 0, 0, 0, 0, 0, 0, 1} DELEGATE_GID = Gid{0, 0, 0, 0, 0, 0, 0, 0, 0, 2} )
View Source
var AccountLimitSnapshotHeight = uint64(60 * 60 * 24)
View Source
var EmptyHeight = uint64(0)
View Source
var (
ErrJsonNotString = errors.New("not valid string")
)
View Source
var GenesisHeight = uint64(1)
View Source
var SnapshotDayHeight = uint64(60 * 60 * 24)
View Source
var SnapshotHourHeight = uint64(60 * 60)
View Source
var ZERO_HASH = Hash{}
View Source
var ZERO_TOKENID = TokenTypeId{}
Functions ¶
func IsPrecompiledContractWithoutQuotaAddress ¶ added in v1.3.0
func IsValidHexAddress ¶
func IsValidHexTokenTypeId ¶
Types ¶
type Address ¶
type Address [AddressSize]byte
func BytesToAddress ¶
func CreateAddress ¶
func CreateAddress() (Address, ed25519.PrivateKey, error)
func CreateAddressWithDeterministic ¶
func CreateAddressWithDeterministic(d [32]byte) (Address, ed25519.PrivateKey, error)
func CreateContractAddress ¶
func HexToAddress ¶
func PrikeyToAddress ¶
func PrikeyToAddress(key ed25519.PrivateKey) Address
func PubkeyToAddress ¶
func (Address) MarshalText ¶
func (*Address) UnmarshalJSON ¶
type BlockSource ¶
type BlockSource uint16
type ConsensusGroupInfo ¶
type ConsensusGroupInfo struct { Gid Gid // Consensus group id NodeCount uint8 // Active miner count Interval int64 // Timestamp gap between two continuous block PerCount int64 // Continuous block generation interval count RandCount uint8 // Random miner count RandRank uint8 // Chose random miner with a rank limit of vote CountingTokenId TokenTypeId // Token id for selecting miner through vote RegisterConditionId uint8 RegisterConditionParam []byte VoteConditionId uint8 VoteConditionParam []byte Owner Address PledgeAmount *big.Int WithdrawHeight uint64 }
func (*ConsensusGroupInfo) IsActive ¶
func (groupInfo *ConsensusGroupInfo) IsActive() bool
type Hash ¶
func BytesToHash ¶
func DataListHash ¶
func HexToHashPanic ¶ added in v1.3.0
func (Hash) MarshalText ¶
func (*Hash) UnmarshalJSON ¶
type Registration ¶
type Registration struct { Name string NodeAddr Address PledgeAddr Address Amount *big.Int WithdrawHeight uint64 RewardIndex uint64 CancelHeight uint64 HisAddrList []Address }
func (*Registration) IsActive ¶
func (r *Registration) IsActive() bool
type TokenInfo ¶
type TokenInfo struct { TokenName string `json:"tokenName"` TokenSymbol string `json:"tokenSymbol"` TotalSupply *big.Int `json:"totalSupply"` Decimals uint8 `json:"decimals"` Owner Address `json:"owner"` PledgeAmount *big.Int `json:"pledgeAmount"` PledgeAddr Address `json:"pledgeAddr"` WithdrawHeight uint64 `json:"withdrawHeight"` MaxSupply *big.Int `json:"maxSupply"` OwnerBurnOnly bool `json:"ownerBurnOnly"` IsReIssuable bool `json:"isReIssuable"` }
type TokenTypeId ¶
type TokenTypeId [TokenTypeIdSize]byte
func BigToTokenTypeId ¶ added in v1.2.0
func BigToTokenTypeId(b *big.Int) (TokenTypeId, error)
func BytesToTokenTypeId ¶
func BytesToTokenTypeId(b []byte) (TokenTypeId, error)
func CreateTokenTypeId ¶
func CreateTokenTypeId(data ...[]byte) TokenTypeId
func HexToTokenTypeId ¶
func HexToTokenTypeId(hexStr string) (TokenTypeId, error)
func (TokenTypeId) Bytes ¶
func (tid TokenTypeId) Bytes() []byte
func (TokenTypeId) Hex ¶
func (tid TokenTypeId) Hex() string
func (TokenTypeId) MarshalText ¶
func (tid TokenTypeId) MarshalText() ([]byte, error)
func (*TokenTypeId) SetBytes ¶
func (tid *TokenTypeId) SetBytes(b []byte) error
func (TokenTypeId) String ¶
func (tid TokenTypeId) String() string
func (*TokenTypeId) UnmarshalJSON ¶
func (tid *TokenTypeId) UnmarshalJSON(input []byte) error
Click to show internal directories.
Click to hide internal directories.