Layer: Peer Services
Title: Reject P2P message
Author: Gavin Andresen <firstname.lastname@example.org>
Comments-Summary: Controversial; some recommendation, and some discouragement
Type: Standards Track
This BIP describes a new message type for the Bitcoin peer-to-peer network.
Giving peers feedback about why their blocks or transactions are rejected, or why they are being banned for not following the protocol helps interoperability between different implementations.
It also gives SPV (simplified payment verification) clients a hint that something may be wrong when their transactions are rejected due to insufficient priority or fees.
Data types in this specification are as described at https://en.bitcoin.it/wiki/Protocol_specification
One new message type "reject" is introduced. It is sent directly to a peer in response to a "version", "tx" or "block" message.
For example, the message flow between two peers for a relayed transaction that is rejected for some reason would be:
All implementations of the P2P protocol version 70,002 and later should support the reject message.
Every reject message begins with the following fields. Some messages append extra, message-specific data.
|Message that triggered the reject
|0x01 through 0x4f (see below)
|Human-readable message for debugging
The human-readable string is intended only for debugging purposes; in particular, different implementations may use different strings. The string should not be shown to users or used for anthing besides diagnosing interoperability problems.
The following reject code categories are used; in the descriptions below, "server" is the peer generating the reject message, "client" is the peer that will receive the message.
|Protocol syntax errors
|Protocol semantic errors
|Server policy rule
rejection codes common to all message types
|Message could not be decoded
reject version codes
Codes generated during the initial connection process in response to a "version" message:
|Client is an obsolete, unsupported version
|Duplicate version message received
reject tx payload, codes
Transaction rejection messages extend the basic message with the transaction id hash:
|transaction that is rejected
The following codes are used:
|Transaction is invalid for some reason (invalid signature, output value greater than input, etc.)
|An input is already spent
|Not mined/relayed because it is "non-standard" (type or version unknown by the server)
|One or more output amounts are below the 'dust' threshold
|Transaction does not have enough fee/priority to be relayed or mined
payload, reject block
Block rejection messages extend the basic message with the block header hash:
|block (hash of block header) that is rejected
|Block is invalid for some reason (invalid proof-of-work, invalid signature, etc)
|Block's version is no longer supported
|Inconsistent with a compiled-in checkpoint
Note: blocks that are not part of the server's idea of the current best chain, but are otherwise valid, should not trigger reject messages.
The reject message is backwards-compatible; older peers that do not recognize the reject message will ignore it.
Implementors must consider what happens if an attacker either sends them reject messages for valid transactions/blocks or sends them random reject messages, and should beware of possible denial-of-service attacks. For example, notifying the user of every reject message received would make it trivial for an attacker to mount an annoy-the-user attack. Even merely writing every reject message to a debugging log could make an implementation vulnerable to a fill-up-the-users-disk attack.