Alice and Bob are represented by public/private key pairs. The private key is
used to sign transactions, meanwhile the public key is used to verify that a
signed transaction was indeed signed by the one who claims to be the signee.

This will return the block height containing the transaction. If the transaction is not in any block then None is
returned. If it is None it can have different reasons for example the transaction was not valid or is still in the
queue and you can try again later. If the transaction was invalid or could not be sent an exception is raised.

If we want to see the whole block we can use the block height to retrieve the block itself.

# Retrieve the block that contains the transaction>>>block=bdb.blocks.retrieve(str(block_height))

Imagine some time goes by, during which Alice is happy with her bicycle, and
one day, she meets Bob, who is interested in acquiring her bicycle. The timing
is good for Alice as she had been wanting to get a new bicycle.

To transfer the bicycle (asset) to Bob, Alice must consume the transaction in
which the Bicycle asset was created.

Alice could retrieve the transaction:

>>> creation_tx=bdb.transactions.retrieve(txid)

or simply use fulfilled_creation_tx:

In [16]: creation_tx=fulfilled_creation_tx

In order to prepare the transfer transaction, we first need to know the id of
the asset we’ll be transferring. Here, because Alice is consuming a CREATE
transaction, we have a special case in that the asset id is NOT found on the
asset itself, but is simply the CREATE transaction’s id:

You might have noticed that we considered Alice’s case of consuming a
CREATE transaction as a special case. In order to obtain the asset id
of a CREATE transaction, we had to use the CREATE transaction’s
id:

transfer_asset_id=create_tx['id']

If you instead wanted to consume TRANSFER transactions (for example,
fulfilled_transfer_tx), you could obtain the asset id to transfer from
the asset['id'] property:

All assets in BigchainDB become implicitly divisible if a transaction contains
more than one of that asset (we’ll see how this happens shortly).

Let’s continue with the bicycle example. Bob is now the proud owner of the
bicycle and he decides he wants to rent the bicycle. Bob starts by creating a
time sharing token in which one token corresponds to one hour of riding time:

The method .send will be deprecated in the next release of the driver, please use .send_commit, .send_sync, or .send_async instead. More info

Note

Defining recipients:

To create divisible assets, we need to specify an amount >1 together
with the public keys. The way we do this is by passing a list of
tuples in recipients where each tuple corresponds to an output.

For instance, instead of creating a transaction with one output containing
amount=10 we could have created a transaction with two outputs each
holding amount=5:

recipients=[([carly.public_key],5),([carly.public_key],5)]

The reason why the addresses are contained in lists is because each
output can have multiple recipients. For instance, we can create an
output with amount=10 in which both Carly and Alice are recipients
(of the same asset):