用于BSN(区块链服务网络)的SDK

bsn-sdk的Python项目详细描述


BSN Python SDK

Author: 李大狗Leeduckgo

Org: 上海对外经贸大学·人工智能与变革管理学院·区块链技术与应用研究中心

bsn-python-sdk is a Python library for communicating with Blockchain Service Network, It is used for building blockchain Apps with BSN.

It provides:

  • 5 APIs ( create, update, query, delete, get_history ) abount default chainCode in BSN.

bsn-python-sdk 是一个用于和 BSN 区块链服务网络相联系的 Python 库,其被用于构建和 BSN 相关的 区块链 App。

它目前提供:

  • 包含「增、减、查、改、查询历史记录」的默认链码包中的五个接口的调用。

Installing

Install and update using pip:

pip3 install bsn-sdk

A Simple Example

frombsn_sdkimportOperator# user_code, app_code, chain_code, url and cert_pathop=Operator("reddate","CL1851016378620191011150518","cc_base","https://quanzhounode.bsngate.com:17602/api/node/reqChainCode","./certificate")# save_datares=op.save_data("leeduckgo5","test")# res = {'success': True, 'payload': {'txId': 'c69af29cc00c68456b9e6fe9013f8e4f15ed6e09e3b2250ae3561b9a122ec509', 'context': None}}# get_datares=op.get_data("leeduckgo5")# {'success': True, 'payload': {'txId': '92b61460a31d323d54121c25fced24cacc5102b309f310044ad6b36f42bf05a6', 'context': 'test'}}# update_datares=op.update_data("leeduckgo5","testtest")# {'success': True, 'payload': {'txId': 'abfe9ee4628efc07086fb81a5b37ef5126898f042868c3d9fade7a7d316ec613', 'context': 'SUCCESS'}}# delete_datares=op.delete_data("leeduckgo5")# {'success': True, 'payload': {'txId': '1b0f298004c9a617ed84dfd4bb989ed03f46e6676668cccfb3bd23117fcd6356', 'context': 'SUCCESS'}}# get_historyres=op.get_history("leeduckgo5"){'success':True,'payload':{'txId':'3ec3174424070b04311af22e0694bba6e099821090cb761a7fae60ce89ef29d4','context':[{'txId':'c69af29cc00c68456b9e6fe9013f8e4f15ed6e09e3b2250ae3561b9a122ec509','dataInfo':'{"BaseKey":"leeduckgo5","BaseInfo":"test"}','txTime':'2020-01-22 13:18:37','isDelete':False},{'txId':'abfe9ee4628efc07086fb81a5b37ef5126898f042868c3d9fade7a7d316ec613','dataInfo':'{"BaseKey":"leeduckgo5","BaseInfo":"testtest"}','txTime':'2020-01-22 13:20:03','isDelete':False},{'txId':'1b0f298004c9a617ed84dfd4bb989ed03f46e6676668cccfb3bd23117fcd6356','dataInfo':'','txTime':'2020-01-22 13:22:21','isDelete':True}]}}

Plan

It will supported more chainCode next( ´Д`)y━・.

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

推荐PyPI第三方库


热门话题
java如何获取所有链接并使用SeleniumWebDriver逐个单击这些链接   java中数组列表的arraylist移位元素   java如何存储具有不同类型参数的元素   java不能使用List<Future<?>>当从不同位置调用时,在方法参数中   java我应该如何修复代码以避免测试代码出错?   安卓 PreferenceFragment java。lang.RuntimeException   java在运行emulator时发现错误   java取消多个AsyncTask回调的有效方法是什么?如果中途满足条件,这些回调将在将来返回?   有没有办法在运行时将方法动态分配给Java类?   java如何将propertyfile与GlassFish一起使用   如何在PHP中使用bcrypt对密码进行哈希处理?   Java和UDP web服务器   java JPA允许EntityListeners执行JPA操作吗?   java执行do while语句时不会产生错误   java无法在edittext中显示数据库中的数据   java Tomcat中活动会话的数量   java在何处使用@SuppressWarnings(“requestfactory”)   netty连接中的java HornetQ异常