rpc

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2019 License: MIT Imports: 21 Imported by: 0

README

DUSK JSON-RPC API Reference Document

This document aims to cover the available JSON-RPC endpoints in completion, as well as providing an example of the expected JSON structures when making method calls to any node.

Request/Response structures

JSON Request

An overview of the bare request object:

{
	method: "method",
	params: ["param1", "param2"],
}

A full example of making a request, using cURL:

 curl --data-binary '{"jsonrpc":"2.0","method":"method","params":["param1", "param2"]}' -H 'content-type:application/json;' http://127.0.0.1:9000
JSON Response

An overview of the bare response object:

{
	result: "result",
	error: "error",
}

Available methods

Basic functionality (light nodes and full nodes)
Method Params Description Pre-requisites
transfer <amount>, <address> Sends a standard transactions of <amount> DUSK to <address>. Returns a TXID on success. wallet loaded
address Returns the address of the loaded wallet. wallet loaded
createwallet <password> Creates a wallet file, encrypted with <password> no wallet loaded
loadwallet <password> Loads a wallet file at the default directory. no wallet loaded
createfromseed <seed>, <password> Creates a wallet file using a given <seed>, encrypted with <password> no wallet loaded
balance Returns the unlocked and locked balance of the loaded wallet. wallet loaded
unconfirmedbalance Returns the amount of DUSK that is in the mempool for the loaded wallet. wallet loaded
txhistory Returns the transaction history for the loaded wallet. wallet loaded
Extended functionality (full nodes only)
Method Params Description Pre-requisites
bid <amount>, <locktime> Sends a bid transaction of <amount> DUSK to self. The transaction will be locked for <locktime> blocks after being accepted into a block. Returns a TXID on success. wallet loaded
stake <amount> <locktime> Sends a stake transaction of <amount> DUSK to self. The transaction will be locked for <locktime> blocks after being accepted into a block. Returns a TXID on success. wallet loaded

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"`
}

JSONRequest defines a JSON-RPC request.

type JSONResponse

type JSONResponse struct {
	Result string `json:"result"`
	Error  string `json:"error"`
}

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 *eventbus.EventBus, rpcBus *rpcbus.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