bigchaindb-driver
bigchaindb-driver copied to clipboard
Problem: no easy ORM for CRUD/CRAB
- 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...
@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.
I think it's time to write a BEP.
yes, it's time :)