api

package
v0.5.11 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 22, 2020 License: BSD-3-Clause Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AccountGet

func AccountGet(w http.ResponseWriter, r *http.Request)

AccountGet get account of the address on the chain

func AdminInfoGet

func AdminInfoGet(w http.ResponseWriter, r *http.Request)

AdminInfoGet get admin info

func AdminsGet

func AdminsGet(w http.ResponseWriter, r *http.Request)

AdminsGet get admin list

func BlockInfoGet

func BlockInfoGet(w http.ResponseWriter, r *http.Request)

BlockInfoGet get block info

func BlockMinePost

func BlockMinePost(w http.ResponseWriter, r *http.Request)

BlockMinePost mine

func ChainNew

func ChainNew(w http.ResponseWriter, r *http.Request)

ChainNew new chain

func ChainsGet added in v0.5.11

func ChainsGet(w http.ResponseWriter, r *http.Request)

ChainsGet get chains list

func CryptoCheck

func CryptoCheck(w http.ResponseWriter, r *http.Request)

CryptoCheck Crypto:check the sign

func CryptoSign

func CryptoSign(w http.ResponseWriter, r *http.Request)

CryptoSign crypto:sign message

func DataExist added in v0.5.11

func DataExist(w http.ResponseWriter, r *http.Request)

DataExist return 200OK when exist the key

func DataGet

func DataGet(w http.ResponseWriter, r *http.Request)

DataGet read data

func DataNextKeyGet

func DataNextKeyGet(w http.ResponseWriter, r *http.Request)

DataNextKeyGet get next key

func DataPost

func DataPost(w http.ResponseWriter, r *http.Request)

DataPost post data

func EventPost

func EventPost(w http.ResponseWriter, r *http.Request)

EventPost mine

func HashPowerGet

func HashPowerGet(w http.ResponseWriter, r *http.Request)

HashPowerGet get hashpower info

func Index

func Index(w http.ResponseWriter, r *http.Request)

Index api for test

func Logger

func Logger(inner http.Handler, name string) http.Handler

Logger print log

func MiningBlockGet

func MiningBlockGet(w http.ResponseWriter, r *http.Request)

MiningBlockGet get block for mining

func NewRouter

func NewRouter() *mux.Router

NewRouter 创建http路由

func NodeAddressGet

func NodeAddressGet(w http.ResponseWriter, r *http.Request)

NodeAddressGet get self node address

func NodePost

func NodePost(w http.ResponseWriter, r *http.Request)

NodePost add new node

func NodesGet

func NodesGet(w http.ResponseWriter, r *http.Request)

NodesGet get nodes

func TimeGet

func TimeGet(w http.ResponseWriter, r *http.Request)

TimeGet get the node time(Unix)

func TransactionAdminPost

func TransactionAdminPost(w http.ResponseWriter, r *http.Request)

TransactionAdminPost register admin candidate

func TransactionAppInfoGet

func TransactionAppInfoGet(w http.ResponseWriter, r *http.Request)

TransactionAppInfoGet get app info

func TransactionAppLifePost

func TransactionAppLifePost(w http.ResponseWriter, r *http.Request)

TransactionAppLifePost update app life

func TransactionInfoGet

func TransactionInfoGet(w http.ResponseWriter, r *http.Request)

TransactionInfoGet get transaction info

func TransactionMinerPost

func TransactionMinerPost(w http.ResponseWriter, r *http.Request)

TransactionMinerPost register miner

func TransactionMovePost

func TransactionMovePost(w http.ResponseWriter, r *http.Request)

TransactionMovePost move cost to other chain

func TransactionNew

func TransactionNew(w http.ResponseWriter, r *http.Request)

TransactionNew new transaction

func TransactionNewAppPost

func TransactionNewAppPost(w http.ResponseWriter, r *http.Request)

TransactionNewAppPost new app

func TransactionRunAppPost

func TransactionRunAppPost(w http.ResponseWriter, r *http.Request)

TransactionRunAppPost run app

func TransactionTransferPost

func TransactionTransferPost(w http.ResponseWriter, r *http.Request)

TransactionTransferPost transfer

func TrustedBlockGet

func TrustedBlockGet(w http.ResponseWriter, r *http.Request)

TrustedBlockGet get the trusted blocks

func VersionGet

func VersionGet(w http.ResponseWriter, r *http.Request)

VersionGet get software version

func VoteInfoGet

func VoteInfoGet(w http.ResponseWriter, r *http.Request)

VoteInfoGet get vote info

func VoteRewardGet

func VoteRewardGet(w http.ResponseWriter, r *http.Request)

VoteRewardGet get vote info

func WSBlockForMining

func WSBlockForMining(ws *websocket.Conn)

WSBlockForMining ws

Types

type Account

type Account struct {
	Chain   uint64 `json:"chain,omitempty"`
	Address string `json:"address,omitempty"`
	Cost    uint64 `json:"cost,omitempty"`
}

Account account

type Admin

type Admin struct {
	Cost     uint64 `json:"cost,omitempty"`
	TransKey string `json:"trans_key,omitempty"`
}

Admin admin

type AdminInfo

type AdminInfo struct {
	Address string `json:"address"`
	Deposit uint64 `json:"deposit"`
	Votes   uint64 `json:"votes"`
}

AdminInfo admin info

type AppLife

type AppLife struct {
	Energy   uint64 `json:"energy,omitempty"`
	AppName  string `json:"app_name,omitempty"`
	Life     uint64 `json:"life,omitempty"`
	TransKey string `json:"trans_key,omitempty"`
}

AppLife app life

type ChainNewInfo

type ChainNewInfo struct {
	DstChain uint64 `json:"dst_chain,omitempty"`
	Cost     uint64 `json:"cost,omitempty"`
	Energy   uint64 `json:"energy,omitempty"`
	TransKey string `json:"trans_key,omitempty"`
}

ChainNewInfo info of new chain

type CryptoInfo

type CryptoInfo struct {
	Owner   string
	Sign    string
	Message string
	HexMsg  bool
}

CryptoInfo crypto info

type DataInfo

type DataInfo struct {
	AppName    string `json:"app_name,omitempty"`
	StructName string `json:"struct_name,omitempty"`
	IsDBData   bool   `json:"is_db_data,omitempty"`
	Key        string `json:"key,omitempty"`
	Value      string `json:"value,omitempty"`
	Life       uint64 `json:"life,omitempty"`
}

DataInfo data info

type DataNextKey

type DataNextKey struct {
	AppName    string `json:"app_name,omitempty"`
	StructName string `json:"struct_name,omitempty"`
	PreKey     string `json:"pre_key,omitempty"`
	IsDBData   bool   `json:"is_db_data,omitempty"`
	Key        string `json:"key,omitempty"`
}

DataNextKey the next key of data

type EventInfo

type EventInfo struct {
	Who   string
	Event string
	Param string
}

EventInfo event

type Miner

type Miner struct {
	TargetChain uint64 `json:"target_chain,omitempty"`
	Cost        uint64 `json:"cost,omitempty"`
	Energy      uint64 `json:"energy,omitempty"`
	Miner       string `json:"miner,omitempty"`
	TransKey    string `json:"trans_key,omitempty"`
}

Miner miner info

type NewApp

type NewApp struct {
	Cost         uint64 `json:"cost,omitempty"`
	Energy       uint64 `json:"energy,omitempty"`
	CodePath     string `json:"code_path,omitempty"`
	IsPrivate    bool   `json:"is_private,omitempty"`
	EnableRun    bool   `json:"enable_run,omitempty"`
	EnableImport bool   `json:"enable_import,omitempty"`
	AppName      string `json:"app_name,omitempty"`
	TransKey     string `json:"trans_key,omitempty"`
}

NewApp new app

type NodeInfo

type NodeInfo struct {
	Address    string `json:"address,omitempty"`
	Miners     int    `json:"miners,omitempty"`
	NodeNumber int    `json:"node_number,omitempty"`
}

NodeInfo node info

type RespOfNewTrans

type RespOfNewTrans struct {
	Chain    uint64 `json:"chain,omitempty"`
	TransKey string `json:"trans_key,omitempty"`
}

RespOfNewTrans the response of New Transaction

type Route

type Route struct {
	Name        string
	Method      string
	Pattern     string
	HandlerFunc http.HandlerFunc
}

Route route item

type Routes

type Routes []Route

Routes route list

type RunApp

type RunApp struct {
	Cost      uint64      `json:"cost,omitempty"`
	Energy    uint64      `json:"energy,omitempty"`
	AppName   string      `json:"app_name,omitempty"`
	Param     string      `json:"param,omitempty"`
	ParamType string      `json:"param_type,omitempty"`
	JSONParam interface{} `json:"json_param,omitempty"`
}

RunApp run app

type TransInfo

type TransInfo struct {
	core.TransactionHead
	Key    []byte
	Size   int
	Others interface{}
}

TransInfo transaction info

type TransMoveInfo

type TransMoveInfo struct {
	DstChain uint64 `json:"dst_chain,omitempty"`
	Cost     uint64 `json:"cost,omitempty"`
	Energy   uint64 `json:"energy,omitempty"`
	TransKey string `json:"trans_key,omitempty"`
}

TransMoveInfo move info

type TransferInfo

type TransferInfo struct {
	Peer     string `json:"peer,omitempty"`
	Cost     uint64 `json:"cost,omitempty"`
	Energy   uint64 `json:"energy,omitempty"`
	TransKey string `json:"trans_key,omitempty"`
}

TransferInfo transfer info

type VersionInfo

type VersionInfo struct {
	Version   string
	BuildTime string
	GitHead   string
}

VersionInfo version info

type VoteInfo

type VoteInfo struct {
	Address  string `json:"address,omitempty"`
	Admin    string `json:"admin,omitempty"`
	Votes    uint64 `json:"votes,omitempty"`
	StartDay uint64 `json:"start_day,omitempty"`
}

VoteInfo vote info

type VoteReward

type VoteReward struct {
	Reward uint64 `json:"reward,omitempty"`
	Day    uint64 `json:"day,omitempty"`
}

VoteReward vote reward

type WSRoute

type WSRoute struct {
	Name        string
	Pattern     string
	HandlerFunc websocket.Handler
}

WSRoute websocket route item

type WSRoutes

type WSRoutes []WSRoute

WSRoutes websocket route list

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL