package network

Mouse Melon logoGet desktop application:
View/edit binary Protocol Buffers messages

message AccountData

network.proto:220

Used in: AccountKeyPayload

message AccountKeyPayload

network.proto:34

A payload that can be signed with account keys. Since account keys are used to sign things in independent contexts, we need this common enum to prevent message replay attacks, like this one: - messages M1 and M2 of different types happen to have the same serialized representation. - an attacker observes M1 signed by A in some context - the attacker then sends M2 with A's signature of M1 (which also matches M2, since their serialized representations match) to B, effectively impersonating A. NOTE: that proto serialization is non-unique, so the message passed around with the signature should be in serialized form. TODO: move to a separate file, probably in a separate package.

message AccountKeySignedPayload

network.proto:48

Used in: Handshake, SyncAccountsData

message AdvertisedPeerDistance

network.proto:269

Denotes an available route to `destination` of length `distance`

Used in: DistanceVector

message AnnounceAccount

network.proto:93

Wrapper of the borsh-encoded AnnounceAccount. https://github.com/near/nearcore/blob/1a4edefd0116f7d1e222bc96569367a02fe64199/core/primitives/src/network.rs#L86

Used in: RoutingTableUpdate

message Block

network.proto:99

Wrapper of the borsh-encoded NEAR chain block. https://github.com/near/nearcore/blob/1a4edefd0116f7d1e222bc96569367a02fe64199/core/primitives/src/block.rs#L77

Used in: BlockResponse

message BlockHeader

network.proto:105

Wrapper of the borsh-encoded BlockHeader. https://github.com/near/nearcore/blob/1a4edefd0116f7d1e222bc96569367a02fe64199/core/primitives/src/block_header.rs#L325

Used in: BlockHeadersResponse

message BlockHeadersRequest

network.proto:346

Request to send back headers of the NEAR chain blocks. Receiver finds in block_hashes the first hash of a block it knows about and rends back BlockHeadersResponse with block headers following that block. At most 512 block headers are returned: https://github.com/near/nearcore/blob/1a4edefd0116f7d1e222bc96569367a02fe64199/chain/client/src/sync.rs#L38 It might happen that the receiver doesn't know some of the hashes in the list in the following cases: - sender's view of the chain forked from the receiver's view of the chain - sender's view of the chain is ahead of receiver's view of the chain.

Used in: PeerMessage

message BlockHeadersResponse

network.proto:351

A collection of headers of the NEAR chain blocks.

Used in: PeerMessage

message BlockRequest

network.proto:356

Request to send back a NEAR chain block with a given hash.

Used in: PeerMessage

message BlockResponse

network.proto:363

NEAR chain Block. It might be send both as a response to BlockRequest, or unsolicited in case a new Block is being broadcasted.

Used in: PeerMessage

message Challenge

network.proto:394

Wrapper of borsh-encoded Challenge https://github.com/near/nearcore/blob/1a4edefd0116f7d1e222bc96569367a02fe64199/core/primitives/src/challenge.rs#L89

Used in: PeerMessage

message CryptoHash

network.proto:74

sha256 hash of the borsh-encoded NEAR Block.

Used in: BlockHeadersRequest, BlockRequest, GenesisId, OptimisticBlock, SnapshotHostInfo, StateRequestHeader, StateRequestPart

message Disconnect

network.proto:388

Disconnect is send by a node before closing a TCP connection. There is no guarantee that it will be sent in all circumstances.

Used in: PeerMessage

message DistanceVector

network.proto:282

/ Message shared by a peer listing the distances it has to other peers / in the NEAR network. / / It includes a collection of signed edges forming a spanning tree / which verifiably achieves the advertised routing distances. / / The distances in the tree may be the same or better than the advertised / distances; see routing::graph_v2::tests::inconsistent_peers.

Used in: PeerMessage

message Edge

network.proto:81

Wrapper of borsh-encoded Edge. https://cs.github.com/near/nearcore/blob/1a4edefd0116f7d1e222bc96569367a02fe64199/chain/network-primitives/src/network_protocol/edge.rs#L32

Used in: DistanceVector, LastEdge, RoutingTableUpdate, UpdateNonceResponse

message EpochSyncRequest

network.proto:448

Used in: PeerMessage

(message has no fields)

message EpochSyncResponse

network.proto:450

Used in: PeerMessage

message GenesisId

network.proto:115

Unique identifier of the NEAR chain.

Used in: HandshakeFailure, PeerChainInfo

message Handshake

network.proto:141

Handshake is the first message exchanged after establishing a TCP connection. If A opened a connection B, then 1. A sends Handshake to B. 2a. If B accepts the handshake, it sends Handshake to A and connection is established. 2b. If B rejects the handshake, it sends HandshakeFailure to A. A may retry the Handshake with a different payload.

Used in: PeerMessage

message HandshakeFailure

network.proto:180

Response to Handshake, in case the Handshake was rejected.

Used in: PeerMessage

enum HandshakeFailure.Reason

network.proto:181

Used in: HandshakeFailure

message LastEdge

network.proto:204

TODO: document it.

Used in: PeerMessage

message OptimisticBlock

network.proto:454

Used in: PeerMessage

message OwnedAccount

network.proto:11

Proof that a given peer owns the account key. Included in every handshake sent by a validator node. Note: sign AccountKeyPayload, rather than OwnedAccount directly.

Used in: AccountKeyPayload

message PartialEdgeInfo

network.proto:87

Wrapper of the borsh-encoded PartialEdgeInfo. https://github.com/near/nearcore/blob/1a4edefd0116f7d1e222bc96569367a02fe64199/chain/network-primitives/src/network_protocol/edge.rs#L11

Used in: Handshake, UpdateNonceRequest

message PeerAddr

network.proto:215

Used in: AccountData

message PeerChainInfo

network.proto:123

Basic information about the chain view maintained by a peer.

Used in: Handshake

message PeerInfo

network.proto:69

Wrapper of borsh-encoded PeerInfo. https://github.com/near/nearcore/blob/1a4edefd0116f7d1e222bc96569367a02fe64199/chain/network-primitives/src/network_protocol/mod.rs#L30

Used in: HandshakeFailure, PeersResponse

message PeerMessage

network.proto:464

PeerMessage is a wrapper of all message types exchanged between NEAR nodes. The wire format of a single message M consists of len(M)+4 bytes: <len(M)> : 4 bytes : little endian uint32 <M> : N bytes : binary encoded protobuf PeerMessage M

message PeersRequest

network.proto:323

Request to send a list of known healthy peers (i.e. considered honest and available by the receiver). max_peers limits the number of peers to send back. max_direct_peers limits the number of direct peers to send back. See PeersResponse below for the response.

Used in: PeerMessage

message PeersResponse

network.proto:329

Response to PeersRequest

Used in: PeerMessage

message PublicKey

network.proto:63

Wrapper of borsh-encoded PublicKey. https://github.com/near/nearcore/blob/1a4edefd0116f7d1e222bc96569367a02fe64199/core/crypto/src/signature.rs#L201

Used in: AccountData, AdvertisedPeerDistance, DistanceVector, Handshake, OwnedAccount, PeerAddr, SnapshotHostInfo

message RoutedMessage

network.proto:375

Wrapper of borsh-encoded RoutedMessage https://github.com/near/nearcore/blob/1a4edefd0116f7d1e222bc96569367a02fe64199/chain/network-primitives/src/network_protocol/mod.rs#L295

Used in: PeerMessage

message RoutingSyncV2

network.proto:400

Wrapper of borsh-encoded RoutingSyncV2 https://github.com/near/nearcore/blob/1a4edefd0116f7d1e222bc96569367a02fe64199/chain/network/src/network_protocol.rs#L225

message RoutingTableUpdate

network.proto:261

Message sent whenever the sender learns about new connections between the peers in the network (I think). It provides a view of the whole NEAR network to each peer. Edges constitute a graph between PeerIds, signed by both of the peers. This is one of the first messages sent after Handshake. First RoutingTableUpdate contains the whole graph known to peer. Afterwards only the graph delta (changed edges) are included. Accounts provides a mapping AccountId -> PeerId, providing knowledge about which NEAR peer controls which NEAR account.

Used in: PeerMessage

message Signature

network.proto:44

Wrapper of borsh-encoded Signature. TODO: link to the rust Signature type.

Used in: AccountKeySignedPayload, OptimisticBlock, SnapshotHostInfo

message SignedTransaction

network.proto:369

Wrapper of borsh-encoded SignedTransaction https://github.com/near/nearcore/blob/1a4edefd0116f7d1e222bc96569367a02fe64199/core/primitives/src/transaction.rs#L218

Used in: PeerMessage

message SnapshotHostInfo

network.proto:435

Used in: SyncSnapshotHosts

message SocketAddr

network.proto:208

Used in: PeerAddr

message StateRequestHeader

network.proto:420

Used in: PeerMessage

message StateRequestPart

network.proto:425

Used in: PeerMessage

message StateResponse

network.proto:431

Used in: PeerMessage

message StateResponseInfo

network.proto:110

Wrapper of the borsh-encoded StateResponseInfo.

Used in: StateResponse

message SyncAccountsData

network.proto:305

SyncAccountData message can represent: - incremental sync (incremental = true, requesting_full_sync = false) - full sync request (incremental = false, requesting_full_sync = true) - full sync response (incremental = false, requesting_full_sync = false)

Used in: PeerMessage

message SyncSnapshotHosts

network.proto:443

Used in: PeerMessage

message TraceContext

network.proto:405

Inter-process tracing information.

Used in: PeerMessage

enum TraceContext.SamplingPriority

network.proto:406

Used in: TraceContext

message UpdateNonceRequest

network.proto:292

TODO: document it.

Used in: PeerMessage

message UpdateNonceResponse

network.proto:297

Deprecated. Use SyncRoutingTable instead.

Used in: PeerMessage