Created
December 30, 2016 17:00
-
-
Save josephwinston/5ae12386bb02629bf2c46ca121637e37 to your computer and use it in GitHub Desktop.
Invalid transaction schema
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## docker pull bigchaindb/bigchaindb | |
## docker run --rm -v "$HOME/bigchaindb_docker:/data" -ti bigchaindb/bigchaindb -y configure | |
## docker run -v "$HOME/bigchaindb_docker:/data" -d --name bigchaindb -p "58080:8080" -p "59984:9984" bigchaindb/bigchaindb start | |
## docker-machine ip bigchaindb | |
from bigchaindb_driver import BigchainDB | |
bdb = BigchainDB('http://192.168.99.100:59984/api/v1') # From docker-machine ip bigchaindb and docker ps | |
bicycle = { | |
'data': | |
{ | |
'bicycle': | |
{ | |
'serial_number': 'abcd1234', | |
'manufacturer': 'bkfab', | |
}, | |
}, | |
} | |
metadata = { 'planet': 'earth'} | |
from bigchaindb_driver.crypto import generate_keypair | |
alice, bob = generate_keypair(), generate_keypair() | |
prepared_creation_tx = bdb.transactions.prepare(operation='CREATE', | |
owners_before=alice.verifying_key, | |
asset=bicycle, | |
metadata=metadata) | |
fulfilled_creation_tx = bdb.transactions.fulfill(prepared_creation_tx, | |
private_keys=alice.signing_key) | |
print ('fulfilled_creation_tx=', fulfilled_creation_tx) | |
txid = fulfilled_creation_tx['id'] | |
print ('txid="%s"' % txid) | |
sent_creation_tx = bdb.transactions.send(fulfilled_creation_tx) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment