Documentation ¶
Index ¶
- Variables
- func AppendIfNotExists(arr *[]string, elem string)
- func Base58Decode(s string) []byte
- func Base58Encode(raw []byte) string
- func BelongsTo(elem string, arr []string) bool
- func BytesToInt32(b []byte) int32
- func BytesToInt64(b []byte) int64
- func Int32ToBytes(n int32) []byte
- func Int64ToBytes(n int64) []byte
- func LoadYamlAsViper(configfile string) *viper.Viper
- func Mode() string
- func NextSlot() int64
- func Parity(bit []byte) []byte
- func ParseHex(s string) []byte
- func RescalePair(a *Decimal, b *Decimal) (*Decimal, *Decimal, error)
- func Ripemd160(raw []byte) []byte
- func SetMode(m ModeType)
- func Sha256(raw []byte) []byte
- func Sha3(raw []byte) []byte
- func SlotOfUnixNano(unixnano int64) int64
- func StringSliceEqual(a, b []string) bool
- func TimeOfBlock(slot int64, num int64) time.Time
- func ToHex(data []byte) string
- func WitnessOfNanoSec(nanosec int64, witnessList []string) string
- type ACCConfig
- type Config
- type ConsoleLogConfig
- type DBConfig
- type DebugConfig
- type Decimal
- func (f *Decimal) Add(other *Decimal) *Decimal
- func (f *Decimal) DivInt(i int64) *Decimal
- func (f *Decimal) Equals(other *Decimal) bool
- func (f *Decimal) Float64() float64
- func (f *Decimal) FloorInt() int64
- func (f *Decimal) GreaterThan(other *Decimal) bool
- func (f *Decimal) IsNegative() bool
- func (f *Decimal) IsPositive() bool
- func (f *Decimal) IsZero() bool
- func (f *Decimal) LessThan(other *Decimal) bool
- func (f *Decimal) Marshal() string
- func (f *Decimal) Mul(other *Decimal) *Decimal
- func (f *Decimal) MulFloat(v float64) *Decimal
- func (f *Decimal) MulInt(i int64) *Decimal
- func (f *Decimal) Neg() *Decimal
- func (f *Decimal) Rescale(targetScale int) *Decimal
- func (f *Decimal) ShrinkScale() *Decimal
- func (f *Decimal) String() string
- func (f *Decimal) Sub(other *Decimal) *Decimal
- func (f *Decimal) ToStringWithFullScale() string
- type FileLogConfig
- type GenesisConfig
- type LogConfig
- type MetricsConfig
- type ModeType
- type P2PConfig
- type RPCConfig
- type SPVConfig
- type SimpleDecoder
- type SimpleEncoder
- func (se *SimpleEncoder) Bytes() []byte
- func (se *SimpleEncoder) Reset()
- func (se *SimpleEncoder) WriteByte(b byte)
- func (se *SimpleEncoder) WriteBytes(bs []byte)
- func (se *SimpleEncoder) WriteBytesSlice(p [][]byte)
- func (se *SimpleEncoder) WriteInt32(i int32)
- func (se *SimpleEncoder) WriteInt64(i int64)
- func (se *SimpleEncoder) WriteMapStringToI64(m map[string]int64)
- func (se *SimpleEncoder) WriteString(s string)
- func (se *SimpleEncoder) WriteStringSlice(p []string)
- type SnapshotConfig
- type TokenInfo
- type VMConfig
- type VersionConfig
- type Witness
Constants ¶
This section is empty.
Variables ¶
var ( MaxBlockGasLimit = int64(800000000) MaxTxTimeLimit = 200 * time.Millisecond MaxBlockTimeLimit = 400 * time.Millisecond )
Constant of limit
var ( VoteInterval = int64(1200) SlotInterval = 3 * time.Second BlockInterval = 500 * time.Millisecond BlockNumPerWitness = 6 )
Witness
Functions ¶
func AppendIfNotExists ¶ added in v3.7.0
func LoadYamlAsViper ¶
LoadYamlAsViper load yaml file as viper object
func RescalePair ¶ added in v3.7.1
RescalePair make two decimal number have same scale.
func SlotOfUnixNano ¶
SlotOfUnixNano will return the slot number of unixnano.
func StringSliceEqual ¶
StringSliceEqual is compare two strings
func TimeOfBlock ¶
TimeOfBlock will return the block time for specific slots and num.
func WitnessOfNanoSec ¶
WitnessOfNanoSec will return which witness is the current time.
Types ¶
type Config ¶
type Config struct { ACC *ACCConfig Genesis string VM *VMConfig DB *DBConfig Snapshot *SnapshotConfig P2P *P2PConfig RPC *RPCConfig Log *LogConfig Metrics *MetricsConfig Debug *DebugConfig Version *VersionConfig SPV *SPVConfig }
Config provide all configuration for the application
type ConsoleLogConfig ¶
ConsoleLogConfig is the config for consolewriter of ilog.
type DebugConfig ¶
type DebugConfig struct {
ListenAddr string
}
DebugConfig is the config of debug.
type Decimal ¶ added in v3.7.1
Decimal implements decimal number for use of token balance
func NewDecimalExp10 ¶ added in v3.7.1
func NewDecimalFromInt ¶ added in v3.7.1
func NewDecimalFromIntWithScale ¶ added in v3.7.1
func NewDecimalFromString ¶ added in v3.7.1
NewDecimalFromString generate Decimal from string and scale, will truncate if scale is smaller. scale < 0 means auto detecting scale
func UnmarshalDecimal ¶ added in v3.7.1
UnmarshalDecimal unmarshal from string
func (*Decimal) GreaterThan ¶ added in v3.7.1
GreaterThan ...
func (*Decimal) Rescale ¶ added in v3.7.1
Rescale change scale to given scale, without changing its real value
func (*Decimal) ShrinkScale ¶ added in v3.7.1
ShrinkScale remove trailing 0s
func (*Decimal) ToStringWithFullScale ¶ added in v3.7.1
ToStringWithFullScale convert to string with tailing 0s
type FileLogConfig ¶
FileLogConfig is the config for filewriter of ilog.
type GenesisConfig ¶
type GenesisConfig struct { CreateGenesis bool InitialTimestamp string TokenInfo *TokenInfo WitnessInfo []*Witness ContractPath string AdminInfo *Witness FoundationInfo *Witness }
GenesisConfig config of the genesis bloc
type LogConfig ¶
type LogConfig struct { FileLog *FileLogConfig ConsoleLog *ConsoleLogConfig AsyncWrite bool EnableContractLog bool }
LogConfig is the config of ilog.
type MetricsConfig ¶
MetricsConfig is the config of metrics.
type P2PConfig ¶
type P2PConfig struct { ListenAddr string SeedNodes []string ChainID uint32 Version uint16 DataPath string InboundConn int OutboundConn int BlackPID []string BlackIP []string AdminPort string }
P2PConfig is the config for p2p network.
type RPCConfig ¶
type RPCConfig struct { Enable bool GatewayAddr string GRPCAddr string AllowOrigins []string TryTx bool ExecTx bool }
RPCConfig is the config for RPC Server.
type SimpleDecoder ¶
type SimpleDecoder struct {
// contains filtered or unexported fields
}
SimpleDecoder is a simple decoder used to convert bytes to other types. Not used now!!!
func NewSimpleDecoder ¶
func NewSimpleDecoder(input []byte) *SimpleDecoder
NewSimpleDecoder returns a new SimpleDecoder instance.
func (*SimpleDecoder) ParseByte ¶
func (sd *SimpleDecoder) ParseByte() (byte, error)
ParseByte parse input, return first byte
func (*SimpleDecoder) ParseBytes ¶
func (sd *SimpleDecoder) ParseBytes() ([]byte, error)
ParseBytes parse input, return first byte array
func (*SimpleDecoder) ParseInt32 ¶
func (sd *SimpleDecoder) ParseInt32() (int32, error)
ParseInt32 parse input, return first int32
type SimpleEncoder ¶
type SimpleEncoder struct {
// contains filtered or unexported fields
}
SimpleEncoder is a simple encoder used to convert struct to bytes.
func NewSimpleEncoder ¶
func NewSimpleEncoder() *SimpleEncoder
NewSimpleEncoder returns a new SimpleEncoder instance.
func (*SimpleEncoder) Bytes ¶
func (se *SimpleEncoder) Bytes() []byte
Bytes returns the result bytes of buffer.
func (*SimpleEncoder) WriteByte ¶
func (se *SimpleEncoder) WriteByte(b byte)
WriteByte writes a byte to buffer.
func (*SimpleEncoder) WriteBytes ¶
func (se *SimpleEncoder) WriteBytes(bs []byte)
WriteBytes writes a byte slice to buffer.
func (*SimpleEncoder) WriteBytesSlice ¶
func (se *SimpleEncoder) WriteBytesSlice(p [][]byte)
WriteBytesSlice writes a bytes slice to buffer.
func (*SimpleEncoder) WriteInt32 ¶
func (se *SimpleEncoder) WriteInt32(i int32)
WriteInt32 writes a int32 to buffer.
func (*SimpleEncoder) WriteInt64 ¶
func (se *SimpleEncoder) WriteInt64(i int64)
WriteInt64 writes a int64 to buffer.
func (*SimpleEncoder) WriteMapStringToI64 ¶
func (se *SimpleEncoder) WriteMapStringToI64(m map[string]int64)
WriteMapStringToI64 writes a map[string]int64 to buffer.
func (*SimpleEncoder) WriteString ¶
func (se *SimpleEncoder) WriteString(s string)
WriteString writes a string to buffer.
func (*SimpleEncoder) WriteStringSlice ¶
func (se *SimpleEncoder) WriteStringSlice(p []string)
WriteStringSlice writes a string slice to buffer.
type SnapshotConfig ¶
SnapshotConfig is the config of snapshot
type VersionConfig ¶
VersionConfig contrains netname(mainnet / testnet etc) and protocol info