Documentation

Index

Constants

View Source
const (
	INVALID_REQUEST  = -32600
	METHOD_NOT_FOUND = -32601
	INVALID_PARAMS   = -32602
	INTERNAL_ERROR   = -32603
	PARSE_ERROR      = -32700
)

    JSON-RPC 2.0 error codes.

    View Source
    const AnyLocal = "0.0.0.0"
    View Source
    const LocalHost = "127.0.0.1"

      'LocalHost' gets interpreted as ipv6 TODO: revisit this

      View Source
      const MaxBlockLookback = 1000

        Magic! Should probably be configurable, but not shouldn't be so huge we end up DoSing ourselves.

        Variables

        View Source
        var (
        	ErrInvalidLengthRpc        = fmt.Errorf("proto: negative length found during unmarshaling")
        	ErrIntOverflowRpc          = fmt.Errorf("proto: integer overflow")
        	ErrUnexpectedEndOfGroupRpc = fmt.Errorf("proto: unexpected end of group")
        )
        View Source
        var Abi_HelloWorld = []byte(`[{"constant":true,"inputs":[],"name":"Hello","outputs":[{"internalType":"string","name":"","type":"string"}],"payable":false,"stateMutability":"pure","type":"function"}]`)
        View Source
        var Bytecode_HelloWorld = hex.MustDecodeString("608060405234801561001057600080fd5b5061011d806100206000396000f3fe6080604052348015600f57600080fd5b506004361060285760003560e01c8063bcdfe0d514602d575b600080fd5b603360ab565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101560715780820151818401526020810190506058565b50505050905090810190601f168015609d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b60606040518060400160405280600c81526020017f48656c6c6f2c20576f726c64000000000000000000000000000000000000000081525090509056fea265627a7a723158200b2a5b7a53ba54371daa99f4d02346044f39e951d89df28ce64b4d36dd3fda0664736f6c634300050b0032")
        View Source
        var DeployedBytecode_HelloWorld = hex.MustDecodeString("6080604052348015600f57600080fd5b506004361060285760003560e01c8063bcdfe0d514602d575b600080fd5b603360ab565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101560715780820151818401526020810190506058565b50505050905090810190601f168015609d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b60606040518060400160405280600c81526020017f48656c6c6f2c20576f726c64000000000000000000000000000000000000000081525090509056fea265627a7a723158200b2a5b7a53ba54371daa99f4d02346044f39e951d89df28ce64b4d36dd3fda0664736f6c634300050b0032")

        Functions

        func NewGRPCServer

        func NewGRPCServer(logger *logging.Logger) *grpc.Server

        Types

        type AccountHumanReadable

        type AccountHumanReadable struct {
        	Address     crypto.Address
        	PublicKey   *crypto.PublicKey
        	Sequence    uint64
        	Balance     uint64
        	Code        []string
        	Permissions []string
        	Roles       []string
        }

        type Block

        type Block struct {
        	*tmTypes.Block
        }

          TODO: this wrapper was needed for go-amino handling of interface types, it _might_ not be needed any longer

          func (Block) MarshalJSON

          func (b Block) MarshalJSON() ([]byte, error)

          func (*Block) UnmarshalJSON

          func (b *Block) UnmarshalJSON(data []byte) (err error)

          type BlockMeta

          type BlockMeta struct {
          	*tmTypes.BlockMeta
          }

          func (BlockMeta) MarshalJSON

          func (bm BlockMeta) MarshalJSON() ([]byte, error)

          func (*BlockMeta) UnmarshalJSON

          func (bm *BlockMeta) UnmarshalJSON(data []byte) (err error)

          type Client

          type Client interface {
          	Call(method string, params interface{}, result interface{}) error
          }

          type Codec

          type Codec interface {
          	EncodeBytes(interface{}) ([]byte, error)
          	Encode(interface{}, io.Writer) error
          	DecodeBytes(interface{}, []byte) error
          	Decode(interface{}, io.Reader) error
          }

            Used for rpc request and response data.

            type MetricsConfig

            type MetricsConfig struct {
            	ServerConfig
            	MetricsPath     string
            	BlockSampleSize int
            }

            func DefaultMetricsConfig

            func DefaultMetricsConfig() *MetricsConfig

            type RPCConfig

            type RPCConfig struct {
            	Info     *ServerConfig  `json:",omitempty" toml:",omitempty"`
            	Profiler *ServerConfig  `json:",omitempty" toml:",omitempty"`
            	GRPC     *ServerConfig  `json:",omitempty" toml:",omitempty"`
            	Metrics  *MetricsConfig `json:",omitempty" toml:",omitempty"`
            	Web3     *ServerConfig  `json:",omitempty" toml:",omitempty"`
            }

            func DefaultRPCConfig

            func DefaultRPCConfig() *RPCConfig

            type RPCError

            type RPCError struct {
            	Code    int    `json:"code"`
            	Message string `json:"message"`
            }

              RPCError MUST be included in the Response object if an error occured

              func (RPCError) Error

              func (err RPCError) Error() string

              type RPCErrorResponse

              type RPCErrorResponse struct {
              	Error   *RPCError `json:"error"`
              	Id      string    `json:"id"`
              	JSONRPC string    `json:"jsonrpc"`
              }

                RPCErrorResponse MUST NOT contain the result member if an error occured

                func (*RPCErrorResponse) AssertIsRPCResponse

                func (rpcErrorResponse *RPCErrorResponse) AssertIsRPCResponse() bool

                  AssertIsRPCResponse implements a marker method for RPCErrorResponse to implement the interface RPCResponse

                  type RPCRequest

                  type RPCRequest struct {
                  	JSONRPC string          `json:"jsonrpc"`
                  	Method  string          `json:"method"`
                  	Params  json.RawMessage `json:"params"`
                  	Id      string          `json:"id"`
                  }

                    Request and Response objects. Id is a string. Error data not used. Refer to JSON-RPC specification http://www.jsonrpc.org/specification

                    func NewRPCRequest

                    func NewRPCRequest(id string, method string, params json.RawMessage) *RPCRequest

                      Create a new RPC request. This is the generic struct that is passed to RPC methods

                      type RPCResponse

                      type RPCResponse interface {
                      	AssertIsRPCResponse() bool
                      }

                        RPCResponse MUST follow the JSON-RPC specification for Response object reference: http://www.jsonrpc.org/specification#response_object

                        func NewRPCErrorResponse

                        func NewRPCErrorResponse(id string, code int, message string) RPCResponse

                          NewRPCErrorResponse creates a new error-response object from the error code and message

                          func NewRPCResponse

                          func NewRPCResponse(id string, res interface{}) RPCResponse

                            NewRPCResponse creates a new response object from a result

                            type RPCResultResponse

                            type RPCResultResponse struct {
                            	Result  interface{} `json:"result"`
                            	Id      string      `json:"id"`
                            	JSONRPC string      `json:"jsonrpc"`
                            }

                              RPCResultResponse MUST NOT contain the error member if no error occurred

                              func (*RPCResultResponse) AssertIsRPCResponse

                              func (rpcResultResponse *RPCResultResponse) AssertIsRPCResponse() bool

                                AssertIsRPCResponse implements a marker method for RPCResultResponse to implement the interface RPCResponse

                                type ResultAccount

                                type ResultAccount struct {
                                	Account *acm.Account
                                }

                                type ResultAccountHumanReadable

                                type ResultAccountHumanReadable struct {
                                	Account *AccountHumanReadable
                                }

                                type ResultAccountStats

                                type ResultAccountStats struct {
                                	AccountsWithCode    uint64
                                	AccountsWithoutCode uint64
                                }

                                type ResultAccounts

                                type ResultAccounts struct {
                                	BlockHeight uint64
                                	Accounts    []*acm.Account
                                }

                                type ResultBlock

                                type ResultBlock struct {
                                	BlockMeta *BlockMeta
                                	Block     *Block
                                }

                                type ResultBlocks

                                type ResultBlocks struct {
                                	LastHeight uint64
                                	BlockMetas []*tmTypes.BlockMeta
                                }

                                type ResultChainId

                                type ResultChainId struct {
                                	ChainName   string
                                	ChainId     string
                                	GenesisHash binary.HexBytes
                                }

                                type ResultConsensusState

                                type ResultConsensusState struct {
                                	*core_types.ResultDumpConsensusState
                                }

                                type ResultDumpStorage

                                type ResultDumpStorage struct {
                                	StorageItems []StorageItem
                                }

                                type ResultGeneratePrivateAccount

                                type ResultGeneratePrivateAccount struct {
                                	PrivateAccount *acm.ConcretePrivateAccount
                                }

                                type ResultGenesis

                                type ResultGenesis struct {
                                	Genesis genesis.GenesisDoc
                                }

                                type ResultName

                                type ResultName struct {
                                	Entry *names.Entry
                                }

                                type ResultNames

                                type ResultNames struct {
                                	BlockHeight uint64
                                	Names       []*names.Entry
                                }

                                type ResultNetwork

                                type ResultNetwork struct {
                                	ThisNode *tendermint.NodeInfo
                                	*core_types.ResultNetInfo
                                }

                                type ResultNetworkRegistry

                                type ResultNetworkRegistry struct {
                                	Address crypto.Address
                                	registry.NodeIdentity
                                }

                                type ResultPeers

                                type ResultPeers struct {
                                	Peers []core_types.Peer
                                }

                                type ResultSignTx

                                type ResultSignTx struct {
                                	Tx *txs.Envelope
                                }

                                type ResultStatus

                                type ResultStatus struct {
                                	ChainID       string                                        `protobuf:"bytes,1,opt,name=ChainID,proto3" json:"ChainID,omitempty"`
                                	RunID         string                                        `protobuf:"bytes,2,opt,name=RunID,proto3" json:"RunID,omitempty"`
                                	BurrowVersion string                                        `protobuf:"bytes,3,opt,name=BurrowVersion,proto3" json:"BurrowVersion,omitempty"`
                                	GenesisHash   github_com_hyperledger_burrow_binary.HexBytes `protobuf:"bytes,4,opt,name=GenesisHash,proto3,customtype=github.com/hyperledger/burrow/binary.HexBytes" json:"GenesisHash"`
                                	NodeInfo      *tendermint.NodeInfo                          `protobuf:"bytes,5,opt,name=NodeInfo,proto3" json:"NodeInfo,omitempty"`
                                	SyncInfo      *bcm.SyncInfo                                 `protobuf:"bytes,6,opt,name=SyncInfo,proto3" json:"SyncInfo,omitempty"`
                                	// When catching up in fast sync
                                	CatchingUp           bool                 `protobuf:"varint,8,opt,name=CatchingUp,proto3" json:""`
                                	ValidatorInfo        *validator.Validator `protobuf:"bytes,7,opt,name=ValidatorInfo,proto3" json:"ValidatorInfo,omitempty"`
                                	XXX_NoUnkeyedLiteral struct{}             `json:"-"`
                                	XXX_unrecognized     []byte               `json:"-"`
                                	XXX_sizecache        int32                `json:"-"`
                                }

                                func Status

                                func Status(blockchain bcm.BlockchainInfo, validators validator.History, nodeView *tendermint.NodeView, blockTimeWithin,
                                	blockSeenTimeWithin string) (*ResultStatus, error)

                                func (*ResultStatus) Descriptor

                                func (*ResultStatus) Descriptor() ([]byte, []int)

                                func (*ResultStatus) GetBurrowVersion

                                func (m *ResultStatus) GetBurrowVersion() string

                                func (*ResultStatus) GetCatchingUp

                                func (m *ResultStatus) GetCatchingUp() bool

                                func (*ResultStatus) GetChainID

                                func (m *ResultStatus) GetChainID() string

                                func (*ResultStatus) GetNodeInfo

                                func (m *ResultStatus) GetNodeInfo() *tendermint.NodeInfo

                                func (*ResultStatus) GetRunID

                                func (m *ResultStatus) GetRunID() string

                                func (*ResultStatus) GetSyncInfo

                                func (m *ResultStatus) GetSyncInfo() *bcm.SyncInfo

                                func (*ResultStatus) GetValidatorInfo

                                func (m *ResultStatus) GetValidatorInfo() *validator.Validator

                                func (*ResultStatus) Marshal

                                func (m *ResultStatus) Marshal() (dAtA []byte, err error)

                                func (*ResultStatus) MarshalTo

                                func (m *ResultStatus) MarshalTo(dAtA []byte) (int, error)

                                func (*ResultStatus) MarshalToSizedBuffer

                                func (m *ResultStatus) MarshalToSizedBuffer(dAtA []byte) (int, error)

                                func (*ResultStatus) ProtoMessage

                                func (*ResultStatus) ProtoMessage()

                                func (*ResultStatus) Reset

                                func (m *ResultStatus) Reset()

                                func (*ResultStatus) Size

                                func (m *ResultStatus) Size() (n int)

                                func (*ResultStatus) String

                                func (m *ResultStatus) String() string

                                func (*ResultStatus) Unmarshal

                                func (m *ResultStatus) Unmarshal(dAtA []byte) error

                                func (*ResultStatus) XXX_DiscardUnknown

                                func (m *ResultStatus) XXX_DiscardUnknown()

                                func (*ResultStatus) XXX_Marshal

                                func (m *ResultStatus) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

                                func (*ResultStatus) XXX_Merge

                                func (m *ResultStatus) XXX_Merge(src proto.Message)

                                func (*ResultStatus) XXX_MessageName

                                func (*ResultStatus) XXX_MessageName() string

                                func (*ResultStatus) XXX_Size

                                func (m *ResultStatus) XXX_Size() int

                                func (*ResultStatus) XXX_Unmarshal

                                func (m *ResultStatus) XXX_Unmarshal(b []byte) error

                                type ResultStorage

                                type ResultStorage struct {
                                	Key   binary.HexBytes
                                	Value binary.HexBytes
                                }

                                type ResultSubscribe

                                type ResultSubscribe struct {
                                	EventID        string
                                	SubscriptionID string
                                }

                                type ResultUnconfirmedTxs

                                type ResultUnconfirmedTxs struct {
                                	NumTxs int
                                	Txs    []*txs.Envelope
                                }

                                type ResultUnsubscribe

                                type ResultUnsubscribe struct {
                                	SubscriptionID string
                                }

                                type ResultValidators

                                type ResultValidators struct {
                                	BlockHeight         uint64
                                	BondedValidators    []*validator.Validator
                                	UnbondingValidators []*validator.Validator
                                }

                                type RoundState

                                type RoundState struct {
                                	*ctypes.RoundState
                                }

                                  TODO use round state in ResultConsensusState - currently there are some part of RoundState have no Unmarshal

                                  func (RoundState) MarshalJSON

                                  func (rs RoundState) MarshalJSON() ([]byte, error)

                                  func (*RoundState) UnmarshalJSON

                                  func (rs *RoundState) UnmarshalJSON(data []byte) (err error)

                                  type ServerConfig

                                  type ServerConfig struct {
                                  	Enabled    bool
                                  	ListenHost string
                                  	ListenPort string
                                  }

                                  func DefaultGRPCConfig

                                  func DefaultGRPCConfig() *ServerConfig

                                  func DefaultInfoConfig

                                  func DefaultInfoConfig() *ServerConfig

                                  func DefaultProfilerConfig

                                  func DefaultProfilerConfig() *ServerConfig

                                  func DefaultWeb3Config

                                  func DefaultWeb3Config() *ServerConfig

                                  func (*ServerConfig) ListenAddress

                                  func (sc *ServerConfig) ListenAddress() string

                                  type Service

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

                                    Base service that provides implementation for all underlying RPC methods

                                    func NewService

                                    func NewService(state acmstate.IterableStatsReader, nameReg names.IterableReader, nodeReg registry.IterableReader, blockchain bcm.BlockchainInfo,
                                    	validators validator.History, nodeView *tendermint.NodeView, logger *logging.Logger) *Service

                                      Service provides an internal query and information service with serialisable return types on which can accomodate a number of transport front ends

                                      func (*Service) Account

                                      func (s *Service) Account(address crypto.Address) (*ResultAccount, error)

                                        Accounts

                                        func (*Service) AccountHumanReadable

                                        func (s *Service) AccountHumanReadable(address crypto.Address) (*ResultAccountHumanReadable, error)

                                        func (*Service) AccountStats

                                        func (s *Service) AccountStats() (*ResultAccountStats, error)

                                        func (*Service) Accounts

                                        func (s *Service) Accounts(predicate func(*acm.Account) bool) (*ResultAccounts, error)

                                        func (*Service) Block

                                        func (s *Service) Block(height uint64) (*ResultBlock, error)

                                        func (*Service) BlockchainInfo

                                        func (s *Service) BlockchainInfo() bcm.BlockchainInfo

                                        func (*Service) Blocks

                                        func (s *Service) Blocks(minHeight, maxHeight int64) (*ResultBlocks, error)

                                          Returns the current blockchain height and metadata for a range of blocks between minHeight and maxHeight. Only returns maxBlockLookback block metadata from the top of the range of blocks. Passing 0 for maxHeight sets the upper height of the range to the current blockchain height.

                                          func (*Service) ChainID

                                          func (s *Service) ChainID() string

                                          func (*Service) ChainIdentifiers

                                          func (s *Service) ChainIdentifiers() (*ResultChainId, error)

                                          func (*Service) ConsensusState

                                          func (s *Service) ConsensusState() (*ResultConsensusState, error)

                                          func (*Service) DumpStorage

                                          func (s *Service) DumpStorage(address crypto.Address) (*ResultDumpStorage, error)

                                          func (*Service) GeneratePrivateAccount

                                          func (s *Service) GeneratePrivateAccount() (*ResultGeneratePrivateAccount, error)

                                          func (*Service) Genesis

                                          func (s *Service) Genesis() (*ResultGenesis, error)

                                          func (*Service) Name

                                          func (s *Service) Name(name string) (*ResultName, error)

                                            Name registry

                                            func (*Service) Names

                                            func (s *Service) Names(predicate func(*names.Entry) bool) (*ResultNames, error)

                                            func (*Service) Network

                                            func (s *Service) Network() (*ResultNetwork, error)

                                            func (*Service) NetworkRegistry

                                            func (s *Service) NetworkRegistry() ([]*ResultNetworkRegistry, error)

                                            func (*Service) Peers

                                            func (s *Service) Peers() []core_types.Peer

                                            func (*Service) Stats

                                            func (s *Service) Stats() acmstate.AccountStatsGetter

                                            func (*Service) Status

                                            func (s *Service) Status() (*ResultStatus, error)

                                            func (*Service) StatusWithin

                                            func (s *Service) StatusWithin(blockTimeWithin, blockSeenTimeWithin string) (*ResultStatus, error)

                                            func (*Service) Storage

                                            func (s *Service) Storage(address crypto.Address, key []byte) (*ResultStorage, error)

                                            func (*Service) UnconfirmedTxs

                                            func (s *Service) UnconfirmedTxs(maxTxs int64) (*ResultUnconfirmedTxs, error)

                                            func (*Service) Validators

                                            func (s *Service) Validators() (*ResultValidators, error)

                                            type StorageItem

                                            type StorageItem struct {
                                            	Key   binary.HexBytes
                                            	Value binary.HexBytes
                                            }

                                            Directories

                                            Path Synopsis
                                            lib
                                            server
                                            Commons for HTTP handling
                                            Commons for HTTP handling
                                            Code generated by go-openrpc.
                                            Code generated by go-openrpc.