Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow for multiple inputs/outputs in prepare_transaction and fulfill_transaction #249

Open
TimDaub opened this issue Feb 2, 2017 · 2 comments

Comments

@TimDaub
Copy link
Contributor

TimDaub commented Feb 2, 2017

Currently it is the following:

In [14]: cid = 0

In [15]: condition = creation_tx['transaction']['conditions'][cid]

In [16]: transfer_input = {
   ....:     'fulfillment': condition['condition']['details'],
   ....:     'input': {
   ....:          'cid': cid,
   ....:          'txid': creation_tx['id'],
   ....:      },
   ....:      'owners_before': condition['owners_after'],
   ....: }
   ....: 

In [17]: prepared_transfer_tx = bdb.transactions.prepare(
   ....:     operation='TRANSFER',
   ....:     asset=creation_tx['transaction']['asset'],
   ....:     inputs=transfer_input,
   ....:     owners_after=bob.verifying_key,
   ....: )
   ....: 

while it could be simply:
prepared_transfer_tx = bdb.transactions.prepare_transfer(input_tx, output_id, owners_after, metadata)
Notice that the operation, transfer_input, asset are all derived from the input_tx (full transaction, not only the tx_id). The complex transfer_input object is legacy of the common code, but can easily be abstracted away in the driver until the common code is fixed

@sbellem
Copy link
Contributor

sbellem commented Feb 7, 2017

Can't we have transactions for which the inputs are composed of outputs from different "input transactions"?

@TimDaub
Copy link
Contributor Author

TimDaub commented Sep 21, 2017

Might be interesting to see how @iredjee is solving it in the js driver:
bigchaindb/js-bigchaindb-driver#98

@TimDaub TimDaub changed the title prepare_transfer method Allow for multiple inputs/outputs in prepare_transaction and fulfill_transaction Sep 21, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants