From 89661a9979c85b775c22f28fa3e7854ff919adc0 Mon Sep 17 00:00:00 2001 From: "Elad-PC\\elad" Date: Wed, 3 Aug 2016 06:34:16 +0200 Subject: [PATCH] moved transaction version inside the tx object that gets hashed moved the transaction version (currently fixed to 1.0) from the outer "transaction" object to the inside part, where it will get hashed together with the rest of the transaction. updated docs accordingly. --- bigchaindb/util.py | 4 ++-- docs/source/topic-guides/models.md | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bigchaindb/util.py b/bigchaindb/util.py index 8492cc81..9e08b415 100644 --- a/bigchaindb/util.py +++ b/bigchaindb/util.py @@ -169,8 +169,8 @@ def create_tx(current_owners, new_owners, inputs, operation, payload=None): Reference: { "id": "", - "version": "transaction version number", "transaction": { + "version": "transaction version number", "fulfillments": [ { "current_owners": ["list of "], @@ -278,6 +278,7 @@ def create_tx(current_owners, new_owners, inputs, operation, payload=None): }) tx = { + 'version': 1, 'fulfillments': fulfillments, 'conditions': conditions, 'operation': operation, @@ -291,7 +292,6 @@ def create_tx(current_owners, new_owners, inputs, operation, payload=None): # create the transaction transaction = { 'id': tx_hash, - 'version': 1, 'transaction': tx } diff --git a/docs/source/topic-guides/models.md b/docs/source/topic-guides/models.md index c130ce83..8e0add9d 100644 --- a/docs/source/topic-guides/models.md +++ b/docs/source/topic-guides/models.md @@ -58,8 +58,8 @@ Assets can be mutable (changeable) or immutable. To change a mutable asset, you ```json { "id": "", - "version": "", "transaction": { + "version": "", "fulfillments": [""], "conditions": [""], "operation": "", @@ -75,8 +75,8 @@ Assets can be mutable (changeable) or immutable. To change a mutable asset, you Here's some explanation of the contents of a transaction: - `id`: The hash of everything inside the serialized `transaction` body (i.e. `fulfillments`, `conditions`, `operation`, `timestamp` and `data`; see below), with one wrinkle: for each fulfillment in `fulfillments`, `fulfillment` is set to `null`. The `id` is also the database primary key. -- `version`: Version number of the transaction model, so that software can support different transaction models. - `transaction`: + - `version`: Version number of the transaction model, so that software can support different transaction models. - `fulfillments`: List of fulfillments. Each _fulfillment_ contains a pointer to an unspent asset and a _crypto fulfillment_ that satisfies a spending condition set on the unspent asset. A _fulfillment_ is usually a signature proving the ownership of the asset.