servers

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: May 22, 2020 License: MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const TlsPort = 443

Variables

View Source
var (
	Compile     string
	Config      *config.Configuration
	ChainParams *config.Params
	Chain       *blockchain.BlockChain
	Store       blockchain.IChainStore
	TxMemPool   *mempool.TxPool
	Pow         *pow.Service
	Server      elanet.Server
	Arbiter     *dpos.Arbitrator
	Arbiters    state.Arbitrators
	Wallet      *wallet.Wallet
)

Functions

func AuxHelp

func AuxHelp(param Params) map[string]interface{}

func CreateAuxBlock

func CreateAuxBlock(param Params) map[string]interface{}

func CreateRawTransaction added in v0.5.0

func CreateRawTransaction(param Params) map[string]interface{}

func DecodeRawTransaction added in v0.5.0

func DecodeRawTransaction(param Params) map[string]interface{}

func DiscreteMining

func DiscreteMining(param Params) map[string]interface{}

func EstimateSmartFee added in v0.2.2

func EstimateSmartFee(param Params) map[string]interface{}

func FromReversedString

func FromReversedString(reversed string) ([]byte, error)

func GetAmountByInputs added in v0.3.2

func GetAmountByInputs(param Params) map[string]interface{}

func GetArbiterPeersInfo added in v0.3.0

func GetArbiterPeersInfo(params Params) map[string]interface{}

func GetArbitersInfo added in v0.3.0

func GetArbitersInfo(params Params) map[string]interface{}

func GetArbitratorGroupByHeight

func GetArbitratorGroupByHeight(param Params) map[string]interface{}

func GetAssetByHash

func GetAssetByHash(param Params) map[string]interface{}

GetAssetByHash always return ELA asset Deprecated: It may be removed in the next version

func GetBalanceByAddr

func GetBalanceByAddr(param Params) map[string]interface{}

func GetBalanceByAsset deprecated

func GetBalanceByAsset(param Params) map[string]interface{}

Deprecated: May be removed in the next version

func GetBestBlockHash

func GetBestBlockHash(param Params) map[string]interface{}

func GetBlockByHash

func GetBlockByHash(param Params) map[string]interface{}

func GetBlockByHeight

func GetBlockByHeight(param Params) map[string]interface{}

func GetBlockCount

func GetBlockCount(param Params) map[string]interface{}

func GetBlockHash

func GetBlockHash(param Params) map[string]interface{}

func GetBlockHeight

func GetBlockHeight(param Params) map[string]interface{}

func GetBlockTransactions

func GetBlockTransactions(block *Block) interface{}

func GetCRDepositCoin added in v0.5.0

func GetCRDepositCoin(param Params) map[string]interface{}

func GetCRProposalState added in v0.5.0

func GetCRProposalState(param Params) map[string]interface{}

func GetConfirmByHash added in v0.3.0

func GetConfirmByHash(param Params) map[string]interface{}

func GetConfirmByHeight added in v0.3.0

func GetConfirmByHeight(param Params) map[string]interface{}

func GetConnectionCount

func GetConnectionCount(param Params) map[string]interface{}

func GetDepositCoin added in v0.2.2

func GetDepositCoin(param Params) map[string]interface{}

func GetExistWithdrawTransactions added in v0.1.1

func GetExistWithdrawTransactions(param Params) map[string]interface{}

func GetFeeRate added in v0.2.2

func GetFeeRate(count int, confirm int) int

func GetInfo

func GetInfo(param Params) map[string]interface{}

func GetMiningInfo added in v0.3.4

func GetMiningInfo(param Params) map[string]interface{}

func GetNeighbors

func GetNeighbors(param Params) map[string]interface{}

func GetNodeState

func GetNodeState(param Params) map[string]interface{}

func GetRawTransaction

func GetRawTransaction(param Params) map[string]interface{}

Input JSON string examples for getblock method as following:

func GetReceivedByAddress added in v0.2.0

func GetReceivedByAddress(param Params) map[string]interface{}

func GetSecretaryGeneral added in v0.5.0

func GetSecretaryGeneral(param Params) map[string]interface{}

func GetTransactionByHash

func GetTransactionByHash(param Params) map[string]interface{}

Transaction

func GetTransactionPool

func GetTransactionPool(param Params) map[string]interface{}

func GetTransactionsByHeight

func GetTransactionsByHeight(param Params) map[string]interface{}

func GetUTXOsByAmount added in v0.3.2

func GetUTXOsByAmount(param Params) map[string]interface{}

func GetUnspendOutput deprecated

func GetUnspendOutput(param Params) map[string]interface{}

Deprecated: May be removed in the next version

func GetUnspends

func GetUnspends(param Params) map[string]interface{}

func ListCRCandidates added in v0.5.0

func ListCRCandidates(param Params) map[string]interface{}

list cr candidates according to ( state , start and limit)

func ListCRProposalBaseState added in v0.5.0

func ListCRProposalBaseState(param Params) map[string]interface{}

func ListCurrentCRs added in v0.5.0

func ListCurrentCRs(param Params) map[string]interface{}

list current crs according to (state)

func ListProducers added in v0.2.2

func ListProducers(param Params) map[string]interface{}

func ListUnspent added in v0.1.1

func ListUnspent(param Params) map[string]interface{}

func ProducerStatus added in v0.2.2

func ProducerStatus(param Params) map[string]interface{}

func ResponsePack

func ResponsePack(errCode ServerErrCode, result interface{}) map[string]interface{}

func SendRawTransaction

func SendRawTransaction(param Params) map[string]interface{}

func SetLogLevel

func SetLogLevel(param Params) map[string]interface{}

func SignRawTransactionWithKey added in v0.5.0

func SignRawTransactionWithKey(param Params) map[string]interface{}

func SubmitAuxBlock

func SubmitAuxBlock(param Params) map[string]interface{}

func SubmitSidechainIllegalData added in v0.3.0

func SubmitSidechainIllegalData(param Params) map[string]interface{}

func ToReversedString

func ToReversedString(hash common.Uint256) string

func ToggleMining

func ToggleMining(param Params) map[string]interface{}

func VerifyAndSendTx

func VerifyAndSendTx(tx *Transaction) error

func VoteStatus added in v0.2.2

func VoteStatus(param Params) map[string]interface{}

Types

type ActivateProducerInfo added in v0.3.2

type ActivateProducerInfo struct {
	NodePublicKey string `json:"nodepublickey"`
	Signature     string `json:"signature"`
}

type ArbitratorGroupInfo

type ArbitratorGroupInfo struct {
	OnDutyArbitratorIndex int      `json:"ondutyarbitratorindex"`
	Arbitrators           []string `json:"arbitrators"`
}

type AttributeInfo

type AttributeInfo struct {
	Usage AttributeUsage `json:"usage"`
	Data  string         `json:"data"`
}

type BlockInfo

type BlockInfo struct {
	Hash              string        `json:"hash"`
	Confirmations     uint32        `json:"confirmations"`
	StrippedSize      uint32        `json:"strippedsize"`
	Size              uint32        `json:"size"`
	Weight            uint32        `json:"weight"`
	Height            uint32        `json:"height"`
	Version           uint32        `json:"version"`
	VersionHex        string        `json:"versionhex"`
	MerkleRoot        string        `json:"merkleroot"`
	Tx                []interface{} `json:"tx"`
	Time              uint32        `json:"time"`
	MedianTime        uint32        `json:"mediantime"`
	Nonce             uint32        `json:"nonce"`
	Bits              uint32        `json:"bits"`
	Difficulty        string        `json:"difficulty"`
	ChainWork         string        `json:"chainwork"`
	PreviousBlockHash string        `json:"previousblockhash"`
	NextBlockHash     string        `json:"nextblockhash"`
	AuxPow            string        `json:"auxpow"`
	MinerInfo         string        `json:"minerinfo"`
}

func GetBlockInfo

func GetBlockInfo(block *Block, verbose bool) BlockInfo

type BudgetBaseInfo added in v0.5.0

type BudgetBaseInfo struct {
	Type   string `json:"type"`
	Stage  uint8  `json:"stage"`
	Amount string `json:"amount"`
}

type BudgetInfo added in v0.5.0

type BudgetInfo struct {
	Type   string `json:"type"`
	Stage  uint8  `json:"stage"`
	Amount string `json:"amount"`
	Status string `json:"status"`
}

type CRCProposalInfo added in v0.5.0

type CRCProposalInfo struct {
	ProposalType             string           `json:"proposaltype"`
	CategoryData             string           `json:"categorydata"`
	OwnerPublicKey           string           `json:"ownerpublickey"`
	DraftHash                string           `json:"drafthash"`
	Budgets                  []BudgetBaseInfo `json:"budgets"`
	Recipient                string           `json:"recipient"`
	Signature                string           `json:"signature"`
	CRCouncilMemberDID       string           `json:"crcouncilmemberdid"`
	CRCouncilMemberSignature string           `json:"crcouncilmembersignature"`
	Hash                     string           `json:"hash"`
}

type CRCProposalReviewInfo added in v0.5.0

type CRCProposalReviewInfo struct {
	ProposalHash string `json:"proposalhash"`
	VoteResult   string `json:"voteresult"`
	OpinionHash  string `json:"opinionhash"`
	DID          string `json:"did"`
	Sign         string `json:"sign"`
}

type CRCProposalTrackingInfo added in v0.5.0

type CRCProposalTrackingInfo struct {
	ProposalTrackingType        string `json:"proposaltrackingtype"`
	ProposalHash                string `json:"proposalhash"`
	MessageHash                 string `json:"messagehash"`
	Stage                       uint8  `json:"stage"`
	OwnerPublicKey              string `json:"ownerpublickey"`
	NewOwnerPublicKey           string `json:"newownerpublickey"`
	OwnerSignature              string `json:"ownersignature"`
	NewOwnerSignature           string `json:"newownersignature"`
	SecretaryGeneralOpinionHash string `json:"secretarygeneralopinionhash"`
	SecretaryGeneralSignature   string `json:"secretarygeneralsignature"`
}

type CRCProposalWithdrawInfo added in v0.5.0

type CRCProposalWithdrawInfo struct {
	ProposalHash   string `json:"proposalhash"`
	OwnerPublicKey string `json:"ownerpublickey"`
	Signature      string `json:"signature"`
}

type CRInfo added in v0.5.0

type CRInfo struct {
	Code      string `json:"code"`
	CID       string `json:"cid"`
	DID       string `json:"did"`
	NickName  string `json:"nickname"`
	Url       string `json:"url"`
	Location  uint64 `json:"location"`
	Signature string `json:"signature"`
}

type CancelProducerInfo added in v0.2.2

type CancelProducerInfo struct {
	OwnerPublicKey string `json:"ownerpublickey"`
	Signature      string `json:"signature"`
}

type CandidateVotes added in v0.5.0

type CandidateVotes struct {
	Candidate string `json:"candidate"`
	Votes     string `json:"votes"`
}

type CoinbaseInfo

type CoinbaseInfo struct {
	CoinbaseData string `json:"coinbasedata"`
}

type ConfirmInfo added in v0.3.0

type ConfirmInfo struct {
	BlockHash  string     `json:"blockhash"`
	Sponsor    string     `json:"sponsor"`
	ViewOffset uint32     `json:"viewoffset"`
	Votes      []VoteInfo `json:"votes"`
}

func GetConfirmInfo added in v0.3.0

func GetConfirmInfo(confirm *payload.Confirm) ConfirmInfo

type DefaultOutputInfo added in v0.2.2

type DefaultOutputInfo struct{}

type InactiveArbitratorsInfo added in v0.5.0

type InactiveArbitratorsInfo struct {
	Sponsor     string   `json:"sponsor"`
	Arbitrators []string `json:"arbitrators"`
	BlockHeight uint32   `json:"blockheight"`
}

type InputInfo

type InputInfo struct {
	TxID     string `json:"txid"`
	VOut     uint16 `json:"vout"`
	Sequence uint32 `json:"sequence"`
}

type OutputInfo

type OutputInfo struct {
	Value         string            `json:"value"`
	Index         uint32            `json:"n"`
	Address       string            `json:"address"`
	AssetID       string            `json:"assetid"`
	OutputLock    uint32            `json:"outputlock"`
	OutputType    uint32            `json:"type"`
	OutputPayload OutputPayloadInfo `json:"payload"`
}

type OutputPayloadInfo added in v0.2.2

type OutputPayloadInfo interface{}

type Params

type Params map[string]interface{}

func FromArray

func FromArray(array []interface{}, fields ...string) Params

func (Params) ArrayString added in v0.1.1

func (p Params) ArrayString(key string) ([]string, bool)

func (Params) Bool

func (p Params) Bool(key string) (bool, bool)

func (Params) Float

func (p Params) Float(field string) (float64, bool)

func (Params) Int

func (p Params) Int(field string) (int64, bool)

func (Params) String

func (p Params) String(key string) (string, bool)

func (Params) Uint

func (p Params) Uint(field string) (uint32, bool)

type PayloadInfo

type PayloadInfo interface{}

type PeerInfo added in v0.3.0

type PeerInfo struct {
	NetAddress     string `json:"netaddress"`
	Services       string `json:"services"`
	RelayTx        bool   `json:"relaytx"`
	LastSend       string `json:"lastsend"`
	LastRecv       string `json:"lastrecv"`
	ConnTime       string `json:"conntime"`
	TimeOffset     int64  `json:"timeoffset"`
	Version        uint32 `json:"version"`
	Inbound        bool   `json:"inbound"`
	StartingHeight uint32 `json:"startingheight"`
	LastBlock      uint32 `json:"lastblock"`
	LastPingTime   string `json:"lastpingtime"`
	LastPingMicros int64  `json:"lastpingmicros"`
}

type ProducerInfo added in v0.3.0

type ProducerInfo struct {
	OwnerPublicKey string `json:"ownerpublickey"`
	NodePublicKey  string `json:"nodepublickey"`
	NickName       string `json:"nickname"`
	Url            string `json:"url"`
	Location       uint64 `json:"location"`
	NetAddress     string `json:"netaddress"`
	Signature      string `json:"signature"`
}

type ProgramInfo

type ProgramInfo struct {
	Code      string `json:"code"`
	Parameter string `json:"parameter"`
}

type RegisterAssetInfo

type RegisterAssetInfo struct {
	Asset      payload.Asset `json:"asset"`
	Amount     string        `json:"amount"`
	Controller string        `json:"controller"`
}

type RpcCRCProposal added in v0.5.0

type RpcCRCProposal struct {
	ProposalType       string       `json:"proposaltype"`
	OwnerPublicKey     string       `json:"ownerpublickey"`
	CRCouncilMemberDID string       `json:"crcouncilmemberdid"`
	DraftHash          string       `json:"drafthash"`
	Recipient          string       `json:"recipient"`
	Budgets            []BudgetInfo `json:"budgets"`
}

type RpcCRProposalBaseStateInfo added in v0.5.0

type RpcCRProposalBaseStateInfo struct {
	ProposalBaseStates []RpcProposalBaseState `json:"proposalbasestates"`
	TotalCounts        uint64                 `json:"totalcounts"`
}

type RpcCRProposalStateInfo added in v0.5.0

type RpcCRProposalStateInfo struct {
	ProposalState RpcProposalState `json:"proposalstate"`
}

type RpcCrCandidateInfo added in v0.5.0

type RpcCrCandidateInfo struct {
	Code           string `json:"code"`
	CID            string `json:"cid"`
	DID            string `json:"did"`
	NickName       string `json:"nickname"`
	Url            string `json:"url"`
	Location       uint64 `json:"location"`
	State          string `json:"state"`
	Votes          string `json:"votes"`
	RegisterHeight uint32 `json:"registerheight"`
	CancelHeight   uint32 `json:"cancelheight"`

	Index uint64 `json:"index"`
}

single cr candidate info

type RpcCrCandidatesInfo added in v0.5.0

type RpcCrCandidatesInfo struct {
	CRCandidateInfoSlice []RpcCrCandidateInfo `json:"crcandidatesinfo"`
	TotalVotes           string               `json:"totalvotes"`
	TotalCounts          uint64               `json:"totalcounts"`
}

a group cr candidate info include TotalVotes and candidate count

type RpcCrMemberInfo added in v0.5.0

type RpcCrMemberInfo struct {
	Code             string `json:"code"`
	CID              string `json:"cid"`
	DID              string `json:"did"`
	NickName         string `json:"nickname"`
	Url              string `json:"url"`
	Location         uint64 `json:"location"`
	ImpeachmentVotes string `json:"impeachmentvotes"`
	DepositAmount    string `json:"depositamout"`
	DepositAddress   string `json:"depositaddress"`
	Penalty          string `json:"penalty"`
	State            string `json:"state"`
	Index            uint64 `json:"index"`
}

single cr member info

type RpcCrMembersInfo added in v0.5.0

type RpcCrMembersInfo struct {
	CRMemberInfoSlice []RpcCrMemberInfo `json:"crmembersinfo"`
	TotalCounts       uint64            `json:"totalcounts"`
}

a group cr member info include cr member count

type RpcProducerInfo added in v0.5.0

type RpcProducerInfo struct {
	OwnerPublicKey string `json:"ownerpublickey"`
	NodePublicKey  string `json:"nodepublickey"`
	Nickname       string `json:"nickname"`
	Url            string `json:"url"`
	Location       uint64 `json:"location"`
	Active         bool   `json:"active"`
	Votes          string `json:"votes"`
	State          string `json:"state"`
	RegisterHeight uint32 `json:"registerheight"`
	CancelHeight   uint32 `json:"cancelheight"`
	InactiveHeight uint32 `json:"inactiveheight"`
	IllegalHeight  uint32 `json:"illegalheight"`
	Index          uint64 `json:"index"`
}

single producer info

type RpcProducersInfo added in v0.5.0

type RpcProducersInfo struct {
	ProducerInfoSlice []RpcProducerInfo `json:"producers"`
	TotalVotes        string            `json:"totalvotes"`
	TotalCounts       uint64            `json:"totalcounts"`
}

a group producer info include TotalVotes and producer count

type RpcProposalBaseState added in v0.5.0

type RpcProposalBaseState struct {
	Status             string            `json:"status"`
	ProposalHash       string            `json:"proposalhash"`
	TxHash             string            `json:"txhash"`
	CRVotes            map[string]string `json:"crvotes"`
	VotersRejectAmount string            `json:"votersrejectamount"`
	RegisterHeight     uint32            `json:"registerHeight"`
	TerminatedHeight   uint32            `json:"terminatedheight"`
	TrackingCount      uint8             `json:"trackingcount"`
	ProposalOwner      string            `json:"proposalowner"`
	Index              uint64            `json:"index"`
}

type RpcProposalState added in v0.5.0

type RpcProposalState struct {
	Status             string            `json:"status"`
	Proposal           RpcCRCProposal    `json:"proposal"`
	ProposalHash       string            `json:"proposalhash"`
	TxHash             string            `json:"txhash"`
	CRVotes            map[string]string `json:"crvotes"`
	VotersRejectAmount string            `json:"votersrejectamount"`
	RegisterHeight     uint32            `json:"registerheight"`
	TerminatedHeight   uint32            `json:"terminatedheight"`
	TrackingCount      uint8             `json:"trackingcount"`
	ProposalOwner      string            `json:"proposalowner"`
	AvailableAmount    string            `json:"availableamount"`
}

type RpcSecretaryGeneral added in v0.5.0

type RpcSecretaryGeneral struct {
	SecretaryGeneral string `json:"secretarygeneral"`
}

type ServerInfo added in v0.3.0

type ServerInfo struct {
	Compile   string      `json:"compile"`   // The compile version of this server node
	Height    uint32      `json:"height"`    // The ServerNode latest block height
	Version   uint32      `json:"version"`   // The network protocol the ServerNode used
	Services  string      `json:"services"`  // The services the server supports
	Port      uint16      `json:"port"`      // The nodes's port
	RPCPort   uint16      `json:"rpcport"`   // The RPC service port
	RestPort  uint16      `json:"restport"`  // The RESTful service port
	WSPort    uint16      `json:"wsport"`    // The webservcie port
	Neighbors []*PeerInfo `json:"neighbors"` // The connected neighbor peers.
}

type SideChainPowInfo added in v0.1.1

type SideChainPowInfo struct {
	BlockHeight     uint32 `json:"blockheight"`
	SideBlockHash   string `json:"sideblockhash"`
	SideGenesisHash string `json:"sidegenesishash"`
	Signature       string `json:"signature"`
}

type SidechainIllegalDataInfo added in v0.3.0

type SidechainIllegalDataInfo struct {
	IllegalType         uint8    `json:"illegaltype"`
	Height              uint32   `json:"height"`
	IllegalSigner       string   `json:"illegalsigner"`
	Evidence            string   `json:"evidence"`
	CompareEvidence     string   `json:"compareevidence"`
	GenesisBlockAddress string   `json:"genesisblockaddress"`
	Signs               []string `json:"signs"`
}

type TransactionContextInfo added in v0.5.0

type TransactionContextInfo struct {
	*TransactionInfo
	BlockHash     string `json:"blockhash"`
	Confirmations uint32 `json:"confirmations"`
	Time          uint32 `json:"time"`
	BlockTime     uint32 `json:"blocktime"`
}

func GetTransactionContextInfo added in v0.5.0

func GetTransactionContextInfo(header *Header, tx *Transaction) *TransactionContextInfo

type TransactionInfo

type TransactionInfo struct {
	TxID           string             `json:"txid"`
	Hash           string             `json:"hash"`
	Size           uint32             `json:"size"`
	VSize          uint32             `json:"vsize"`
	Version        TransactionVersion `json:"version"`
	TxType         TxType             `json:"type"`
	PayloadVersion byte               `json:"payloadversion"`
	Payload        PayloadInfo        `json:"payload"`
	Attributes     []AttributeInfo    `json:"attributes"`
	Inputs         []InputInfo        `json:"vin"`
	Outputs        []OutputInfo       `json:"vout"`
	LockTime       uint32             `json:"locktime"`
	Programs       []ProgramInfo      `json:"programs"`
}

func GetTransactionInfo

func GetTransactionInfo(tx *Transaction) *TransactionInfo

type TransferCrossChainAssetInfo

type TransferCrossChainAssetInfo struct {
	CrossChainAddresses []string         `json:"crosschainaddresses"`
	OutputIndexes       []uint64         `json:"outputindexes"`
	CrossChainAmounts   []common.Fixed64 `json:"crosschainamounts"`
}

type UTXOInfo added in v0.1.1

type UTXOInfo struct {
	TxType        byte   `json:"txtype"`
	TxID          string `json:"txid"`
	AssetID       string `json:"assetid"`
	VOut          uint16 `json:"vout"`
	Address       string `json:"address"`
	Amount        string `json:"amount"`
	OutputLock    uint32 `json:"outputlock"`
	Confirmations uint32 `json:"confirmations"`
}

type UnregisterCRInfo added in v0.5.0

type UnregisterCRInfo struct {
	CID       string `json:"cid"`
	Signature string `json:"signature"`
}

type UpdateVersionInfo added in v0.5.0

type UpdateVersionInfo struct {
	StartHeight uint32 `json:"startheight"`
	EndHeight   uint32 `json:"endheight"`
}

type VoteContentInfo added in v0.2.2

type VoteContentInfo struct {
	VoteType       outputpayload.VoteType `json:"votetype"`
	CandidatesInfo []CandidateVotes       `json:"candidates"`
}

type VoteInfo added in v0.3.0

type VoteInfo struct {
	Signer string `json:"signer"`
	Accept bool   `json:"accept"`
}

type VoteOutputInfo added in v0.2.2

type VoteOutputInfo struct {
	Version  byte              `json:"version"`
	Contents []VoteContentInfo `json:"contents"`
}

type WithdrawFromSideChainInfo added in v0.1.1

type WithdrawFromSideChainInfo struct {
	BlockHeight                uint32   `json:"blockheight"`
	GenesisBlockAddress        string   `json:"genesisblockaddress"`
	SideChainTransactionHashes []string `json:"sidechaintransactionhashes"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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