diff --git a/docs/server/source/data-models/asset-model.md b/docs/server/source/data-models/asset-model.md index 312c6765..eefa81bb 100644 --- a/docs/server/source/data-models/asset-model.md +++ b/docs/server/source/data-models/asset-model.md @@ -1,21 +1,20 @@ -# The Digital Asset Model +# The Asset Model -To avoid redundant data in transactions, the digital asset model is different for `CREATE` and `TRANSFER` transactions. +To avoid redundant data in transactions, the asset model is different for `CREATE` and `TRANSFER` transactions. -A digital asset's properties are defined in a `CREATE` transaction with the following model: +In a `CREATE` transaction, the `"asset"` must contain exactly one key-value pair. The key must be `"data"` and the value can be any valid JSON document, or `null`. For example: ```json { - "data": "" + "data": { + "desc": "Gold-inlay bookmark owned by Xavier Bellomat Dickens III", + "xbd_collection_id": 1857 + } } ``` -For `TRANSFER` transactions we only keep the asset ID: +In a `TRANSFER` transaction, the `"asset"` must contain exactly one key-value pair. They key must be `"id"` and the value must contain a transaction ID (i.e. a SHA3-256 hash: the ID of the `CREATE` transaction which created the asset, which also serves as the asset ID). For example: ```json { - "id": "" + "id": "38100137cea87fb9bd751e2372abb2c73e7d5bcf39d940a5516a324d9c7fb88d" } ``` - - -- `id`: The ID of the `CREATE` transaction that created the asset. -- `data`: A user supplied JSON document with custom information about the asset. Defaults to null. diff --git a/docs/server/source/data-models/index.rst b/docs/server/source/data-models/index.rst index 1e8b81c3..ccb36f3c 100644 --- a/docs/server/source/data-models/index.rst +++ b/docs/server/source/data-models/index.rst @@ -3,7 +3,7 @@ Data Models BigchainDB stores all data in the underlying database as JSON documents (conceptually, at least). There are three main kinds: -1. Transactions, which contain digital assets, inputs, outputs, and other things +1. Transactions, which contain assets, inputs, outputs, and other things 2. Blocks 3. Votes diff --git a/docs/server/source/data-models/transaction-model.rst b/docs/server/source/data-models/transaction-model.rst index cc548aa9..c0eaa30b 100644 --- a/docs/server/source/data-models/transaction-model.rst +++ b/docs/server/source/data-models/transaction-model.rst @@ -25,14 +25,16 @@ A transaction has the following structure: "inputs": [""], "outputs": [""], "operation": "", - "asset": "", + "asset": "", "metadata": "" } Here's some explanation of the contents of a :ref:`transaction `: -- id: The :ref:`id ` of the transaction, and also the database primary key. -- version: :ref:`Version ` number of the transaction model, so that software can support different transaction models. +- **id**: The :ref:`id ` of the transaction, and also the database primary key. + +- **version**: :ref:`Version ` number of the transaction model, so that software can support different transaction models. + - **inputs**: List of inputs. Each :ref:`input ` contains a pointer to an unspent output and a *crypto fulfillment* that satisfies the conditions of that output. A *fulfillment* is usually a signature proving the ownership of the asset. @@ -43,7 +45,7 @@ Here's some explanation of the contents of a :ref:`transaction `: - **operation**: String representation of the :ref:`operation ` being performed (currently either "CREATE", "TRANSFER" or "GENESIS"). It determines how the transaction should be validated. -- **asset**: Definition of the digital :ref:`asset `. See next section. +- **asset**: Definition of the :ref:`asset `. See :ref:`the page about the asset model `. - **metadata**: User-provided transaction :ref:`metadata `: Can be any JSON document, or `NULL`.