Skip to content

Commit

Permalink
include BigchainDB2.0 in README
Browse files Browse the repository at this point in the history
  • Loading branch information
manolodewiner committed Apr 3, 2018
1 parent 7699e14 commit 9023d06
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 48 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
| `0.10` | `0.1.x` |
| `1.0.0` | `0.3.x` |
| `>= 1.3.0` | `3.x.x` |
| `>= 2.0.0` | `4.x.x` |

## Breaking changes
Version 3.2 of BigchainDB JavaScript Driver introduces a new way of creating transfer transactions. Check [older versions](https://docs.bigchaindb.com/projects/js-driver/en/latest/readme.html#features)
Expand Down
94 changes: 46 additions & 48 deletions docs/source/readme.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,70 +44,68 @@ Compatibility Matrix
Older versions
--------------------

#### Versions 4.x.x
**Version 4.x.x**

As part of the changes in the BigchainDB 2.0 server, some endpoint were
modified. In order to be consistent with them, the JS driver does not have
anymore the `pollStatusAndFetchTransaction()` method as there are three
different ways of posting a transaction.
- `async` using the `postTransaction`: the response will return immediately and not wait to see if the transaction is valid.
- `sync` using the `postTransactionSync`: the response will return after the transaction is validated.
- `commit` using the `postTransactionCommit`: the response will return after the transaction is committed to a block.

By default in the docs we will use the `postTransactionCommit` as is way of
being sure that the transaction is validated and commited to a block, so
there will not be any issue if you try to transfer the asset immediately.

As part of the changes in the BigchainDB 2.0 server, some endpoint were
modified. In order to be consistent with them, the JS driver does not have
anymore the `pollStatusAndFetchTransaction()` method as there are three
different ways of posting a transaction.
- `async` using the `postTransaction`: the response will return immediately and not wait to see if the transaction is valid.
- `sync` using the `postTransactionSync`: the response will return after the transaction is validated.
- `commit` using the `postTransactionCommit`: the response will return after the transaction is committed to a block.

By default in the docs we will use the `postTransactionCommit` as is way of
being sure that the transaction is validated and commited to a block, so
there will not be any issue if you try to transfer the asset immediately.
**Version 3.2.x**

For versions below 3.2, a transfer transaction looked like:

#### Versions 3.2.x
.. code-block:: js
For versions below 3.2, a transfer transaction looked like:
const createTranfer = BigchainDB.Transaction.makeTransferTransaction(
txCreated,
metadata, [BigchainDB.Transaction.makeOutput(
BigchainDB.Transaction.makeEd25519Condition(alice.publicKey))],
0
)
.. code-block:: js
const createTranfer = BigchainDB.Transaction.makeTransferTransaction(
txCreated,
metadata, [BigchainDB.Transaction.makeOutput(
BigchainDB.Transaction.makeEd25519Condition(alice.publicKey))],
0
)
const signedTransfer = BigchainDB.Transaction.signTransaction(createTranfer,
keypair.privateKey)
const signedTransfer = BigchainDB.Transaction.signTransaction(createTranfer,
keypair.privateKey)
In order to upgrade and do it compatible with the new driver version, this
transaction should be now:
In order to upgrade and do it compatible with the new driver version, this
transaction should be now:

.. code-block:: js
.. code-block:: js
const createTranfer = BigchainDB.Transaction.makeTransferTransaction(
[{ tx: txCreated, output_index: 0 }],
[BigchainDB.Transaction.makeOutput(
BigchainDB.Transaction.makeEd25519Condition(alice.publicKey))],
metaData
)
const createTranfer = BigchainDB.Transaction.makeTransferTransaction(
[{ tx: txCreated, output_index: 0 }],
[BigchainDB.Transaction.makeOutput(
BigchainDB.Transaction.makeEd25519Condition(alice.publicKey))],
metaData
)
const signedTransfer = BigchainDB.Transaction.signTransaction(createTranfer,
keypair.privateKey)
const signedTransfer = BigchainDB.Transaction.signTransaction(createTranfer,
keypair.privateKey)
The upgrade allows to create transfer transaction spending outputs that belong
to different transactions. So for instance is now possible to create a transfer
transaction spending two outputs from two different create transactions:
The upgrade allows to create transfer transaction spending outputs that belong
to different transactions. So for instance is now possible to create a transfer
transaction spending two outputs from two different create transactions:


.. code-block:: js
.. code-block:: js
const createTranfer = BigchainDB.Transaction.makeTransferTransaction(
[{ tx: txCreated1, output_index: 0 },
{ tx: txCreated2, output_index: 0}],
[BigchainDB.Transaction.makeOutput(
BigchainDB.Transaction.makeEd25519Condition(alice.publicKey))],
metaData
)
const createTranfer = BigchainDB.Transaction.makeTransferTransaction(
[{ tx: txCreated1, output_index: 0 },
{ tx: txCreated2, output_index: 0}],
[BigchainDB.Transaction.makeOutput(
BigchainDB.Transaction.makeEd25519Condition(alice.publicKey))],
metaData
)
const signedTransfer = BigchainDB.Transaction.signTransaction(createTranfer,
keypair.privateKey)
const signedTransfer = BigchainDB.Transaction.signTransaction(createTranfer,
keypair.privateKey)

0 comments on commit 9023d06

Please sign in to comment.