Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
test
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
谢昇
test
Commits
4c79b234
Commit
4c79b234
authored
May 29, 2019
by
谢昇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add new file
parent
919dbd80
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
386 additions
and
0 deletions
+386
-0
CLI独立模块命令.md
CLI独立模块命令.md
+386
-0
No files found.
CLI独立模块命令.md
0 → 100644
View file @
4c79b234
# 部分功能性模块使用流程
# 部分功能性模块使用流程
## userdata模块 发送文件
测试链中测试时,需要将cmd
\w
rite
\w
rite.toml中的发送地址修改为自己的地址,并编译write.go后,运行write.exe
构造:
cli exec userdata -d "内容" -e user.write -t "标题"
```
返回note
```
※ -e后接的执行器必须以user.开头
返回得到的note,需要将该note以备注的形势,发送coins交易,并将to的地址指定为设定的地址后,签名发送
使用一步交易命令:
cli send bty transfer -a 1 -t write.go中设置的地址 -n 返回的note -k 私钥or地址签名
```
返回交易哈希
```
※ -a后设置的金额须不下于1
发送后在write.exe中返回哈希,可使用该哈希查询得到发送的内容。
## 隐私交易
## tx group 构建交易组
即原子交易,将多个交易捆绑,若其中有任意一笔交易失败,则整个交易组所有交易失败。交易手续费由第一笔的交易的地址统一扣除。
首先构建多个交易:
cli bty transfer -t 地址A
```
返回字符串A1
```
cli bty transfer -t 地址B
```
返回字符串A2
```
将两个交易组成交易组:
cli bty txgroup -t "字符串A1 字符串A2"
```
返回字符串A3
```
签名,需根据index指定签名
cli wallet sign -d 字符串A3 -i 1 -a 签名地址
```
返回字符串A4
```
cli wallet sign -d 字符串A4 -i 2 -a 签名地址
```
返回字符串A5
```
发送:
cli wallet send -d 字符串A5
## token模块
发行bty token,分为预创建及完成创建两个阶段
向token合约地址转币:(一步完成)
cli send bty send_exec -e token -a 数量 -k 签名地址
```
返回交易哈希
```
预创建:(一步完成)
cli send token precreate -f 手续费 -i 介绍 -n token名称 -a 拥有者地址 -p 发币费 -s 标志,需大写 -t 发行数量 -k 创建者地址
预创建后会冻结token合约中设置的发币费,可查询预创建列表:
cli token get_precreated
```
---The 30th precreated token is below--------------------
{
"name": "mouse",
"symbol": "MOU",
"introduction": "bigmouse",
"total": 10002,
"owner": "152xusBV1onddSYcyTmGcGr1Yva7GAc37w",
"creator": "165HDiXVdTaP1XgM54QbFJaciwAqDSBuip"
}
```
完成创建需要token-finisher管理权限签名:
cli send token finish -f 手续费 -a 拥有者地址 -s 标志 -k 管理权限地址签名
可查询已完成创建的token:
cli token get_finish_created
```
---The 308th Finish Created token is below--------------------
{
"name": "mouse",
"symbol": "MOU",
"introduction": "bigmouse",
"total": 10002,
"owner": "152xusBV1onddSYcyTmGcGr1Yva7GAc37w",
"creator": "165HDiXVdTaP1XgM54QbFJaciwAqDSBuip",
"status": 1
}
```
其余命令列表:
```
Available Commands:
finish Create a finish created token transaction
get_finish_created Get finish created tokens
get_precreated Get precreated tokens
precreate Create a precreated token transaction
revoke Create a token revoke transaction
token_assets Get token assets
token_balance Get token balance of one or more addresses
transfer Create a token transfer transaction
withdraw Create a token withdraw transaction
```
### revoke 撤销预创建
cli send token revoke -a 拥有者地址 -f 手续费 -s 标志 -k 创建者签名
### token_assets 查询指定地址在指定合约中的所有token余额
cli token token_assets -a 地址 -e 执行器
```
[
{
"Token": "MOU",
"balance": "10002.0000",
"frozen": "0.0000",
"addr": "152xusBV1onddSYcyTmGcGr1Yva7GAc37w"
}
]
```
### token_balance 查询指定地址在指定合约中,某指定token的余额
cli token token_balance -a 地址 -e 执行器 -s 标志
```
[
{
"Token": "MOU",
"balance": "10002.0000",
"frozen": "0.0000",
"addr": "152xusBV1onddSYcyTmGcGr1Yva7GAc37w"
}
]
```
### transfere token转账
cli send token transfer -t 接收地址 -a 数量 -s 标志 -k 签名私钥
```
返回交易哈希
```
### withdraw 收回token
cli send token withdraw -a 数量 -s 标志 -e 执行器 -k 签名私钥
```
返回交易哈希
```
## trade模块
```
Available Commands:
buy Create a buying token transaction
buy_order Show one's buying orders
revoke Create a revoke token transaction
sell Create a selling token transaction
sell_order Show one's token selling orders
status_buy_order Show one's buying orders of tokens
status_order Show one's orders with status
status_sell_order Show selling orders of the status
status_token_buy_order Show token buying orders of a status
status_token_sell_order Show token selling orders of a status
```
要执行在trade中的交易,首先需要由token合约向trade合约转币:
获取trade合约地址:
cli exec addr -e trade
```
1BXvgjmBw1aBgmGn1hjfGyRkmN3krWpFP4
```
向合约地址转币:
cli send token transfer -t 1BXvgjmBw1aBgmGn1hjfGyRkmN3krWpFP4 -a 数量 -k 签名地址 -s MOU
查询trade合约指定token余额
cli token token_balance -a 地址 -s MOU -e trade
```
[
{
"Token": "MOU",
"balance": "100.0000",
"frozen": "0.0000",
"addr": "165HDiXVdTaP1XgM54QbFJaciwAqDSBuip"
}
]
```
### sell 挂卖
cli send trade sell -f 手续费 -m 最小手数 -p 价格 -s MOU -t 最大数量 -k "152xusBV1onddSYcyTmGcGr1Yva7GAc37w"
默认每手为0.01个token
### sell_order 根据地址查询挂卖单
cli trade sell_order -s 152xusBV1onddSYcyTmGcGr1Yva7GAc37w -t MOU
```
{
"sellOrders": [
{
"tokenSymbol": "MOU",
"owner": "152xusBV1onddSYcyTmGcGr1Yva7GAc37w",
"amountPerBoardlot": "0.0100",
"minBoardlot": 1,
"pricePerBoardlot": "1.0000",
"totalBoardlot": 2000,
"tradedBoardlot": 0,
"buyID": "",
"status": 1,
"sellID": "mavl-trade-sell-64cb10c29bedbd5ad1b3e9317999c637aac695cfbcab64ff292922ef9e5881ab",
"txHash": "0x64cb10c29bedbd5ad1b3e9317999c637aac695cfbcab64ff292922ef9e5881ab",
"height": 895679,
"key": "mavl-trade-sell-64cb10c29bedbd5ad1b3e9317999c637aac695cfbcab64ff292922ef9e5881ab",
"blockTime": 1536740067,
"isSellOrder": true
}
]
}
```
默认为0.01个每手,共20个token,故为2000手
购买trade中的挂卖时,需要先向trade合约转入bty
cli send bty transfer -t 1BXvgjmBw1aBgmGn1hjfGyRkmN3krWpFP4 -a 数量 -k 签名地址
```
返回交易哈希
```
### buy 购买token
cli send trade buy -c 购买手数 -s sellID -k 签名地址
购买后查询卖单
```
{
"sellOrders": [
{
"tokenSymbol": "MOU",
"owner": "152xusBV1onddSYcyTmGcGr1Yva7GAc37w",
"amountPerBoardlot": "0.0100",
"minBoardlot": 1,
"pricePerBoardlot": "1.0000",
"totalBoardlot": 2000,
"tradedBoardlot": 10,
"buyID": "",
"status": 1,
"sellID": "mavl-trade-sell-64cb10c29bedbd5ad1b3e9317999c637aac695cfbcab64ff292922ef9e5881ab",
"txHash": "0x64cb10c29bedbd5ad1b3e9317999c637aac695cfbcab64ff292922ef9e5881ab",
"height": 895679,
"key": "mavl-trade-sell-64cb10c29bedbd5ad1b3e9317999c637aac695cfbcab64ff292922ef9e5881ab",
"blockTime": 1536740067,
"isSellOrder": true
}
]
}
```
### buy_order 查询买单
cli trade buy_order -b "165HDiXVdTaP1XgM54QbFJaciwAqDSBuip" -t MOU
```
{
"buyOrders": [
{
"tokenSymbol": "MOU",
"owner": "165HDiXVdTaP1XgM54QbFJaciwAqDSBuip",
"amountPerBoardlot": "0.0100",
"minBoardlot": 1,
"pricePerBoardlot": "1.0000",
"totalBoardlot": 10,
"tradedBoardlot": 10,
"buyID": "",
"status": 6,
"sellID": "mavl-trade-sell-64cb10c29bedbd5ad1b3e9317999c637aac695cfbcab64ff292922ef9e5881ab",
"txHash": "0xd8e5f2dd4c5159f1e100b3f7f6d3de89c09f664bc8e00326d8eb66b6dc7bd67f",
"height": 895679,
"key": "0xd8e5f2dd4c5159f1e100b3f7f6d3de89c09f664bc8e00326d8eb66b6dc7bd67f",
"blockTime": 1536741001,
"isSellOrder": false
}
]
}
```
### status_buy_order 查询指定地址的指定状态的买单
cli trade status_buy_order -b 查询地址 -s 买单状态
```
{
"buyOrders": [
{
"tokenSymbol": "MOU",
"owner": "165HDiXVdTaP1XgM54QbFJaciwAqDSBuip",
"amountPerBoardlot": "0.0100",
"minBoardlot": 1,
"pricePerBoardlot": "1.0000",
"totalBoardlot": 10,
"tradedBoardlot": 10,
"buyID": "",
"status": 6,
"sellID": "mavl-trade-sell-64cb10c29bedbd5ad1b3e9317999c637aac695cfbcab64ff292922ef9e5881ab",
"txHash": "0xd8e5f2dd4c5159f1e100b3f7f6d3de89c09f664bc8e00326d8eb66b6dc7bd67f",
"height": 895679,
"key": "0xd8e5f2dd4c5159f1e100b3f7f6d3de89c09f664bc8e00326d8eb66b6dc7bd67f",
"blockTime": 1536741001,
"isSellOrder": false
}
]
}
```
※ -s支持onbuy, boughtout or buyrevoked
### status_order 查询指定地址的指定状态的所有买卖单,可指定配置查询
cli trade status_order -a "152xusBV1onddSYcyTmGcGr1Yva7GAc37w" -s 1
```
{
"orders": [
{
"tokenSymbol": "MOU",
"owner": "152xusBV1onddSYcyTmGcGr1Yva7GAc37w",
"amountPerBoardlot": "0.0100",
"minBoardlot": 1,
"pricePerBoardlot": "1.0000",
"totalBoardlot": 2000,
"tradedBoardlot": 10,
"buyID": "",
"status": 1,
"sellID": "mavl-trade-sell-64cb10c29bedbd5ad1b3e9317999c637aac695cfbcab64ff292922ef9e5881ab",
"txHash": "0x64cb10c29bedbd5ad1b3e9317999c637aac695cfbcab64ff292922ef9e5881ab",
"height": 895679,
"key": "mavl-trade-sell-64cb10c29bedbd5ad1b3e9317999c637aac695cfbcab64ff292922ef9e5881ab",
"blockTime": 1536740067,
"isSellOrder": true
}
]
}
```
※ -s后1: on, 2: done, 3: revoke
※ -c可选择输入,为显示的买卖单上限,默认为10;-d可选择输入,显示查询的方向,默认为1,即正向,0代表反向。
### revoke 撤销挂单
cli send trade revoke -s "mavl-trade-sell-64cb10c29bedbd5ad1b3e9317999c637aac695cfbcab64ff292922ef9e5881ab" -k "152xusBV1onddSYcyTmGcGr1Yva7GAc37w"
## retrieve 钱包找回
```
Retrieve正常流程,完整过程:
1. 需要准备两个账户A和B,B是A的备份
我这里A:14KEKbYtKKQm4wMthSK9J4La4nAiidGozt B:1KoVEeACNMyr42uEnfKR7SJTi5wE8nGWqx
2. 为了使最后retrieve能够看到效果,需要由A账户先打点钱进retrieve合约
./cli bty send_exec -a 100 -e retrieve
由A签名并发送
3. backup操作
./cli retrieve backup -b 1KoVEeACNMyr42uEnfKR7SJTi5wE8nGWqx -t 14KEKbYtKKQm4wMthSK9J4La4nAiidGozt -d 61
由A签名并发送
4. prepare操作
./cli retrieve prepare -b 1KoVEeACNMyr42uEnfKR7SJTi5wE8nGWqx -t 14KEKbYtKKQm4wMthSK9J4La4nAiidGozt
由B签名并发送
5. perform操作
./cli retrieve perform -b 1KoVEeACNMyr42uEnfKR7SJTi5wE8nGWqx -t 14KEKbYtKKQm4wMthSK9J4La4nAiidGozt
由B签名并发送
6. 取回,从retrieve合约取钱
./cli bty withdraw -a 100 -e retrieve
由B签名并发送
注意:
A. retrieve合约只能够负责合约里余额的转移,要想达到外部账户的效果,必须要往合约里打钱,并最后取回,否则即便retrieve操作成功,也看不到效果
B. 因为prepare/perform/withdraw都是由备份地址签名完成的,因此这个备份地址还需要有点钱作为手续费
C. 当前retrieve命令和一些其他的执行器类似,操作只是创建了交易,还需要签名并发送
D. retrieve操作需要注意,不同的操作需要不同的地址签名A/B
E. 备份过程指定了prepare以后多久能够进行perform操作,最少是60s,所以为了保证perform能够成功,需要在prepare以后等待一下再perform
F. 测试过程中可以用查询命令查看状态
./cli retrieve query -b 1KoVEeACNMyr42uEnfKR7SJTi5wE8nGWqx -t 14KEKbYtKKQm4wMthSK9J4La4nAiidGozt
```
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment