Skip to content

GRPC Documentation - Legacy PeerService

Table of Contents

Top

peer_api.proto

Package peer_api defines the gRPC service interface for legacy peer management compatible with Bitcoin RPC interfaces.

BanPeerRequest

Represents a request to ban a peer.

Field Type Label Description
addr string The address of the peer to ban
until int64 Unix timestamp indicating when the ban expires

BanPeerResponse

Represents the response from banning a peer.

Field Type Label Description
ok bool Indicates whether the ban operation succeeded

ClearBannedResponse

Represents the response from clearing all banned peers.

Field Type Label Description
ok bool Indicates whether the clear operation succeeded

GetPeerCountResponse

Represents the response containing the count of connected peers.

Field Type Label Description
count int32 The number of currently connected peers

GetPeersResponse

Represents the response containing all connected peers.

Field Type Label Description
peers Peer repeated List of all connected peers

IsBannedRequest

Represents a request to check if an IP or subnet is banned.

Field Type Label Description
ipOrSubnet string The IP address or subnet to check

IsBannedResponse

Represents the response indicating whether an IP or subnet is banned.

Field Type Label Description
isBanned bool Indicates whether the IP or subnet is banned

ListBannedResponse

Represents the response containing all banned addresses.

Field Type Label Description
banned string repeated List of all banned IP addresses or subnets

Peer

Represents detailed information about a connected peer compatible with Bitcoin RPC format.

Field Type Label Description
id int32 Peer identifier
addr string Remote address (host:port)
addrLocal string Local address used for this connection
services string Services supported by the peer
lastSend int64 Time of last message sent (seconds since epoch)
lastRecv int64 Time of last message received (seconds since epoch)
sendSize int64 Size of send buffer
recvSize int64 Size of receive buffer
sendMemory int64 Memory used by send buffer
pauseSend bool Whether sending is paused
unpauseSend bool Whether sending is unpaused
bytesSent uint64 Total bytes sent to this peer
bytesReceived uint64 Total bytes received from this peer
avgRecvBandwidth int64 Average receive bandwidth
assocId string Association identifier
streamPolicy string Stream policy used for this connection (e.g., "BlockPriority")
inbound bool Whether this is an inbound connection
connTime int64 Connection time (seconds since epoch)
pingTime int64 Last ping time in microseconds
timeOffset int64 Time offset from this peer
version uint32 Protocol version of the peer
subVer string User agent string of the peer
startingHeight int32 Block height when connection was established
currentHeight int32 Current block height of the peer
banscore int32 Ban score of this peer
whitelisted bool Whether this peer is whitelisted
feeFilter int64 Minimum fee filter for transactions

UnbanPeerRequest

Represents a request to unban a peer.

Field Type Label Description
addr string The address of the peer to unban

UnbanPeerResponse

Represents the response from unbanning a peer.

Field Type Label Description
ok bool Indicates whether the unban operation succeeded

PeerService

Service provides legacy peer management methods compatible with Bitcoin RPC interfaces.

Method Name Request Type Response Type Description
GetPeers .google.protobuf.Empty GetPeersResponse Retrieves a list of all connected peers with their detailed information.
BanPeer BanPeerRequest BanPeerResponse Bans a peer by address until the specified time.
UnbanPeer UnbanPeerRequest UnbanPeerResponse Removes a ban for a peer address.
IsBanned IsBannedRequest IsBannedResponse Checks if an IP address or subnet is currently banned.
ListBanned .google.protobuf.Empty ListBannedResponse Lists all currently banned addresses.
ClearBanned .google.protobuf.Empty ClearBannedResponse Clears all banned addresses.
GetPeerCount .google.protobuf.Empty GetPeerCountResponse Returns the count of currently connected peers.

Scalar Value Types

.proto Type Notes C++ Java Python Go C# PHP Ruby
double double double float float64 double float Float
float float float float float32 float float Float
int32 Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint32 instead. int32 int int int32 int integer Bignum or Fixnum (as required)
int64 Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint64 instead. int64 long int/long int64 long integer/string Bignum
uint32 Uses variable-length encoding. uint32 int int/long uint32 uint integer Bignum or Fixnum (as required)
uint64 Uses variable-length encoding. uint64 long int/long uint64 ulong integer/string Bignum or Fixnum (as required)
sint32 Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s. int32 int int int32 int integer Bignum or Fixnum (as required)
sint64 Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s. int64 long int/long int64 long integer/string Bignum
fixed32 Always four bytes. More efficient than uint32 if values are often greater than 2^28. uint32 int int uint32 uint integer Bignum or Fixnum (as required)
fixed64 Always eight bytes. More efficient than uint64 if values are often greater than 2^56. uint64 long int/long uint64 ulong integer/string Bignum
sfixed32 Always four bytes. int32 int int int32 int integer Bignum or Fixnum (as required)
sfixed64 Always eight bytes. int64 long int/long int64 long integer/string Bignum
bool bool boolean boolean bool bool boolean TrueClass/FalseClass
string A string must always contain UTF-8 encoded or 7-bit ASCII text. string String str/unicode string string string String (UTF-8)
bytes May contain any arbitrary sequence of bytes. string ByteString str []byte ByteString string String (ASCII-8BIT)