servers

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2018 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AUXBLOCK_GENERATED_INTERVAL_SECONDS = 60
)
View Source
const TlsPort = 443

Variables

View Source
var LocalPow *pow.PowService
View Source
var NodeForServers Noder
View Source
var PreChainHeight uint64
View Source
var PreTime int64
View Source
var PreTransactionCount int

Functions

func AuxHelp

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

func CreateAuxBlock

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

func GenerateAuxBlock

func GenerateAuxBlock(addr string) (*ledger.Block, string, bool)

func GetAssetByHash

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

Asset

func GetBalanceByAddr

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

func GetBalanceByAsset

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

func GetBlockByHash

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

func GetBlockByHeight

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

func GetBlockHash

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

func GetBlockHeight

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

func GetBlockTransactions

func GetBlockTransactions(block *ledger.Block) interface{}

func GetConnectionCount

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

func GetCurrentHeight

func GetCurrentHeight(param map[string]interface{}) map[string]interface{}

Block

func GetInfo

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

func GetNeighbors

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

func GetNodeState

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

func GetRawTransaction

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

Input JSON string examples for getblock method as following:

func GetTransactionByHash

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

Transaction

func GetTransactionPool

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

func GetTransactionsByHeight

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

func GetUnspendOutput

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

func GetUnspends

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

func ManualMining

func ManualMining(param map[string]interface{}) map[string]interface{}

func ResponsePack

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

func SendRawTransaction

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

func SetLogLevel

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

func SubmitAuxBlock

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

func SubmitBlock

func SubmitBlock(param map[string]interface{}) map[string]interface{}

A JSON example for submitblock method as following:

{"jsonrpc": "2.0", "method": "submitblock", "params": ["raw block in hex"], "id": 0}

func ToggleMining

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

func VerifyAndSendTx

func VerifyAndSendTx(txn *tx.Transaction) ErrCode

Types

type AmountMap

type AmountMap struct {
	Key   Uint256
	Value Fixed64
}

type AuxInfo

type AuxInfo struct {
	Version    int32
	PrevBlock  string
	MerkleRoot string
	Timestamp  uint32
	Bits       uint32
	Nonce      uint32
}

type BalanceTxInputInfo

type BalanceTxInputInfo struct {
	AssetID     string
	Value       Fixed64
	ProgramHash string
}

type BlockHead

type BlockHead struct {
	Version          uint32
	PrevBlockHash    string
	TransactionsRoot string
	Timestamp        uint32
	Bits             uint32
	Height           uint32
	Nonce            uint32
	AuxPow           *AuxInfo
	Difficulty       string
	BlockSize        int
	Hash             string
}

type BlockInfo

type BlockInfo struct {
	Hash            string
	BlockData       *BlockHead
	Transactions    []*Transactions
	Confirminations uint32
	MinerInfo       string
}

func GetBlockInfo

func GetBlockInfo(block *ledger.Block) BlockInfo

type CoinbaseInfo

type CoinbaseInfo struct {
	CoinbaseData string
}

type NodeInfo

type NodeInfo struct {
	State    uint   // NodeForServers status
	Port     uint16 // The nodes's port
	ID       uint64 // The nodes's id
	Time     int64
	Version  string // node's version
	Services uint64 // The services the NodeForServers supplied
	Relay    bool   // The relay capability of the NodeForServers (merge into capbility flag)
	Height   uint64 // The NodeForServers latest block height
	TxnCnt   uint64 // The transactions be transmit by this NodeForServers
	RxTxnCnt uint64 // The transaction received by this NodeForServers
	Mining   bool   // Is this node mining or not
}

type PayloadInfo

type PayloadInfo interface{}

func TransPayloadToHex

func TransPayloadToHex(p Payload) PayloadInfo

type ProgramInfo

type ProgramInfo struct {
	Code      string
	Parameter string
}

type RegisterAssetInfo

type RegisterAssetInfo struct {
	Asset      *asset.Asset
	Amount     string
	Controller string
}

type Transactions

type Transactions struct {
	TxType         TransactionType
	PayloadVersion byte
	Payload        PayloadInfo
	Attributes     []TxAttributeInfo
	UTXOInputs     []UTXOTxInputInfo
	BalanceInputs  []BalanceTxInputInfo
	Outputs        []TxoutputInfo
	LockTime       uint32
	Programs       []ProgramInfo

	AssetOutputs      []TxoutputMap
	AssetInputAmount  []AmountMap
	AssetOutputAmount []AmountMap
	Timestamp         uint32 `json:",omitempty"`
	Confirminations   uint32 `json:",omitempty"`
	TxSize            uint32 `json:",omitempty"`
	Hash              string
}

func TransArrayByteToHexString

func TransArrayByteToHexString(ptx *tx.Transaction) *Transactions

type TxAttributeInfo

type TxAttributeInfo struct {
	Usage TransactionAttributeUsage
	Data  string
}

type TxoutputInfo

type TxoutputInfo struct {
	AssetID    string
	Value      string
	Address    string
	OutputLock uint32
}

type TxoutputMap

type TxoutputMap struct {
	Key   Uint256
	Txout []TxoutputInfo
}

type UTXOTxInputInfo

type UTXOTxInputInfo struct {
	ReferTxID          string
	ReferTxOutputIndex uint16
	Sequence           uint32
	Address            string
	Value              string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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