diff --git a/rfc/0005 Duniter Protocol Rework.md b/rfc/0005 Duniter Protocol Rework.md index 1bfc28f2ad3e4ebfe77441628a5d9c8949f67e07..848721493f0cc32108c9d7ce5f9457b1c75d48ae 100644 --- a/rfc/0005 Duniter Protocol Rework.md +++ b/rfc/0005 Duniter Protocol Rework.md @@ -138,18 +138,11 @@ IdentityHash = SHA256(Username + CompactKey + Blockstamp) ## 2. General document format -Each document is composed of an header, a list of issuers, a payload and one or more signatures. -The header is used for network propagation, but is ellided when written into a -block since they can be deduced from block data and context. +Each document is composed of an header, a payload and one or more signatures. +The tuple `(magic value, currency code, document type)` is used for network propagation, +but is ellided when written into a block since they can be deduced from block data and context. -The *header* and *payload* are then hashed to optain a **document ID**. -This *document ID* is unique and is used in *Merkle Trees*. This can allow many optimisations, -such as storing only the *Merkle Tree* and being able to prove a given document is included in -it or not. Then *signatures* are made on this **document ID**. - -Since the *document ID* is not affected by *signatures*, they are not affected by *signature malleability*. - -> See the block structure for more information about Merkle Trees usage. +The *header* and *payload* are hashed to optain a **document ID**, then *signatures* are made from it. The header is composed of : @@ -158,16 +151,15 @@ The header is composed of : | *4 bytes* | Magic value : `0xDAE2D598` | *2 bytes* | Currency code | *2 bytes* | Document type +| *2 bytes* | Payload size in bytes +| *2 bytes* | Number of issuers +| ... | Issuers *complete public keys* with alignement padding for each > The magic value has been choosed randomly and contains data with low probability to find in UTF-8 text. -The issuer part is composed of : -| Size | Data | -|:----:|:-----| -| *2 bytes* | Number of issuers -| ... | Issuers *complete public keys* with alignement padding for each +Payload and each signatures have alignement padding. -Signature cryptographic types are not defined and use the matching public key types. +Signatures cryptographic types are not defined and use the matching public key types. A document is valid if each public key can match a signature (with 0 bytes left and no overflows) and each signature is valid for the document content.