BIP 31, Pong message, is Mike Hearn's 2012 extension to the Bitcoin peer-to-peer protocol. It added a 64-bit nonce to the ping message and a corresponding pong reply, letting a connected node check whether its peer was still responding and, when a nonce was chosen for measurement, estimate round-trip latency. Bitcoin-Qt/bitcoind 0.6.1 released the feature on 4 May 2012 using network protocol version 60001. BIP 31 — specification · Bitcoin-Qt 0.6.1 announcement — contemporary release record
The provenance of the implementation is more complicated than the specification's single implementation link suggests. Hearn's original PR #932 did not merge. Jeff Garzik adapted that work in PR #1081, which merged on 17 April 2012. The original PR remained open until 8 May, four days after the release. These are separate records of one feature, not two deployed pong protocols. Original proposal — direct repository record · Merged implementation — direct repository record
Why Bitcoin needed an answer to ping
Before this extension, Bitcoin already had a ping command, but a recipient was not required to reply to it. That made the command a weak test of whether a connection was genuinely usable. In the March 2012 discussion, Matt Corallo asked why Bitcoin had a ping that did not visibly accomplish anything; Pieter Wuille confirmed the value of checking whether a connection was alive. These are contemporary developer observations, not performance measurements.
The BIP described three recurring problems:
- Sleeping devices. A laptop or mobile device could wake with a TCP connection that appeared to remain established even though the path no longer worked.
- Overloaded peers. A node occupied with blockchain download or other work might be slow to process network messages. A live socket did not guarantee a responsive application.
- Peer selection. A client choosing a source for large downloads could benefit from knowing relative network latency, rather than selecting arbitrarily.
These are motivations in Hearn's specification. They do not demonstrate that the first Bitcoin Core release automatically ranked all peers by measured latency.
The wire change
The BIP uses the version negotiated in the peer handshake to decide which form of ping to send.
- Protocol version greater than 60000
pingcontains an unsigned 64-bitnonce; the receiving node answers withpongcontaining the same value. A randomly selected nonce lets the requester match a response to the proper request even if several pings overlap.
- Protocol version 60000 or below
- The earlier form of
pingcarries no nonce and expects nopong. Nodes using the new feature must preserve that compatibility boundary.
- Nonce zero
- The specification allows a sender that never overlaps pings to use zero rather than generating a random value for each request. Zero is not evidence that a round-trip measurement was performed.
The actual 2012 implementation provides a revealing limit. PR #1081 sends ping with nonce 0 as a periodic keepalive; its code comment says the sender did not yet use the nonce value for measurement. The receiving handler could already echo any supplied nonce. Thus support for the mechanism and a particular application's use of latency measurements should not be conflated. Merged diff — direct code record · Bitcoin 0.6.1 protocol constants
The version check concerns the negotiated peer-to-peer protocol number, not the human-facing software release label. BIP 14 had already separated protocol versioning from client versioning. In the original PR discussion on 12 March 2012, Wuille explicitly reminded Hearn of that separation when the proposal initially tried to raise the protocol number by a large increment. Wuille's contemporary reply · BIP 14 specification
The 2012 development record
pong and initially proposed changing the network protocol version to 70000. Reviewers questioned the version jump and whether the proposal needed a BIP. The PR ultimately closed **without merging**.Created, and later metadata changes do not by themselves prove the exact date of number assignment. PR conversation · 2026 field-label changeBIP: 32. The second, at 21:34 UTC, corrected that internal header to 31, crediting Wuille for catching the typo. This is a short-lived editorial inconsistency, **not evidence of two independently deployed features**.60000 feature threshold and introduced an explicit BIP0031_VERSION constant. This merge added code, but the software's own PROTOCOL_VERSION still required a separate bump to make the feature available to its new peers.PROTOCOL_VERSION = 60001, the nonce-bearing ping, and pong. This is the first identified tagged release delivering BIP 31 in the reference client. Original release notes · Tagged sourceWhen Bitcoin Core started measuring latency
The original 0.6.1 implementation could echo a nonce but sent zero in its own keepalive pings. It did not maintain the later per-peer round-trip measurement. The next step is visible in a separate pair of 2013–2015 Bitcoin Core changes, not in a retroactive reinterpretation of the 2012 BIP.
2013–2014: a measurement and an RPC
On 25 August 2013, Josh Lehan (GitHub handle Krellan) opened Bitcoin Core PR #2937. Its underlying implementation commit bears an author date of 22 August 2013 and a committer date of 4 October; the pull request itself merged on 13 October 2013. The three timestamps refer to different events. PR metadata · Commit metadata
The diff added an actual pong handler that matched a received nonce against an outstanding ping, calculated microseconds between sending and reception, and stored the result on the peer. It also added the ping RPC to request measurements from connected peers and the pingtime and pingwait fields to getpeerinfo. pingwait was especially deliberate: a peer's last successful time could look healthy even while a new ping was stuck in the processing queue. Merged-source commit
The change initially retained an automatic keepalive triggered after 30 minutes without sending, alongside manual RPC-triggered pings. It did not yet establish regular two-minute probes. The source in tagged 0.8.6 lacks the per-peer measurement fields; tagged 0.9.0 processes matching pongs and its RPC exposes the timing fields. The 0.9.0 release notes, dated 19 March 2014, list the new ping RPC and getpeerinfo fields. This makes 0.9.0 the identified released measurement boundary, as distinct from BIP 31's original 2012 wire-protocol release.
The RPC help explicitly cautioned that a measurement includes time in Bitcoin Core's message-processing queue. This was never a pure physical-network latency test. RPC implementation
2014–2015: regular probing and tighter liveness checks
Pieter Wuille's PR #2784 was opened as early as 22 June 2013 but did not merge until 12 June 2014. Its final source commit has an author timestamp of 14 October 2013 and a committer timestamp of 9 June 2014. The older authorship date should not be mistaken for the merge or release date. PR metadata · Commit metadata
The merged change moved automatic probing to every two minutes when no ping was outstanding and tightened the timeout to 20 minutes for suitable peers, replacing an approach based largely on 30-minute send inactivity and up to 90-minute receive inactivity. The pull request's original prose had proposed five minutes; the final committed code and tagged release take precedence for the shipped value. Final source diff · Tagged 0.10.0 definitions
The Bitcoin Core 0.10.0 release, dated 16 February 2015, is the identified shipping milestone for this later change; its changelog names f1920e8. In contrast, tagged 0.9.0 has measured ping times without PING_INTERVAL's two-minute schedule. The 2012 mechanism, 2014 measurement interface and 2015 automatic probing change are therefore three distinct pieces of the story.
Evidence limit: these commits demonstrate measurement, reporting and timed liveness handling in Bitcoin Core. They do not, by themselves, show that the client began automatically selecting its block-download peers by the lowest measured round-trip time. That narrower peer-selection question still needs its own implementation trace.
A draft with the wrong number and an obsolete version threshold
The 16 April 2012 preserved draft had two features that differ from the maintained text: its internal header still said BIP: 32, and its proposed negotiation rule used version 70000 or above rather than the eventual greater than 60000 condition. A subsequent commit fixed the header. The archived 6 July 2012 wiki revision, imported into the Git repository in October 2013, already states the 60000 threshold.
The original proposed condition therefore should not be quoted as the shipped protocol. The surviving commits bound the specification's revision history, but BOMB has not reconstructed the precise wiki edit that first changed the threshold. The tagged 0.6.1 source and release note independently establish the deployed 60001 behaviour.
The maintained BIP's Implementation section still links #932, a valuable reference to Hearn's original proposal but not the merged change. Bitcoin Core's implementation ledger instead names #1081 and version 0.6.1. Both links belong in the history, with their different roles made explicit.
Where ping and pong fit
A peer's ability to answer a ping is one small part of operating Bitcoin's network.
- Bitcoin peer discovery describes how a node first obtains candidate addresses. Discovery does not establish that a connection is still responsive.
- BIP 35 followed with a
mempoolrequest and protocol version 60002. It concerns a peer's local unconfirmed transaction inventory, not the liveness of the connection carrying that request. - BIP 130 and BIP 152 address dissemination of new blocks; BIP 133 addresses fee-filtered transaction announcements. They optimize content exchange after a connection exists.
- BIP 324 encrypts the transport; it does not turn a successful
ponginto evidence of identity or chain correctness.
The 2012 code permits a response to serve as a measurement, but no ping response proves the other side's ledger state, storage capacity or future reliability. This distinction remains relevant for software that selects peers to request historical block, inscription or Bitmap data.
Open research
Recover the specific 2012 Bitcoin Wiki edit that changed the draft's proposed
>=70000 threshold to the shipped >60000 rule, rather than relying only on the April draft and the later archived revision.Trace the first confirmed use, if any, of measured
ping/pong latency in automatic peer selection or block-download scheduling. Bitcoin Core's 0.9.0 measurement fields and 0.10.0 periodic probes establish measurement and liveness handling, not such a selection policy.Primary records
- Maintained BIP 31 specification.
- Mike Hearn's original proposal and March–May 2012 discussion.
- Jeff Garzik's merged implementation and April 2012 discussion.
- Draft filename correction, 16 April 2012.
- Draft header correction, 16 April 2012.
- Bitcoin-Qt/bitcoind 0.6.1 release announcement, 4 May 2012.
- Versioned protocol constants.
- Bitcoin Core BIP implementation ledger.
- Lehan's ping-time measurement PR, merged 13 October 2013 and source diff.
- Bitcoin Core 0.9.0 release record, 19 March 2014.
- Wuille's periodic ping and timeout PR, merged 12 June 2014 and source diff.
- Bitcoin Core 0.10.0 release record, 16 February 2015.