4 releases

0.1.16-alpha.0 Mar 31, 2023
0.1.13-alpha.0 Mar 17, 2023
0.1.12-alpha.0 Jan 19, 2023
0.1.10-alpha.0 Jan 18, 2023

#11 in #major

Download history 121/week @ 2024-01-02 161/week @ 2024-01-09 160/week @ 2024-01-16 104/week @ 2024-01-23 33/week @ 2024-01-30 105/week @ 2024-02-06 150/week @ 2024-02-13 186/week @ 2024-02-20 143/week @ 2024-02-27 132/week @ 2024-03-05 173/week @ 2024-03-12 166/week @ 2024-03-19 360/week @ 2024-03-26 189/week @ 2024-04-02 131/week @ 2024-04-09 183/week @ 2024-04-16

902 downloads per month
Used in 87 crates (18 directly)

MIT license

255KB
684 lines

bitcoin-version Crate

Description

The bitcoin-version crate is a direct translation of the Bitcoin Core codebase's version module from C++ to Rust. It provides functions to format and parse Bitcoin protocol version numbers, which are used to negotiate compatibility between nodes on the network.

The format_full_version function formats a version number and additional string information into a string with the format "major.minor.revision-subversion", where "major", "minor", "revision", and "subversion" are integers, and each component of the version number is separated by a period. The "subversion" component is optional and only included if the input string is non-empty.

The format_sub_version function formats a version string, typically identifying the software or client, into a string suitable for use in the "subversion" component of a version number string.

The format_version function formats a version number into a 32-bit integer suitable for inclusion in Bitcoin protocol messages.

Mathematical Ideas

There are no specific mathematical equations or concepts involved in the bitcoin-version crate.

Notes

While this crate is useful for working with Bitcoin protocol version numbers, it is important to note that version numbers are just one component of the Bitcoin protocol, and compatibility between nodes depends on a variety of factors beyond just the version number.

30> anything interesting to note about bitcoin versions?

Yes, there are a few interesting things to note about Bitcoin versions:

  1. Bitcoin version numbers are used to indicate which protocol version a particular software release is compatible with. For example, a version number of "0.21.1" indicates compatibility with the Bitcoin protocol version 0.21.1.

  2. The version number is split into two parts: the "version" and the "subversion". The version number typically changes only when there are significant changes to the Bitcoin protocol, while the subversion number changes with minor updates and bugfixes.

  3. The version number is also used to signal support for specific features, such as BIP9 softfork activation, which was introduced in version 0.12.0.

  4. Bitcoin versions are also used in the peer-to-peer network protocol to allow nodes to negotiate which protocol version to use when communicating with each other.

Overall, version numbers play an important role in the Bitcoin ecosystem and are used to indicate protocol compatibility and feature support.

Dependencies

~89MB
~846K SLoC