rpc

package
v0.11.0-rc.2 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2019 License: ISC Imports: 39 Imported by: 3

Documentation

Overview

Package rpc - this is to setup and handle all of the incoming JSON RPC requests from clients requiring bitmarkd services

standard golang RPC services can be used on the client side to access these services

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Callback

func Callback(conn io.ReadWriteCloser, argument interface{})

Callback - callback to process RPC requests

func CertificateFingerprint added in v0.6.5

func CertificateFingerprint(certificate []byte) [32]byte

CertificateFingerprint - compute the fingerprint of a certificate

FreeBSD: openssl x509 -outform DER -in bitmarkd-local-rpc.crt | sha3sum -a 256

func Finalise added in v0.6.5

func Finalise() error

Finalise - stop all background tasks

func Initialise added in v0.6.5

func Initialise(rpcConfiguration *RPCConfiguration, httpsConfiguration *HTTPSConfiguration, version string) error

Initialise - setup peer background processes

func ListenAndServeTLSKeyPair added in v0.9.0

func ListenAndServeTLSKeyPair(addr string, handler http.Handler, cfg *tls.Config) error

ListenAndServeTLSKeyPair - start a HTTPS server using in-memory TLS KeyPair

Types

type AssetGetArguments

type AssetGetArguments struct {
	Fingerprints []string `json:"fingerprints"`
}

AssetGetArguments - arguments for RPC request

type AssetGetReply

type AssetGetReply struct {
	Assets []AssetRecord `json:"assets"`
}

AssetGetReply - results from get RPC request

type AssetRecord added in v0.2.3

type AssetRecord struct {
	Record    string      `json:"record"`
	Confirmed bool        `json:"confirmed"`
	AssetId   interface{} `json:"id,omitempty"`
	Data      interface{} `json:"data"`
}

AssetRecord - structure of asset records in the response

type AssetStatus added in v0.2.0

type AssetStatus struct {
	AssetId   *transactionrecord.AssetIdentifier `json:"id"`
	Duplicate bool                               `json:"duplicate"`
}

AssetStatus - arguments for RPC request

type Assets

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

Assets - type for the RPC

func (*Assets) Get

func (assets *Assets) Get(arguments *AssetGetArguments, reply *AssetGetReply) error

Get - RPC to fetch asset data

type AssetsRegisterReply added in v0.2.0

type AssetsRegisterReply struct {
	Assets []AssetStatus `json:"assets"`
}

AssetsRegisterReply - results from RPC request

type Bitmark

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

Bitmark - type for the RPC

func (*Bitmark) Provenance

func (bitmark *Bitmark) Provenance(arguments *ProvenanceArguments, reply *ProvenanceReply) error

Provenance - list the provenance from s transaction id

func (*Bitmark) Transfer

Transfer - transfer a bitmark

type BitmarkTransferReply

type BitmarkTransferReply struct {
	TxId      merkle.Digest                                   `json:"txId"`
	BitmarkId merkle.Digest                                   `json:"bitmarkId"`
	PayId     pay.PayId                                       `json:"payId"`
	Payments  map[string]transactionrecord.PaymentAlternative `json:"payments"`
}

BitmarkTransferReply - result from transfer RPC

type Bitmarks

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

Bitmarks - type for the RPC

func (*Bitmarks) Create added in v0.2.6

func (bitmarks *Bitmarks) Create(arguments *CreateArguments, reply *CreateReply) error

Create - create assets and issues

func (*Bitmarks) Proof added in v0.2.0

func (bitmarks *Bitmarks) Proof(arguments *ProofArguments, reply *ProofReply) error

Proof - supply proof that client-side hashing to confirm free issue was done

type BitmarksRecord added in v0.1.2

type BitmarksRecord struct {
	Record  string      `json:"record"`
	TxId    interface{} `json:"txId,omitempty"`
	InBlock uint64      `json:"inBlock"`
	AssetId interface{} `json:"assetId,omitempty"`
	Data    interface{} `json:"data"`
}

BitmarksRecord - can be any of the transaction records

type BlockAsset added in v0.7.0

type BlockAsset struct {
	Number uint64 `json:"number"`
}

BlockAsset - special record for owned blocks

type BlockInfo added in v0.11.0

type BlockInfo struct {
	Height uint64 `json:"height"`
	Hash   string `json:"hash"`
}

BlockInfo - the highest block held by the node

type BlockOwner added in v0.7.0

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

BlockOwner - the type of the RPC

func (*BlockOwner) Transfer added in v0.7.0

func (bitmark *BlockOwner) Transfer(transfer *transactionrecord.BlockOwnerTransfer, reply *BlockOwnerTransferReply) error

Transfer - transfer the ownership of a block to new account and/or payment addresses

func (*BlockOwner) TxIdForBlock added in v0.7.0

func (bitmark *BlockOwner) TxIdForBlock(info *TxIdForBlockArguments, reply *TxIdForBlockReply) error

TxIdForBlock - RPC to get transaction id for block ownership record

type BlockOwnerTransferReply added in v0.7.0

type BlockOwnerTransferReply struct {
	TxId     merkle.Digest                                   `json:"txId"`
	PayId    pay.PayId                                       `json:"payId"`
	Payments map[string]transactionrecord.PaymentAlternative `json:"payments"`
}

BlockOwnerTransferReply - results of transferring block ownership

type Counters added in v0.3.5

type Counters struct {
	Pending  int `json:"pending"`
	Verified int `json:"verified"`
}

Counters - transaction counters

type CreateArguments added in v0.2.6

type CreateArguments struct {
	Assets []*transactionrecord.AssetData    `json:"assets"`
	Issues []*transactionrecord.BitmarkIssue `json:"issues"`
}

CreateArguments - arguments for creating a bitmark

type CreateReply added in v0.2.6

type CreateReply struct {
	Assets     []AssetStatus                                   `json:"assets"`
	Issues     []IssueStatus                                   `json:"issues"`
	PayId      pay.PayId                                       `json:"payId"`
	PayNonce   reservoir.PayNonce                              `json:"payNonce"`
	Difficulty string                                          `json:"difficulty,omitempty"`
	Payments   map[string]transactionrecord.PaymentAlternative `json:"payments,omitempty"`
}

CreateReply - results from create RPC

type HTTPSConfiguration added in v0.6.5

type HTTPSConfiguration struct {
	MaximumConnections int                 `gluamapper:"maximum_connections" json:"maximum_connections"`
	Listen             []string            `gluamapper:"listen" json:"listen"`
	Certificate        string              `gluamapper:"certificate" json:"certificate"`
	PrivateKey         string              `gluamapper:"private_key" json:"private_key"`
	Allow              map[string][]string `gluamapper:"allow" json:"allow"`
}

HTTPSConfiguration - configuration file data for HTTPS setup

type InfoArguments

type InfoArguments struct{}

InfoArguments - empty arguments for info request

type InfoReply

type InfoReply struct {
	Chain               string    `json:"chain"`
	Mode                string    `json:"mode"`
	Block               BlockInfo `json:"block"`
	RPCs                uint64    `json:"rpcs"`
	Peers               uint64    `json:"peers"`
	TransactionCounters Counters  `json:"transactionCounters"`
	Difficulty          float64   `json:"difficulty"`
	Hashrate            float64   `json:"hashrate,omitempty"`
	Version             string    `json:"version"`
	Uptime              string    `json:"uptime"`
	PublicKey           string    `json:"publicKey"`
}

InfoReply - results from info request

type InternalConnection added in v0.6.5

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

InternalConnection - type to allow rpc system to interface to http request

func (*InternalConnection) Close added in v0.6.5

func (c *InternalConnection) Close() error

func (*InternalConnection) Read added in v0.6.5

func (c *InternalConnection) Read(p []byte) (n int, err error)

func (*InternalConnection) Write added in v0.6.5

func (c *InternalConnection) Write(d []byte) (n int, err error)

type IssueStatus added in v0.2.5

type IssueStatus struct {
	TxId merkle.Digest `json:"txId"`
}

IssueStatus - results from an issue

type Node

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

Node - type for RPC calls

func (*Node) Info

func (node *Node) Info(arguments *InfoArguments, reply *InfoReply) error

Info - return some information about this node only enough for clients to determine node state for more detaile information use HTTP GET requests

func (*Node) List

func (node *Node) List(arguments *NodeArguments, reply *NodeReply) error

List - list all node offering RPC functionality

type NodeArguments

type NodeArguments struct {
	Start uint64 `json:"start,string"`
	Count int    `json:"count"`
}

NodeArguments - arguments for RPC

type NodeReply

type NodeReply struct {
	Nodes     []announce.RPCEntry `json:"nodes"`
	NextStart uint64              `json:"nextStart,string"`
}

NodeReply - result from RPC

type Owner added in v0.1.2

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

Owner - type for the RPC

func (*Owner) Bitmarks added in v0.1.2

func (owner *Owner) Bitmarks(arguments *OwnerBitmarksArguments, reply *OwnerBitmarksReply) error

Bitmarks - list bitmarks belonging to an account

type OwnerBitmarksArguments added in v0.1.2

type OwnerBitmarksArguments struct {
	Owner *account.Account `json:"owner"`        // base58
	Start uint64           `json:"start,string"` // first record number
	Count int              `json:"count"`        // number of records
}

OwnerBitmarksArguments - arguments for RPC

type OwnerBitmarksReply added in v0.1.2

type OwnerBitmarksReply struct {
	Next uint64                    `json:"next,string"` // start value for the next call
	Data []ownership.Ownership     `json:"data"`        // list of bitmarks either issue or transfer
	Tx   map[string]BitmarksRecord `json:"tx"`          // table of tx records
}

OwnerBitmarksReply - result of owner RPC

type ProofArguments added in v0.2.0

type ProofArguments struct {
	PayId pay.PayId `json:"payId"`
	Nonce string    `json:"nonce"`
}

ProofArguments - arguments for RPC

type ProofReply added in v0.2.0

type ProofReply struct {
	Status reservoir.TrackingStatus `json:"status"`
}

ProofReply - results from a proof RPC

type ProvenanceArguments

type ProvenanceArguments struct {
	TxId  merkle.Digest `json:"txId"`
	Count int           `json:"count"`
}

ProvenanceArguments - arguments for provenance RPC

type ProvenanceRecord

type ProvenanceRecord struct {
	Record  string      `json:"record"`
	IsOwner bool        `json:"isOwner"`
	TxId    interface{} `json:"txId,omitempty"`
	InBlock uint64      `json:"inBlock"`
	AssetId interface{} `json:"assetId,omitempty"`
	Data    interface{} `json:"data"`
}

ProvenanceRecord - can be any of the transaction records

type ProvenanceReply

type ProvenanceReply struct {
	Data []ProvenanceRecord `json:"data"`
}

ProvenanceReply - results from provenance RPC

type RPCConfiguration added in v0.6.5

type RPCConfiguration struct {
	MaximumConnections int      `gluamapper:"maximum_connections" json:"maximum_connections"`
	Bandwidth          float64  `gluamapper:"bandwidth" json:"bandwidth"`
	Listen             []string `gluamapper:"listen" json:"listen"`
	Certificate        string   `gluamapper:"certificate" json:"certificate"`
	PrivateKey         string   `gluamapper:"private_key" json:"private_key"`
	Announce           []string `gluamapper:"announce" json:"announce"`
}

RPCConfiguration - configuration file data for RPC setup

type Share added in v0.10.0

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

Share - type for RPC

func (*Share) Balance added in v0.10.0

func (share *Share) Balance(arguments *ShareBalanceArguments, reply *ShareBalanceReply) error

Balance - list balances for an account

func (*Share) Create added in v0.10.0

func (share *Share) Create(bmfr *transactionrecord.BitmarkShare, reply *ShareCreateReply) error

Create - create fractional bitmark

func (*Share) Grant added in v0.10.0

func (share *Share) Grant(arguments *transactionrecord.ShareGrant, reply *ShareGrantReply) error

Grant - grant a number of shares to another account

func (*Share) Swap added in v0.10.0

func (share *Share) Swap(arguments *transactionrecord.ShareSwap, reply *ShareSwapReply) error

Swap - atomically swap shares between accounts

type ShareBalanceArguments added in v0.10.0

type ShareBalanceArguments struct {
	Owner   *account.Account `json:"owner"` // base58
	ShareId merkle.Digest    `json:"shareId"`
	Count   int              `json:"count"` // number of records
}

ShareBalanceArguments - arguments for RPC

type ShareBalanceReply added in v0.10.0

type ShareBalanceReply struct {
	Balances []reservoir.BalanceInfo `json:"balances"`
}

ShareBalanceReply - balances of shares belonging to an account

type ShareCreateReply added in v0.10.0

type ShareCreateReply struct {
	TxId     merkle.Digest                                   `json:"txId"`
	ShareId  merkle.Digest                                   `json:"shareId"`
	PayId    pay.PayId                                       `json:"payId"`
	Payments map[string]transactionrecord.PaymentAlternative `json:"payments"`
}

ShareCreateReply - results from creating a share

type ShareGrantReply added in v0.10.0

type ShareGrantReply struct {
	Remaining uint64                                          `json:"remaining"`
	TxId      merkle.Digest                                   `json:"txId"`
	PayId     pay.PayId                                       `json:"payId"`
	Payments  map[string]transactionrecord.PaymentAlternative `json:"payments"`
}

ShareGrantReply - result of granting some shares to another account

type ShareSwapReply added in v0.10.0

type ShareSwapReply struct {
	RemainingOne uint64                                          `json:"remainingOne"`
	RemainingTwo uint64                                          `json:"remainingTwo"`
	TxId         merkle.Digest                                   `json:"txId"`
	PayId        pay.PayId                                       `json:"payId"`
	Payments     map[string]transactionrecord.PaymentAlternative `json:"payments"`
}

ShareSwapReply - result of a share swap

type Transaction

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

Transaction - an RPC entry for transaction related functions

func (*Transaction) Status added in v0.3.30

func (t *Transaction) Status(arguments *TransactionArguments, reply *TransactionStatusReply) error

Status - query transaction status

type TransactionArguments added in v0.3.30

type TransactionArguments struct {
	TxId merkle.Digest `json:"txId"`
}

TransactionArguments - arguments for status RPC request

type TransactionStatusReply added in v0.3.33

type TransactionStatusReply struct {
	Status string `json:"status"`
}

TransactionStatusReply - results from status RPC

type TxIdForBlockArguments added in v0.7.0

type TxIdForBlockArguments struct {
	BlockNumber uint64 `json:"blockNumber"`
}

TxIdForBlockArguments - get the id for a given block number

type TxIdForBlockReply added in v0.7.0

type TxIdForBlockReply struct {
	TxId merkle.Digest `json:"txId"`
}

TxIdForBlockReply - results for block id

Jump to

Keyboard shortcuts

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