BigChainDB的Python驱动程序

bigchaindb-driver的Python项目详细描述


BigChainDB Python驱动程序

  • 免费软件:apache软件许可证2.0
  • 查看我们的 文档

功能

  • 支持准备、实现事务并将事务发送到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页面中找到所有版本的列表。

有关如何安装驱动程序的详细信息,请参见快速启动

用法

示例:为爱丽丝创建一个可分割的资产,爱丽丝向鲍勃颁发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开发人员都做出了贡献。

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java日期对象如何增加星期几   java同一类的两个版本(一个是静态的,一个是非静态的)   azure缺少ApplicationInsightsJava和Spring Boot 2.3.0的日志   java为什么JBoss EAP无法启动?   Java如何使用enum收集类?   Java FX 3D:不遵守其Z坐标的对象   mysql如何部署在internet上作为服务器运行的java应用程序?   java以编程方式滚动到Vaadin应用程序中的组件   java Maven发布插件跳过执行但不准备的测试   java如何使用Mockito模拟Spring ApplicationContext的getBean方法,用TestNG编写单元测试?   java如何实现Android细节通知?   java Spring引导:检查资源是否在过滤器级别有注释   java应用程序在使用安装了ACTION\u MEDIA\u的sendBroadcast时会失去焦点   java将T[](其中T是字节[])返回到字节[]   如何使用Java创建文件上传的代理服务器?   java指向同一活动的两个按钮   javascript是否将自定义对象的映射转换为json对象?