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

Problem: no easy ORM for CRUD/CRAB #455

Open
diminator opened this issue Jun 21, 2018 · 2 comments
Open

Problem: no easy ORM for CRUD/CRAB #455

diminator opened this issue Jun 21, 2018 · 2 comments

Comments

@diminator
Copy link
Contributor

  • bigchaindb-driver version: 0.5.0
  • bigchaindb server version (bigchaindb -v):
  • Python version: 3
  • Operating System: linux

Description

Simple operations like

  • create
  • retrieve
  • update
  • burn

create and retrieve are quite easy to use, but update/transfer is very convoluted.
From the docs:

txid = fulfilled_creation_tx['id']

asset_id = txid

transfer_asset = {
    'id': asset_id
}

output_index = 0
output = fulfilled_creation_tx['outputs'][output_index]

transfer_input = {
    'fulfillment': output['condition']['details'],
    'fulfills': {
        'output_index': output_index,
        'transaction_id': fulfilled_creation_tx['id']
    },
    'owners_before': output['public_keys']
}

prepared_transfer_tx = bdb.transactions.prepare(
    operation='TRANSFER',
    asset=transfer_asset,
    inputs=transfer_input,
    recipients=bob.public_key,
)

fulfilled_transfer_tx = bdb.transactions.fulfill(
    prepared_transfer_tx,
    private_keys=alice.private_key,
)

sent_transfer_tx = bdb.transactions.send_commit(fulfilled_transfer_tx)

There are many moving parts where things can go wrong. I would expect a simple ORM syntax will drive adoption.

The js-driver-orm is a good starting point for this...

@vrde
Copy link
Contributor

vrde commented Jun 21, 2018

@diminator thanks for opening this issue. I definitely agree with you, we need to make this operations "primitives" of the system. I think it's time to write a BEP.

@diminator
Copy link
Contributor Author

I think it's time to write a BEP.

yes, it's time :)

@jernejpregelj jernejpregelj removed their assignment Oct 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants