flocore-p2p/docs/messages.md
Manuel Araoz d303e46f69 add docs
2015-02-02 16:24:17 -03:00

2.3 KiB

title: Messages description: A superclass for the messages of the bitcoin network

Messages

The bitcoin protocol specifies a set of messages that can be sent from peer to peer. bitcore-p2p provides support for some of these messages.

List of Messages

Version

The version message (ver) is used on connection creation, to advertise the type of node. The remote node will respond with its version, and no communication is possible until both peers have exchanged their versions. By default, bitcore advertises itself as named bitcore with the current version of the bitcore-p2p package.

VerAck

Finishes the connection handshake started by the ver message.

Inventory

From the bitcoin protocol spec: "Allows a node to advertise its knowledge of one or more objects. It can be received unsolicited, or in reply to getblocks.".

GetData

From the bitcoin protocol spec: getdata is used in response to inv, to retrieve the content of a specific object, and is usually sent after receiving an inv packet, after filtering known elements. It can be used to retrieve transactions, but only if they are in the memory pool or relay set - arbitrary access to transactions in the chain is not allowed to avoid having clients start to depend on nodes having full transaction indexes (which modern nodes do not).

GetData inherits from Inventory, as they both have the same structure.

NotFound

notfound is a response to a getdata, sent if any requested data items could not be relayed, for example, because the requested transaction was not in the memory pool or relay set. Contains inventory information specifying which items were not found.

Ping

Sent to another peer mainly to check the connection is still alive.

Pong

Sent in response to a ping message.

Address and GetAddresses

Provides information on known nodes of the network. GetAddresses is used to query another peer for known addresses.

GetHeaders and Headers

getheaders allows a peer to query another about blockheaders. headers is sent in response to a getheaders message, containing information about block headers.

GetBlocks and Block

Same as getheaders and headers, but the response comes one block at the time.

Transaction

Message that contains a transaction.