From f6ebba8389a40f9458a27f8b5a1a9ef8d47f1524 Mon Sep 17 00:00:00 2001 From: Troy McConaghy Date: Thu, 16 Feb 2017 09:52:00 +0100 Subject: [PATCH 1/2] docs: clarified how block id & signature are calculated --- docs/server/source/data-models/block-model.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/server/source/data-models/block-model.rst b/docs/server/source/data-models/block-model.rst index e2e3b418..889dc50f 100644 --- a/docs/server/source/data-models/block-model.rst +++ b/docs/server/source/data-models/block-model.rst @@ -17,7 +17,7 @@ A block has the following structure: } -- ``id``: The hash of the serialized ``block`` (i.e. the ``timestamp``, ``transactions``, ``node_pubkey``, and ``voters``). This is also a database primary key; that's how we ensure that all blocks are unique. +- ``id``: The :ref:`hash ` of the serialized inner ``block`` (i.e. the ``timestamp``, ``transactions``, ``node_pubkey``, and ``voters``). It's used as a unique index in the database backend (e.g. RethinkDB or MongoDB). - ``block``: - ``timestamp``: The Unix time when the block was created. It's provided by the node that created the block. @@ -27,7 +27,7 @@ A block has the following structure: It's the list of federation nodes which can cast a vote on this block. This list can change from block to block, as nodes join and leave the federation. -- ``signature``: Cryptographic signature of the block by the node that created the block. (To create the signature, the node serializes the block contents and signs it with its private key.) +- ``signature``: :ref:`Cryptographic signature ` of the block by the node that created the block. To generate the signature, the node builds a dict including the ``id``, the inner ``block`` & the ``signature`` (with a value of ``None``), it serializes that dict, and then signs *that* with its private key. Working with Blocks From 87f677d76e2e21b1295d83a6c7ece276938dfa0b Mon Sep 17 00:00:00 2001 From: Troy McConaghy Date: Tue, 21 Feb 2017 14:20:14 +0100 Subject: [PATCH 2/2] docs: correction to explanation of block signature calc. --- docs/server/source/data-models/block-model.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/server/source/data-models/block-model.rst b/docs/server/source/data-models/block-model.rst index 889dc50f..3c94fca1 100644 --- a/docs/server/source/data-models/block-model.rst +++ b/docs/server/source/data-models/block-model.rst @@ -27,7 +27,7 @@ A block has the following structure: It's the list of federation nodes which can cast a vote on this block. This list can change from block to block, as nodes join and leave the federation. -- ``signature``: :ref:`Cryptographic signature ` of the block by the node that created the block. To generate the signature, the node builds a dict including the ``id``, the inner ``block`` & the ``signature`` (with a value of ``None``), it serializes that dict, and then signs *that* with its private key. +- ``signature``: :ref:`Cryptographic signature ` of the block by the node that created the block (i.e. the node with public key ``node_pubkey``). To generate the signature, the node signs the serialized inner ``block`` (the same thing that was hashed to determine the ``id``) using the private key corresponding to ``node_pubkey``. Working with Blocks