explored

package
v2.0.0-...-66f2e1e Latest Latest
Warning

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

Go to latest
Published: May 3, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewServer

func NewServer(cm ChainManager, s Syncer, tp TransactionPool) http.Handler

NewServer returns an HTTP handler that serves the explored API.

Types

type ChainManager

type ChainManager interface {
	TipState() consensus.State
}

A ChainManager manages blockchain state.

type Client

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

A Client provides methods for interacting with a explored API server.

func NewClient

func NewClient(addr, password string) *Client

NewClient returns a client that communicates with a explored server listening on the specified address.

func (*Client) ConsensusTip

func (c *Client) ConsensusTip() (resp ConsensusTipResponse, err error)

ConsensusTip reports information about the current consensus state.

func (*Client) SyncerConnect

func (c *Client) SyncerConnect(addr string) (err error)

SyncerConnect adds the address as a peer of the syncer.

func (*Client) SyncerPeers

func (c *Client) SyncerPeers() (resp []SyncerPeerResponse, err error)

SyncerPeers returns the current peers of the syncer.

func (*Client) TxpoolBroadcast

func (c *Client) TxpoolBroadcast(txn types.Transaction, dependsOn []types.Transaction) (err error)

TxpoolBroadcast broadcasts a transaction to the network.

func (*Client) TxpoolTransactions

func (c *Client) TxpoolTransactions() (resp []types.Transaction, err error)

TxpoolTransactions returns all transactions in the transaction pool.

type ConsensusTipResponse

type ConsensusTipResponse struct {
	Index types.ChainIndex

	TotalWork  types.Work
	Difficulty types.Work
	OakWork    types.Work
	OakTime    time.Duration

	SiafundPool       types.Currency
	FoundationAddress types.Address
}

ConsensusTipResponse contains information about the current consensus state.

type Syncer

type Syncer interface {
	Addr() string
	Peers() []string
	Connect(addr string) error
	BroadcastTransaction(txn types.Transaction, dependsOn []types.Transaction)
}

A Syncer can connect to other peers and synchronize the blockchain.

type SyncerConnectRequest

type SyncerConnectRequest struct {
	NetAddress string `json:"netAddress"`
}

A SyncerConnectRequest requests that the syncer connect to a peer.

type SyncerPeerResponse

type SyncerPeerResponse struct {
	NetAddress string `json:"netAddress"`
}

A SyncerPeerResponse is a unique peer that is being used by the syncer.

type TransactionPool

type TransactionPool interface {
	Transactions() []types.Transaction
	AddTransaction(txn types.Transaction) error
}

A TransactionPool can validate and relay unconfirmed transactions.

type TxpoolBroadcastRequest

type TxpoolBroadcastRequest struct {
	DependsOn   []types.Transaction `json:"dependsOn"`
	Transaction types.Transaction   `json:"transaction"`
}

TxpoolBroadcastRequest is the request for the /txpool/broadcast endpoint. It contains the transaction to broadcast and the transactions that it depends on.

Jump to

Keyboard shortcuts

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