Common P2P Types

This chapter contains definitions of types used in multiple P2P messages.

Support Flags

Support flags specify any protocol extensions the peer supports, currently only the first bit is used:

FLUFFY_BLOCKS = 1 - for if the peer supports receiving fluffy blocks.

Basic Node Data 1

FieldsTypeDescription
network_idA UUID (epee string)A fixed constant value for a specific network (mainnet,testnet,stagenet)
my_portu32The peer's inbound port, if the peer does not want inbound connections this should be 0
rpc_portu16The peer's RPC port, if the peer does not want inbound connections this should be 0
rpc_credits_per_hashu32States how much it costs to use this node in credits per hashes, 0 being free
peer_idu64A fixed ID for the node, set to 1 for anonymity networks
support_flagssupport flags (u32)Specifies any protocol extensions the peer supports

Core Sync Data 2

FieldsTypeDescription
current_heightu64The current chain height
cumulative_difficultyu64The low 64 bits of the cumulative difficulty
cumulative_difficulty_top64u64The high 64 bits of the cumulative difficulty
top_id[u8; 32] (epee string)The hash of the top block
top_versionu8The hardfork version of the top block
pruning_seedu32THe pruning seed of the node, 0 if the node does no pruning

Network Address 3

Network addresses are serialized differently than other types, the fields needed depend on the type field:

FieldsTypeDescription
typeu8The address type
addrAn object whose fields depend on typeThe address

IPv4

type = 1

FieldsTypeDescription
m_ipu32The IPv4 address
m_portu16The port

IPv6

type = 2

FieldsTypeDescription
addr[u8; 16] (epee string)The IPv6 address
m_portu16The port

Tor

TODO:

I2p

TODO:

Peer List Entry Base 4

FieldsTypeDescription
adrNetwork AddressThe address of the peer
idu64The random, self assigned, ID of this node
last_seeni64A field marking when this peer was last seen, although this is zeroed before sending over the network
pruning_seedu32This peer's pruning seed, 0 if the peer does no pruning
rpc_portu16This node's RPC port, 0 if this peer has no public RPC port.
rpc_credits_per_hashu32States how much it costs to use this node in credits per hashes, 0 being free

Tx Blob Entry 5

FieldsTypeDescription
blobbytes (epee string)The pruned tx blob
prunable_hash[u8; 32] (epee string)The hash of the prunable part of the tx

Block Complete Entry 6

FieldsTypeDescription
prunedboolTrue if the block is pruned, false otherwise
blockbytes (epee string)The block blob
block_weightu64The block's weight
txsdepends on prunedThe transaction blobs, the exact type depends on pruned

If pruned is true:

txs is a vector of Tx Blob Entry

If pruned is false:

txs is a vector of bytes.


4

https://github.com/monero-project/monero/blob/cc73fe71162d564ffda8e549b79a350bca53c454/src/p2p/p2p_protocol_defs.h#L72

5

https://github.com/monero-project/monero/blob/cc73fe71162d564ffda8e549b79a350bca53c454/src/cryptonote_protocol/cryptonote_protocol_defs.h#L121

6

https://github.com/monero-project/monero/blob/cc73fe71162d564ffda8e549b79a350bca53c454/src/cryptonote_protocol/cryptonote_protocol_defs.h#L132