Documentation
¶
Index ¶
- Constants
- func Decode(in []byte, out interface{}) int
- func Encode(in interface{}) []byte
- type Address
- type Hash
- type StTrans
- func (t *StTrans) CreateMove(dstChain uint64)
- func (t *StTrans) CreateTransfer(payee, msg string) error
- func (t *StTrans) CreateVote(payee string) error
- func (t *StTrans) GetSignData() []byte
- func (t *StTrans) Output() []byte
- func (t *StTrans) RegisterMiner(chain uint64, peer string) error
- func (t *StTrans) RunApp(app string, data []byte) error
- func (t *StTrans) SetEnergy(energy uint64) bool
- func (t *StTrans) SetTheSign(in []byte) error
- func (t *StTrans) Unvote() error
- func (t *StTrans) UpdateAppLife(app string, life uint64) error
- type TransactionHead
- type UpdateInfo
- type Wallet
Constants ¶
View Source
const ( // EAddrTypeDefault the type of default public address EAddrTypeDefault = byte(iota + 1) // EAddrTypeIBS identity-based signature EAddrTypeIBS )
View Source
const ( // HashLen the byte length of Hash HashLen = 32 // AddressLen the byte length of Address AddressLen = 24 // AdminNum admin number AdminNum = 23 )
View Source
const ( // AppFlagRun the app can be call AppFlagRun = uint8(1 << iota) // AppFlagImport the app code can be included AppFlagImport // AppFlagPublic App funds address uses the plublc address, except for app, others have no right to operate the address. AppFlagPublic // AppFlagGzipCompress gzip compress AppFlagGzipCompress // AppFlagEnd end of flag AppFlagEnd )
View Source
const ( // OpsTransfer pTransfer OpsTransfer = uint8(iota) // OpsMove Move out of coin, move from this chain to adjacent chains OpsMove // OpsNewChain create new chain OpsNewChain // OpsNewApp create new app OpsNewApp // OpsRunApp run app OpsRunApp // OpsUpdateAppLife update app life OpsUpdateAppLife // OpsRegisterMiner Registered as a miner OpsRegisterMiner // OpsRegisterAdmin Registered as a admin OpsRegisterAdmin // OpsVote vote admin OpsVote // OpsUnvote unvote OpsUnvote // OpsReportError error block OpsReportError )
View Source
const ( TimeMillisecond = 1 TimeSecond = 1000 * TimeMillisecond TimeMinute = 60 * TimeSecond TimeHour = 60 * TimeMinute TimeDay = 24 * TimeHour TimeYear = 31558150 * TimeSecond TimeMonth = TimeYear / 12 )
time
View Source
const (
// TimeDuration one year/12
TimeDuration = 31558150000 / 12
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Address ¶
type Address [AddressLen]byte
Address the wallet address
func (Address) MarshalJSON ¶ added in v0.5.0
MarshalJSON marshal by base64
func (*Address) UnmarshalJSON ¶ added in v0.5.0
UnmarshalJSON UnmarshalJSON
type Hash ¶
Hash The KEY of the block of transaction
func (Hash) MarshalJSON ¶ added in v0.5.0
MarshalJSON marshal by base64
func (*Hash) UnmarshalJSON ¶ added in v0.5.0
UnmarshalJSON UnmarshalJSON
type StTrans ¶
type StTrans struct { TransactionHead Sign []byte Data []byte Key []byte }
StTrans transaction define
func NewTransaction ¶
NewTransaction create a new transaction struct
- NewTransaction
- Create*:CreateTransfer,CreateMove...
- update energy,time...
- GetSignData
- SetSign
- Output
func (*StTrans) CreateMove ¶
CreateMove move coin to other chain
func (*StTrans) CreateTransfer ¶
CreateTransfer transfer
func (*StTrans) CreateVote ¶ added in v0.5.0
CreateVote vote
func (*StTrans) RegisterMiner ¶ added in v0.5.0
RegisterMiner RegisterMiner
func (*StTrans) SetTheSign ¶ added in v0.5.0
SetTheSign set the sign
type TransactionHead ¶
type TransactionHead struct { //signLen uint8 //sing []byte Time uint64 User Address Chain uint64 Energy uint64 Cost uint64 Ops uint8 }
TransactionHead transaction = sign + head + data
type UpdateInfo ¶
UpdateInfo Information of update app life
type Wallet ¶
type Wallet struct { Tag string `json:"tag,omitempty"` AddressStr string `json:"address_str,omitempty"` Address []byte `json:"address,omitempty"` Key []byte `json:"key,omitempty"` SignPrefix []byte `json:"sign_prefix,omitempty"` // contains filtered or unexported fields }
Wallet wallet
func (*Wallet) NewByMnemonic ¶ added in v0.5.0
NewByMnemonic new wallet by Mnemonic
Click to show internal directories.
Click to hide internal directories.