Net::BitTorrent::Version - Net::BitTorrent's project-wide version numbers


Because of the problems coordinating revision numbers in a distributed version control system and across a directory full of Perl modules, this module provides a central location for the project's overall release number, the version string provided in Extended Protocol handshakes, and the Peer ID generator.


gen_node_id ( )

Returns a random 20-byte string that can be used to identify ourself in a DHT swarm.

gen_peerid ( )

Generates a unique Peer ID based on Net::BitTorrent's Specification.

Peer ID Specification

This section describes and provides examples of the Peer ID format used by this release of the Net::BitTorrent module.


This non-standard format was developed to be URL-safe, unique to the implementation, and "human parsable."

There are two distinct sections to the Peer IDs generated: the header which may be used to identify the software and its version, and the signature which is... well, it's junk. Consider this example:


Here, NB004S is the header and -rogzGB1v--SVN is the trailing signature.

The header consists of two uppercase characters ('NB') followed by three digits (with leading zeros) representing the SVN revision, and a single character used to (potentially) indicate stability.

If the client is a stable build, the sixth character is the capital letter 'C' (as these are usually obtained from CPAN). If the client is a version checked out from SVN, the sixth character is the capital letter 'S'. Any other characters in the sixth byte are unsupported and may indicate a bad client.


The remainder of the Peer ID is a hyphen followed by 13 random characters in the following range:


That is, all uppercase and lowercase letters, decimal digits, as well as the hyphen, period, underscore, and tilde (66 total). These are all characters allowed in a URL without being encoded (referred to as "Unreserved Characters" in rfc://3986) to reduce weight on the tracker during announce.

Version Numbers and Stability

Version numbers will be some value less than one (1) with the revision number in the three significant decimal places.

Stable revisions will have the sixth char set to 'S' (capital letter 's'). The most recent of these stable builds will be found on CPAN.

Unstable revisions will have the sixth char set to 'U' (capital letter 'u'). These will most likely be SVN checkouts and temporary uploads to CPAN where the package's filename matches m[\d\.\d+_\d]. See the PAUSE FAQ section entitled "Developer Releases" (



This would be the stable CPAN release v0.393/SVN r393. The --SVN signature does not imply an unstable build.


Improper Peer ID; the sixth char is neither 'S' nor 'U'.


Completely legal Peer ID generated by unstable SVN/Dev r65.

See Also

RFC 3986 (URI: Generic Syntax) Section 2.3. "Unreserved Characters" (

PAUSE FAQ sub-section entitled "Developer Releases" (


This document and the specification behind it are subject to change. All modifications will be documented in the Changes file included with this distribution. All versions of this file can be found in the project's SVN repository.


Sanko Robinson <> -


License and Legal

Copyright (C) 2008 by Sanko Robinson <>

This program is free software; you can redistribute it and/or modify it under the terms of The Artistic License 2.0. See the LICENSE file included with this distribution or For clarification, see

When separated from the distribution, all POD documentation is covered by the Creative Commons Attribution-Share Alike 3.0 License. See For clarification, see

Neither this module nor the Author is affiliated with BitTorrent, Inc.