Documentation
¶
Index ¶
- Constants
- Variables
- func Broadcast(user interface{}, msg []byte)
- func Decode(typ uint8, in []byte, out interface{}) int
- func DeleteAccount(user interface{}, addr Address)
- func Encode(typ uint8, in interface{}) []byte
- func Event(user interface{}, event string, param ...[]byte)
- func GetDBData(name string, key []byte) ([]byte, uint64)
- func IHateYou(user interface{}, peer Address, cost uint64)
- func InitForTest()
- func MoveCost(user interface{}, chain, cost uint64)
- func Recover(address, sign, msg []byte) bool
- func RegisterAdmin(app interface{}, index uint8, cost uint64)
- func SetAppAccountForTest(in interface{}, value uint64)
- func SetCostForTest(account Address, value uint64)
- func TransferAccounts(owner interface{}, payee Address, value uint64)
- func UpdateAppLife(AppName Hash, life uint64)
- func UpdateConfig(user interface{}, ops uint8, newSize uint32)
- type Address
- type AdminInfo
- type AppInfo
- type BaseInfo
- type BroadcastInfo
- type DB
- type DependItem
- type Hash
- type Log
Constants ¶
const ( TimeMillisecond = 1 TimeSecond = 1000 * TimeMillisecond TimeMinute = 60 * TimeSecond TimeHour = 60 * TimeMinute TimeDay = 24 * TimeHour TimeYear = 31558150 * TimeSecond TimeMonth = TimeYear / 12 )
time
const ( // HashLen the byte length of Hash HashLen = 32 // AddressLen the byte length of Address AddressLen = 24 )
const ( StatBaseInfo = uint8(iota) StatTransKey StatGuerdon StatBlockSizeLimit StatAvgBlockSize StatHashPower StatBlockInterval StatSyncInfo StatFirstBlockKey StatChangingConfig StatBroadcast StatHateRatio StatParentKey StatUser )
Key of the running state
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 // OpsDisableAdmin disable admin OpsDisableAdmin )
const ( EncBinary = uint8(iota) EncJSON EncGob )
encoding type
const ( // AppFlagRun the app can be call AppFlagRun = uint8(1 << iota) // AppFlagImport the app code can be included AppFlagImport // AppFlagPlublc App funds address uses the plublc address, except for app, others have no right to operate the address. AppFlagPlublc // AppFlagGzipCompress gzip compress AppFlagGzipCompress )
const ( SyncOpsMoveCoin = iota SyncOpsNewChain SyncOpsMiner SyncOpsBroadcast SyncOpsBroadcastAck SyncOpsHateRatio )
ops of sync
Variables ¶
var ChainID uint64
ChainID ChainID
Functions ¶
func Broadcast ¶
func Broadcast(user interface{}, msg []byte)
Broadcast admin broadcast info to all chain from first chain
func DeleteAccount ¶
func DeleteAccount(user interface{}, addr Address)
DeleteAccount Delete long unused accounts(more than 5 years),call by admin
func GetDBData ¶
GetDBData get data by name. name list:dbTransInfo,dbCoin,dbAdmin,dbStat,dbApp,dbHate,dbMining,depend,logBlockInfo,logSync
func MoveCost ¶
func MoveCost(user interface{}, chain, cost uint64)
MoveCost move app cost to other chain(child chain or parent chain)
func RegisterAdmin ¶
RegisterAdmin app register as a admin
func SetAppAccountForTest ¶
func SetAppAccountForTest(in interface{}, value uint64)
SetAppAccountForTest SetAppAccountForTest
func SetCostForTest ¶
SetCostForTest SetCostForTest
func TransferAccounts ¶
TransferAccounts pTransfer based on the app private object
func UpdateConfig ¶
UpdateConfig admin change the config
Types ¶
type Address ¶
type Address [AddressLen]byte
Address the wallet address
func GetAppAccount ¶
func GetAppAccount(in interface{}) Address
GetAppAccount Get the owner Address of the app
func (Address) MarshalJSON ¶
MarshalJSON marshal by base64
func (*Address) UnmarshalJSON ¶
UnmarshalJSON UnmarshalJSON
type BaseInfo ¶
type BaseInfo struct { Key Hash Time uint64 Chain uint64 ID uint64 BaseOpsEnergy uint64 Producer Address ParentID uint64 LeftChildID uint64 RightChildID uint64 }
BaseInfo stat info of last block
type BroadcastInfo ¶
BroadcastInfo broadcase info
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
DB Type definition of a database.
func GetDB ¶
func GetDB(owner interface{}) *DB
GetDB Through the private structure in app, get a DB of app, the parameter must be a structure, not a pointer. such as: owner = tAppInfo{}
type DependItem ¶
DependItem App's dependency information
type Hash ¶
Hash The KEY of the block of transaction
func GetAppName ¶
func GetAppName(in interface{}) Hash
GetAppName Get the app name based on the private object
func (*Hash) UnmarshalJSON ¶
UnmarshalJSON UnmarshalJSON
type Log ¶
type Log struct {
// contains filtered or unexported fields
}
Log Type definition of a log. Log data can be read on other chains. Unable to overwrite the existing data.