Home › Browse › BIP 61

BIP 61: Reject P2P message

In plain English: Adds a "reject" message so a node can tell a peer why it refused a transaction or block. This made troubleshooting easier for wallet and node developers, though Bitcoin Core later removed the message.

Status
Deployed
Type
Specification
Layer
Peer Services
Authors
Gavin Andresen
Assigned
Last changed
Topics
Network, Transactions
Source
bip-0061.mediawiki on GitHub · Markdown

Abstract

This BIP describes a new message type for the Bitcoin peer-to-peer network.

Motivation

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.

Specification

Data types in this specification are as described at https://en.bitcoin.it/wiki/Protocol_specification

reject

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:

--> inv
<-- getdata
--> tx
<-- reject

All implementations of the P2P protocol version 70,002 and later should support the reject message.

common payload

Every reject message begins with the following fields. Some messages append extra, message-specific data.

Field SizeNameData typeComments
variableresponse-to-msgvar_strMessage that triggered the reject
1reject-codeuint8_t0x01 through 0x4f (see below)
variablereasonvar_stringHuman-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 anything 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.

RangeCategory
0x01-0x0fProtocol syntax errors
0x10-0x1fProtocol semantic errors
0x40-0x4fServer policy rule

rejection codes common to all message types

CodeDescription
0x01Message could not be decoded

reject version codes

Codes generated during the initial connection process in response to a "version" message:

CodeDescription
0x11Client is an obsolete, unsupported version
0x12Duplicate version message received

reject tx payload, codes

Transaction rejection messages extend the basic message with the transaction id hash:

Field SizeNameData typeComments
32hashchar[32]transaction that is rejected

The following codes are used:

CodeDescription
0x10Transaction is invalid for some reason (invalid signature, output value greater than input, etc.)
0x12An input is already spent
0x40Not mined/relayed because it is "non-standard" (type or version unknown by the server)
0x41One or more output amounts are below the 'dust' threshold
0x42Transaction 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:

Field SizeNameData typeComments
32hashchar[32]block (hash of block header) that is rejected

Rejection codes:

codedescription
0x10Block is invalid for some reason (invalid proof-of-work, invalid signature, etc)
0x11Block's version is no longer supported
0x43Inconsistent 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.

Compatibility

The reject message is backwards-compatible; older peers that do not recognize the reject message will ignore it.

Implementation notes

Implementers 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.

Related proposals

  • BIP 11: M-of-N Standard Transactions: Deployed. Made "M-of-N" transactions, which require any M signatures out of N possible keys, a standard type that nodes relay. This enabled shared-control arrangements such as escrow or wallets needing two of…
  • BIP 12: OP_EVAL: Closed. Proposed a new script command, OP_EVAL, that would let the receiver of coins define the conditions for spending them instead of the sender. It was abandoned over security concerns and replaced by…
  • BIP 14: Protocol Version and User Agent: Deployed. Separates the version of the Bitcoin network protocol from the version of any one program, and adds a "user agent" label identifying the software a node runs. As alternative clients appeared, this…
  • BIP 16: Pay to Script Hash: Deployed. Introduced Pay to Script Hash (P2SH), letting a sender pay to a short fingerprint of spending rules that the recipient reveals only when spending. This shifted the cost and complexity of setups like…
  • BIP 31: Pong message: Deployed. Adds a "pong" reply that a node sends back when it receives a "ping" containing a random number. This lets software reliably tell whether a connection to another node is still alive.
  • BIP 33: Stratized Nodes: Closed. Proposed specialized node roles so lightweight clients could rely on full nodes that serve them only the data they need. It aimed to keep Bitcoin usable for ordinary users as the blockchain grew too…