rpc

package
v1.7.3 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2021 License: LGPL-3.0 Imports: 19 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package rpc privides functions to for rpc server call

Index

Constants

View Source
const (
	RANDBYTELEN = 4
)

Variables

This section is empty.

Functions

func Call

func Call(address string, method string, id interface{}, params []interface{}) ([]byte, error)

Call sends RPC request to server

func GetBestBlockHash

func GetBestBlockHash(params []interface{}) map[string]interface{}

get best block hash

func GetBlock

func GetBlock(params []interface{}) map[string]interface{}

get block by height or hash Input JSON string examples for getblock method as following:

{"jsonrpc": "2.0", "method": "getblock", "params": [1], "id": 0}
{"jsonrpc": "2.0", "method": "getblock", "params": ["aabbcc.."], "id": 0}

func GetBlockCount

func GetBlockCount(params []interface{}) map[string]interface{}

get block height

func GetBlockHash

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

get block hash A JSON example for getblockhash method as following:

{"jsonrpc": "2.0", "method": "getblockhash", "params": [1], "id": 0}

func GetBlockHeightByTxHash

func GetBlockHeightByTxHash(params []interface{}) map[string]interface{}

get block height by transaction hash

func GetBlockTxsByHeight

func GetBlockTxsByHeight(params []interface{}) map[string]interface{}

get block transactions by height

func GetConnectionCount

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

get node connection count

func GetCrossStateRoot added in v1.7.3

func GetCrossStateRoot(params []interface{}) map[string]interface{}

get cross state root

func GetCrossStatesProof added in v1.2.0

func GetCrossStatesProof(params []interface{}) map[string]interface{}

get cross chain state proof

func GetHeaderByHeight added in v1.2.0

func GetHeaderByHeight(params []interface{}) map[string]interface{}

func GetLatestBlockMsgsSnap added in v1.3.1

func GetLatestBlockMsgsSnap(params []interface{}) map[string]interface{}

get latest block msg snapshot

func GetMemPoolTxCount

func GetMemPoolTxCount(params []interface{}) map[string]interface{}

get memory pool transaction count

func GetMemPoolTxState

func GetMemPoolTxState(params []interface{}) map[string]interface{}

get memory pool transaction state

func GetMerkleProof

func GetMerkleProof(params []interface{}) map[string]interface{}

get merkle proof by the block height to be verified

func GetNeighbor

func GetNeighbor(params []interface{}) map[string]interface{}

func GetNetworkId added in v1.0.1

func GetNetworkId(params []interface{}) map[string]interface{}

get networkid

func GetNodeState

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

func GetNodeVersion

func GetNodeVersion(params []interface{}) map[string]interface{}

get node version

func GetRawMemPool

func GetRawMemPool(params []interface{}) map[string]interface{}

func GetRawTransaction

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

get raw transaction in raw or json A JSON example for getrawtransaction method as following:

{"jsonrpc": "2.0", "method": "getrawtransaction", "params": ["transactioin hash in hex"], "id": 0}

func GetSmartCodeEvent

func GetSmartCodeEvent(params []interface{}) map[string]interface{}

get smartconstract event

func GetStateMerkleRoot added in v1.2.0

func GetStateMerkleRoot(params []interface{}) map[string]interface{}

get state merkle root by block height

func GetStorage

func GetStorage(params []interface{}) map[string]interface{}

get storage from contract

{"jsonrpc": "2.0", "method": "getstorage", "params": ["code hash", "key"], "id": 0}

func Handle

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

this is the function that should be called in order to answer an rpc call should be registered like "http.HandleFunc("/", httpjsonrpc.Handle)"

func HandleFunc

func HandleFunc(pattern string, handler func([]interface{}) map[string]interface{})

a function to register functions to be called for specific rpc calls

func SendRawTransaction

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

send raw transaction A JSON example for sendrawtransaction method as following:

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

func SetDebugInfo

func SetDebugInfo(params []interface{}) map[string]interface{}

func SetDefaultFunc

func SetDefaultFunc(def func(http.ResponseWriter, *http.Request))

a function to be called if the request is not a HTTP JSON RPC call

func StartConsensus

func StartConsensus(params []interface{}) map[string]interface{}

func StopConsensus

func StopConsensus(params []interface{}) map[string]interface{}

Types

type ServeMux

type ServeMux struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

multiplexer that keeps track of every function to be called on specific rpc call

Jump to

Keyboard shortcuts

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