From 47d6fb1cbc93e1a1ee77cd1649e7ec6d55089cf7 Mon Sep 17 00:00:00 2001 From: Lee Miller Date: Sat, 15 Oct 2022 14:47:35 +0300 Subject: [PATCH 1/6] Use internal link to doc in docstring of isProofOfWorkSufficient() --- src/protocol.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/protocol.py b/src/protocol.py index f402526f..e49b45b0 100644 --- a/src/protocol.py +++ b/src/protocol.py @@ -259,7 +259,7 @@ def isProofOfWorkSufficient( data, nonceTrialsPerByte=0, payloadLengthExtraBytes=0, recvTime=0): """ Validate an object's Proof of Work using method described - `here `_ + :doc:`here ` Arguments: int nonceTrialsPerByte (default: from `.defaults`) -- 2.45.1 From 7ccbfc4caa35fe946326c15ecbe83c35bf6140a8 Mon Sep 17 00:00:00 2001 From: Lee Miller Date: Sun, 25 Dec 2022 01:31:35 +0200 Subject: [PATCH 2/6] Add a footnote about the format of the public key in the Encryption doc --- docs/encryption.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/encryption.rst b/docs/encryption.rst index 306c4f0b..2747e57f 100644 --- a/docs/encryption.rst +++ b/docs/encryption.rst @@ -49,7 +49,7 @@ Encryption key_e as encryption key and the padded input text as payload. Call the output cipher text. 9. Calculate a 32 byte MAC with HMACSHA256, using key_m as salt and - IV + R + cipher text as data. Call the output MAC. + IV + R [#f2]_ + cipher text as data. Call the output MAC. The resulting data is: IV + R + cipher text + MAC @@ -252,3 +252,5 @@ Partial Example .. [#f1] The pyelliptic implementation used in PyBitmessage takes unpadded data, see :obj:`.pyelliptic.Cipher.ciphering`. +.. [#f2] The pyelliptic encodes the pubkey with curve and length, + see :obj:`.pyelliptic.ECC.get_pubkey` -- 2.45.1 From 4fef7cdd52f0b06ac2f5993959f2e6dae096d64c Mon Sep 17 00:00:00 2001 From: Lee Miller Date: Sun, 25 Dec 2022 12:12:23 +0200 Subject: [PATCH 3/6] Update also the public key example in the Encryption doc --- docs/encryption.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/encryption.rst b/docs/encryption.rst index 2747e57f..61c7fb3e 100644 --- a/docs/encryption.rst +++ b/docs/encryption.rst @@ -129,11 +129,12 @@ Partial Example :: - 04 + 02 ca 00 20 02 93 21 3d cf 13 88 b6 1c 2a e5 cf 80 fe e6 ff ff c0 49 a2 f9 fe 73 65 fe 38 67 81 3c a8 12 92 + 00 20 df 94 68 6c 6a fb 56 5a c6 14 9b 15 3d 61 b3 b2 87 ee 2c 7f 99 7c 14 23 -- 2.45.1 From 9145531acb8e368ab190808b66d6d148a8aaf587 Mon Sep 17 00:00:00 2001 From: Lee Miller Date: Mon, 9 Jan 2023 06:03:26 +0200 Subject: [PATCH 4/6] More about message types from Protocol_specification_v3 --- docs/protocol.rst | 58 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 57 insertions(+), 1 deletion(-) diff --git a/docs/protocol.rst b/docs/protocol.rst index 06e10766..b3a2b4b8 100644 --- a/docs/protocol.rst +++ b/docs/protocol.rst @@ -517,7 +517,6 @@ Allows a node to advertise its knowledge of one or more objects. Payload | 32x? | inventory | inv_vect[] | Inventory vectors | +------------+-------------+------------+-----------------------------+ - getdata ^^^^^^^ @@ -534,6 +533,50 @@ Payload (maximum payload length: 50000 entries): | 32x? | inventory | inv_vect[] | Inventory vectors | +------------+-------------+------------+-----------------------------+ +error +^^^^^ +.. note:: New in version 3 + +This message may be silently ignored (and therefor handled like any other +"unknown" message). + +The message is intended to inform the other node about protocol errors and +can be used for debugging and improving code. + +.. list-table:: + :header-rows: 1 + :widths: auto + + * - Field Size + - Description + - Data type + - Comments + * - 1+ + - fatal + - |var_int| + - This qualifies the error. If set to 0, than its just a "warning". + You can expect, everything still worked fine. If set to 1, than + it's an error, so you may expect, something was going wrong + (e.g. an object got lost). If set to 2, it's a fatal error. The node + will drop the line for that error and maybe ban you for some time. + * - 1+ + - ban time + - var_int + - If the error is fatal, you can specify the ban time in seconds, here. + You inform the other node, that you will not accept further connections + for this number of seconds. For non fatal errors this field has + no meaning and should be zero. + * - 1+ + - inventory vector + - var_str + - If the error is related to an object, this Variable length string + contains the inventory vector of that object. If the error is not + related to an object, this string is empty. + * - 1+ + - error text + - var_str + - A human readable string in English, which describes the error. + object ^^^^^^ @@ -588,6 +631,19 @@ type, like 'msg', or 'broadcast'. To be a valid object, the - This field varies depending on the object type; see below. +Unsupported messages +^^^^^^^^^^^^^^^^^^^^ + +If a node receives an unknown message it **must** silently ignore it. This is +for further extensions of the protocol with other messages. Nodes that don't +understand such a new message type shall be able to work correct with the +message types they understand. + +Maybe some version 2 nodes did already implement it that way, but in version 3 +it is **part of the protocol specification**, that a node **must** +silently ignore unsupported messages. + + Object types ------------ -- 2.45.1 From 7c629368205754a489b5f54be002955728e0a290 Mon Sep 17 00:00:00 2001 From: Lee Miller Date: Tue, 3 Oct 2023 16:22:16 +0300 Subject: [PATCH 5/6] Update the Specification link --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 17049e7a..06c97c01 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ Feel welcome to join chan "bitmessage", BM-2cWy7cvHoq3f1rYMerRJp8PT653jjSuEdY References ---------- * [Project Website](https://bitmessage.org) -* [Protocol Specification](https://bitmessage.org/wiki/Protocol_specification) +* [Protocol Specification](https://pybitmessage.rtfd.io/en/v0.6/protocol.html) * [Whitepaper](https://bitmessage.org/bitmessage.pdf) * [Installation](https://bitmessage.org/wiki/Compiling_instructions) * [Discuss on Reddit](https://www.reddit.com/r/bitmessage) -- 2.45.1 From 427965cac3199dfa0d960e382eead88814bf1e22 Mon Sep 17 00:00:00 2001 From: Lee Miller Date: Tue, 3 Oct 2023 16:24:54 +0300 Subject: [PATCH 6/6] Correct articles in the verack section of the Spec, emphasize must uniformly --- docs/protocol.rst | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/docs/protocol.rst b/docs/protocol.rst index b3a2b4b8..17a13dd9 100644 --- a/docs/protocol.rst +++ b/docs/protocol.rst @@ -92,7 +92,7 @@ Variable length integer Integer can be encoded depending on the represented value to save space. Variable length integers always precede an array/vector of a type of data that -may vary in length. Varints MUST use the minimum possible number of bytes to +may vary in length. Varints **must** use the minimum possible number of bytes to encode a value. For example, the value 6 can be encoded with one byte therefore a varint that uses three bytes to encode the value 6 is malformed and the decoding task must be aborted. @@ -480,12 +480,13 @@ only a :ref:`message header ` with the command string "verack". The TCP timeout starts out at 20 seconds; after verack messages are exchanged, the timeout is raised to 10 minutes. -If both sides announce that they support SSL, they MUST perform a SSL handshake -immediately after they both send and receive verack. During this SSL handshake, -the TCP client acts as a SSL client, and the TCP server acts as a SSL server. -The current implementation (v0.5.4 or later) requires the AECDH-AES256-SHA -cipher over TLSv1 protocol, and prefers the secp256k1 curve (but other curves -may be accepted, depending on the version of python and OpenSSL used). +If both sides announce that they support SSL, they **must** perform an SSL +handshake immediately after they both send and receive verack. During this SSL +handshake, the TCP client acts as an SSL client, and the TCP server acts as an +SSL server. The current implementation (v0.5.4 or later) requires the +AECDH-AES256-SHA cipher over TLSv1 protocol, and prefers the secp256k1 curve +(but other curves may be accepted, depending on the version of python and +OpenSSL used). addr ^^^^ -- 2.45.1