BigChainDB的Python驱动程序
bigchaindb-driver的Python项目详细描述
BigChainDB Python驱动程序
- 免费软件:apache软件许可证2.0
- 查看我们的 文档
目录
-
bigchanidb python驱动程序
- 功能
- 安装
- bigchainDB文档
- 用法
- 兼容性矩阵
- 许可证
- 学分
-
更改日志
- 0.6.2(2018-11-03)
- 0.6.1(2018-10-21)
- 0.6.0(2018-10-20)
- 0.5.3(2018-09-12)
- 0.5.2(2018-08-31)
- 0.5.1(2018-08-23)
-
0.5.0(2018-06-14)
- 添加了
- 已弃用
- 0.5.0a4(2018-05-07)
- 0.5.0a2(2018-04-18)
- 0.5.0a1(2018-04-03)
- 0.4.1(2017-08-02)
- 0.4.0(2017-07-05)
- 0.3.0(2017-06-23)
-
0.2.0(2017-02-06)
- 添加了
- 已更改
-
0.1.0(2016-11-29)
- 添加了
- 已删除
-
0.0.3(2016-11-25)
- 添加了
- 已弃用
- 已修复
- 0.0.2(2016-10-28)
-
0.0.1dev1(2016-08-25)
- 添加了
- 0.0.1a1(2016-08-12)
功能
- 支持准备、实现事务并将事务发送到bigchanidb 节点,
- 按ID检索事务。
安装
下面的说明是在ubuntu 16.04lts上测试的。它们还应该在其他linux发行版和macos上工作。驱动程序也可以在windows上运行,但我们不能保证。我们建议在那里设置一个ubuntu虚拟机(例如,通过windows上的docker)。
我们建议您使用虚拟环境安装并使用 pip (或 pip3 )更新到最新的稳定版本:
pip install -U bigchaindb-driver
它将安装最新的稳定bigchanidb python驱动程序。如果您想安装一个alpha、beta或rc版本的python驱动程序,请使用如下内容:
pip install -U bigchaindb_driver==0.5.0a4
以上命令将安装0.5.0a4版(alpha 4)。您可以在pypi上的release history页面中找到所有版本的列表。
有关如何安装驱动程序的详细信息,请参见快速启动
BigChainDB文档
用法
示例:为爱丽丝创建一个可分割的资产,爱丽丝向鲍勃颁发10个代币,以便他可以使用她的游戏男孩。 之后,鲍勃花掉了其中的3个代币。
如果要发送事务,则需要确定bigchaindb根url
# import BigchainDB and create an objectfrombigchaindb_driverimportBigchainDBbdb_root_url='https://example.com:9984'bdb=BigchainDB(bdb_root_url)# generate a keypairfrombigchaindb_driver.cryptoimportgenerate_keypairalice,bob=generate_keypair(),generate_keypair()# create a digital asset for Alicegame_boy_token={'data':{'token_for':{'game_boy':{'serial_number':'LR35902'}},'description':'Time share token. Each token equals one hour of usage.',},}# prepare the transaction with the digital asset and issue 10 tokens for Bobprepared_token_tx=bdb.transactions.prepare(operation='CREATE',signers=alice.public_key,recipients=[([bob.public_key],10)],asset=game_boy_token)# fulfill and send the transactionfulfilled_token_tx=bdb.transactions.fulfill(prepared_token_tx,private_keys=alice.private_key)bdb.transactions.send_commit(fulfilled_token_tx)# Use the tokens# create the output and inout for the transactiontransfer_asset={'id':fulfilled_token_tx['id']}output_index=0output=fulfilled_token_tx['outputs'][output_index]transfer_input={'fulfillment':output['condition']['details'],'fulfills':{'output_index':output_index,'transaction_id':transfer_asset['id']},'owners_before':output['public_keys']}# prepare the transaction and use 3 tokensprepared_transfer_tx=bdb.transactions.prepare(operation='TRANSFER',asset=transfer_asset,inputs=transfer_input,recipients=[([alice.public_key],3),([bob.public_key],7)])# fulfill and send the transactionfulfilled_transfer_tx=bdb.transactions.fulfill(prepared_transfer_tx,private_keys=bob.private_key)sent_transfer_tx=bdb.transactions.send_commit(fulfilled_transfer_tx)
兼容矩阵
<表> < COLGROUP > < COL/> < COL/> <广告> BigChainDB服务器 BigChainDB驱动程序 < /广告> <正文> >;=2.0.0b7 0.6.2 >;=2.0.0b7 0.6.1 >;=2.0.0b7 0.6.0 >;=2.0.0b5 0.5.3 >;=2.0.0b5 0.5.2 >;=2.0.0b5 0.5.1 >;=2.0.0b1 0.5.0 >;=2.0.0a3 0.5.0a4 >;=2.0.0a2 0.5.0a2 >;=2.0.0a1 0.5.0a1 >;=1.0.0 0.4.x ==1.0.0rc1 0.3.x >;=0.9.1 0.2.x >;=0.8.2 >;=0.1.3 < > <表>尽管我们尽力保持主分支的同步,但是 偶尔延误。
积分
这个包最初是使用cookiecutter和项目模板创建的。此后,许多bigchaindb开发人员都做出了贡献。