rpc

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2019 License: MIT Imports: 22 Imported by: 0

README

JSON-RPC Supported API

| Method | Param | Desc | |---|---|---|---| | getLastBlock | | Retrieve blockchain tip as json| | exportData | | Export blockchain headers as json| | exportData | includeBlockTxs | Export blockchain headers and transactions as json|
| getMempoolTxs | | Return current mempool state| | publishEvent| | Inject an event directly into EventBus system|

Configuration

[rpc]

# rpc port to listen on
port=9000
# enable rpc service
enabled=true
user="default"
pass="default"
cert=""

Example usage

# Export blockchain database as json
 curl --data-binary '{"jsonrpc":"2.0","method":"exportData","params":["includeBlockTxs"], "id":1}' -H 'content-type:application/json;' http://127.0.0.1:9000
{
        "result": "exported to /tmp/dusk-node_9000.json",
        "error": "null",
        "id": 1
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type JSONRequest

type JSONRequest struct {
	Method string   `json:"method"`
	Params []string `json:"params,omitempty"`
	Id     int      `json:"id"`
}

JSONRequest defines a JSON-RPC request.

type JSONResponse

type JSONResponse struct {
	Result *json.RawMessage `json:"result"`
	Error  string           `json:"error"`
	Id     int              `json:"id"`
}

JSONResponse defines a JSON-RPC response to a method call.

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server defines the RPC server of the Dusk node.

func NewRPCServer

func NewRPCServer(eventBus *wire.EventBus, rpcBus *wire.RPCBus) (*Server, error)

NewRPCServer instantiates a new RPCServer.

func (*Server) Start

func (s *Server) Start() error

Start the RPC Server and begin listening on specified port.

func (*Server) Stop

func (s *Server) Stop() error

Stop the RPC server

Jump to

Keyboard shortcuts

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