SDK for BSN(Blockchain Service Network)
Project description
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
from bsn_sdk import Operator
# user_code, app_code, chain_code, url and cert_path
op = Operator("reddate", "CL1851016378620191011150518", "cc_base", "https://quanzhounode.bsngate.com:17602/api/node/reqChainCode", "./certificate")
# save_data
res = op.save_data("leeduckgo5","test")
# res = {'success': True, 'payload': {'txId': 'c69af29cc00c68456b9e6fe9013f8e4f15ed6e09e3b2250ae3561b9a122ec509', 'context': None}}
# get_data
res = op.get_data("leeduckgo5")
# {'success': True, 'payload': {'txId': '92b61460a31d323d54121c25fced24cacc5102b309f310044ad6b36f42bf05a6', 'context': 'test'}}
# update_data
res = op.update_data("leeduckgo5", "testtest")
# {'success': True, 'payload': {'txId': 'abfe9ee4628efc07086fb81a5b37ef5126898f042868c3d9fade7a7d316ec613', 'context': 'SUCCESS'}}
# delete_data
res = op.delete_data("leeduckgo5")
# {'success': True, 'payload': {'txId': '1b0f298004c9a617ed84dfd4bb989ed03f46e6676668cccfb3bd23117fcd6356', 'context': 'SUCCESS'}}
# get_history
res = 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━・.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
bsn-sdk-0.1.3.tar.gz
(5.2 kB
view details)
File details
Details for the file bsn-sdk-0.1.3.tar.gz.
File metadata
- Download URL: bsn-sdk-0.1.3.tar.gz
- Upload date:
- Size: 5.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.7.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2551a482e6cf56145a0586754c55e867c67c5a1467fecc5a02ac984523de975b
|
|
| MD5 |
7d955a2b528a57f9e5ff5b6946e2d0ff
|
|
| BLAKE2b-256 |
ffd1dc2fc0951b685a87d077145b32e54c4709cb783ddc2a707c4acbe8506460
|