method

package
v0.0.0-...-44e067b Latest Latest
Warning

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

Go to latest
Published: May 21, 2017 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package method contains an implemenetation of the RPC methods made available by the Bitcoin server

Package method contains an implemenetation of the RPC methods made available by the Bitcoin server

Package method contains an implemenetation of the RPC methods made available by the Bitcoin server

Package method contains an implemenetation of the RPC methods made available by the Bitcoin server

Package method contains an implemenetation of the RPC methods made available by the Bitcoin server

Package method contains an implemenetation of the RPC methods made available by the Bitcoin server

Package method contains an implemenetation of the RPC methods made available by the Bitcoin server

Package method contains an implemenetation of the RPC methods made available by the Bitcoin server

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddNode

func AddNode(client *rpc.RPCClient, node string) error

func RemoveNode

func RemoveNode(client *rpc.RPCClient, node string) error

func Uptime

func Uptime(client *rpc.RPCClient) (time.Duration, error)

Uptime consults the "uptime" RPC method to obtain how long (in seconds) has the Bitcoin server been running. Note that this method is only available in rvelhote:rpc-uptime branch and hopefully it will be merged for the next Bitcoin Core release.

Types

type AddNodeArgs

type AddNodeArgs struct {
	Node    string `json:"node"`
	Command string `json:"command"`
}

type AddedNodeAddress

type AddedNodeAddress struct {
	// Address is the bitcoin server IP and port we're connected to
	Address string `json:"address"`
	// Connected specified wether the connection is inbound or outbound
	Connected string `json:"connected"`
}

type AddedNodeInfo

type AddedNodeInfo struct {
	// AddedNode is the node ip address or name (as provided to addnode)
	AddedNode string `json:"addednode"`
	// Connected is a boolean that specifies if we are currently connected to the node
	Connected bool `json:"connected"`
	// Addresses is a list of addresses of the added node. Only present if connected == true
	Addresses []AddedNodeAddress `json:"addresses"`
}

func GetAddedNodeInfo

func GetAddedNodeInfo(client *rpc.RPCClient) ([]AddedNodeInfo, error)

GetAddedNodeInfo Returns information about the given added node, or all added nodes.

type Banned

type Banned struct {
	Address     string         `json:"address"`
	BannedUntil timestamp.Unix `json:"banned_until"`
	BanCreated  timestamp.Unix `json:"ban_created"`
	BanReason   string         `json:"ban_reason"`
}

func ListBanned

func ListBanned(client *rpc.RPCClient) ([]Banned, error)

type HumanizedMempoolInfo

type HumanizedMempoolInfo struct {
	Bytes      string
	Usage      string
	MaxMempool string
}

type MempoolInfo

type MempoolInfo struct {
	// Size is the current transaction count.
	Size uint `json:"size"`

	// Bytes is the sum of all virtual transaction sizes as defined in BIP 141. Differs from actual serialized size
	// because witness data is discounted
	Bytes uint64 `json:"bytes"`

	// Usage is the total memory usage for the mempool.
	Usage uint64 `json:"usage"`

	// MaxMempool is the maximum memory usage for the mempool.
	MaxMempool uint64 `json:"maxmempool"`

	// MempoolMinFee is the minimum fee for transaction to be accepted into the mempool.
	MempoolMinFee float64 `json:"mempoolminfee"`

	// Humanize humanizes the units (bytes, timestamps) that belong to this structure.
	Humanize HumanizedMempoolInfo
}

func GetMempoolInfo

func GetMempoolInfo(client *rpc.RPCClient) (MempoolInfo, error)

GetMempoolInfo returns details on the active state of the TX memory pool.

type NetTotals

type NetTotals struct {
	TotalBytesRecv uint64         `json:"totalbytesrecv"`
	TotalBytesSent uint64         `json:"totalbytessent"`
	TimeMillis     timestamp.Unix `json:"timemillis"`
	UploadTarget   UploadTarget   `json:"uploadtarget"`
}

NetTotals is the struct that contains information about the amount of data transfered by our node as well as possible restrictions/limitations on the amount of transferred data.

func GetNetTotals

func GetNetTotals(client *rpc.RPCClient) (NetTotals, error)

type Network

type Network struct {
	Name                      string `json:"name"`
	Limited                   bool   `json:"limited"`
	Reachable                 bool   `json:"reachable"`
	Proxy                     string `json:"proxy"`
	ProxyRandomizeCredentials bool   `json:"proxy_randomize_credentials"`
}

Network is the list of networks that the node is able to connected from (IPv4, IPv6, Onion)

type NetworkInfo

type NetworkInfo struct {
	Version         uint      `json:"version"`
	Subversion      string    `json:"subversion"`
	ProtocolVersion uint      `json:"protocolversion"`
	Services        string    `json:"localservices"`
	LocalRelay      bool      `json:"localrelay"`
	TimeOffset      int       `json:"timeoffset"`
	NetworkActive   bool      `json:"networkactive"`
	Connections     uint      `json:"connections"`
	Warnings        string    `json:"warnings"`
	RelayFee        float64   `json:"relayfee"`
	IncrementalFee  float64   `json:"incrementalfee"`
	LocalAddresses  []string  `json:"localaddresses"`
	Networks        []Network `json:"networks"`
}

NetworkInfo is the structure returned by the Bitcoin Daemon with information about the node's network.

func GetNetworkInfo

func GetNetworkInfo(client *rpc.RPCClient) (NetworkInfo, error)

GetNetworkInfo obtains information about the network conditions of the local node.

type PeerInfo

type PeerInfo struct {
	// Id is the Peer index
	Id int `json:"id"`

	// Addr is the ip address and port of the peer
	Addr string `json:"addr"`

	// AddrLocal is the local address
	AddrLocal string `json:"addrlocal"`

	// Services is an hexadecimal value that describes services offered by the peer
	Services string `json:"services"`

	// RelayTxes indicates whether peer has asked us to relay transactions to it
	RelayTxes bool `json:"relaytxes"`

	// LastSend is the time in seconds since epoch (Jan 1 1970 GMT) of the last send
	LastSend timestamp.Unix `json:"lastsend"`

	// LastRecv is the time in seconds since epoch (Jan 1 1970 GMT) of the last receive
	LastRecv timestamp.Unix `json:"lastrecv"`

	// BytesSent is the total bytes sent to this peer
	BytesSent uint64 `json:"bytessent"`

	// BytesRecv is the total bytes received from this peer
	BytesRecv uint64 `json:"bytesrecv"`

	// ConnTime is the connection time in seconds since epoch (Jan 1 1970 GMT)
	ConnTime timestamp.Unix `json:"conntime"`

	// TimeOffset is the time offset in seconds
	TimeOffset int `json:"timeoffset"`

	// PingTime is the ping to this peer (if available)
	PingTime float64 `json:"pingtime"`

	// MinPing is the minimum observed ping time (if any at all)
	MinPing float64 `json:"minping"`

	// Version is the peer version, such as 7001
	Version uint `json:"version"`

	// Subver is the string version of this peer
	Subver string `json:"subver"`

	// Inbound indicates if the connection is Inbound (true) or Outbound (false)
	Inbound bool `json:"inbound"`

	// AddNode indicates whether connection was due to addnode and is using an addnode slot
	AddNode bool `json:"addnode"`

	// StartHEight The starting height (block) of the peer
	StartHeight int `json:"startingheight"`

	// BanScore indicates the ban score for this peer
	BanScore uint `json:"banscore"`

	// SynchedHeaders is the last header we have in common with this peer
	SynchedHeaders int `json:"synced_headers"`

	// SynchedBlocks is the last block we have in common with this peer
	SynchedBlocks int `json:"synced_blocks"`

	// Whitelisted indicates whether the peer is whitelisted
	Whitelisted bool `json:"whitelisted"`

	// BytesSentPerMsg is the total bytes sent aggregated by message type
	BytesSentPerMsg PeerInfoBytesSent `json:"bytessent_per_msg"`

	// BytesReceivedPerMsg is the total bytes received aggregated by message type
	BytesReceivedPerMsg PeerInfoBytesSent `json:"bytesrecv_per_msg"`
}

func GetPeerInfo

func GetPeerInfo(client *rpc.RPCClient) ([]PeerInfo, error)

type PeerInfoArgs

type PeerInfoArgs struct {
}

type PeerInfoBytesReceived

type PeerInfoBytesReceived struct {
	Addr    uint `json:"addr"`
	Inv     uint `json:"inv"`
	Ping    uint `json:"ping"`
	Pong    uint `json:"pong"`
	VerAck  uint `json:"verack"`
	Version uint `json:"version"`
}

type PeerInfoBytesSent

type PeerInfoBytesSent struct {
	Addr        uint `json:"addr"`
	FeeFilter   uint `json:"feefilter"`
	Inv         uint `json:"inv"`
	Ping        uint `json:"ping"`
	Pont        uint `json:"pong"`
	SendCmpct   uint `json:"sendcmpct"`
	SendHeaders uint `json:"sendheaders"`
	VerAck      uint `json:"verack"`
	Version     uint `json:"version"`
}

type UploadTarget

type UploadTarget struct {
	Timeframe             time.Duration `json:"timeframe"`
	Target                uint          `json:"target"`
	TargetReached         bool          `json:"target_reached"`
	ServeHistoricalBlocks bool          `json:"serve_historical_blocks"`
	BytesLeftInCycle      uint64        `json:"bytes_left_in_cycle"`
	TimeLeftInCycle       uint64        `json:"time_left_in_cycle"`
}

Jump to

Keyboard shortcuts

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