59

GitHub - UlordChain/Ulord-Sidechain-SDK: the python SDK of the Ulord-Sidechain

 7 years ago
source link: https://github.com/UlordChain/Ulord-Sidechain-SDK
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

readme.md

Ulord - SideChain - SDK

快速开始

  1. 下载项目

  2. 准备一个有币的账户。

如果账户没有币,我们提供了一些测试账户,不定期往里面转一些测试币。
钱包文件地址
密码统一为12345678

  1. 到项目根目录下安装依赖包:
pip install -r requirements.txt
  1. 运行程序
python3 main.py
# 查看帮助文档
> help

功能介绍

  • 打印帮助信息

help

  • 退出

exit

  • 创建新钱包

creat_wallet

  • 重新加载私钥文件和密码

login_by_key_file

  • 重新加载私钥

login_by_private_key

  • 获取侧链余额

get_gas_balance

  • 交易gas

transfer_gas

  • 多地址结算

transfer_tokens


UDFS

  • 修改udfs的ip

set_udfs_ip

  • 从udfs上下载文件

downloadhash

  • 上传文件获取hash值

upload


部署一套新的Ushare合约

请阅读相关文档后再部署合约。

  • 部署Ushare合约> deploy_contract

合约调用

  • 调用合约

contract 合约名 函数名 参数

  • 也可以简写为 合约名 函数名 参数
  • 获取交易回执

get_receipt

  • 获取上次合约调用的详细信息

get_last_receipt

例如

  • Token balanceOf 0x...
  • contract transfer 0x... 100
  • AuthorModule publish 0x... 20 1

使用场景

翻阅[合约API]了解合约功能

  1. 使用deploy_contract命令一键部署。
  2. Token transfer [0x...] [100]转币
  3. upload [filepath]上传一个文件,获得UDFS
  4. AuthorModule publish [UDFS] [20] [1] 发布一个资源,获得一个资源id
  5. 其他用户A UserModule buy [资源id]购买一个资源,获得UDFS
  6. 其他用户A downloadhash [UDFS],下载该资源。

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK