Skip to content

Problem: no easy ORM for CRUD/CRAB #455

Open
@diminator

Description

@diminator
  • 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...

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions