USDT api 命令行示例
2018-07-25 本文已影响536人
SlowGO
查看命令帮助
# 命令列表
$ omnicore-cli help
# 具体命令的详细信息
$ omnicore-cli help listreceivedbyaddress
新建账户地址
$ omnicore-cli "getnewaddress" mytest
16M2hKHw9b5VuP21YBAJQmCd3VhuNtdDqG
mytest 是账号名,需要唯一。
返回的是账户地址。
getnewaddress 是比特币的命令,可以在下面的地址了解更多的命令:
获取钱包地址的私钥
$ omnicore-cli "dumpprivkey" 16M2hKHw9b5VuP21YBAJQmCd3VhuNtdDqG
Kz4XuoNVBKgFKv9mEgvqPgxXXvMabKzQjnKiKQ3945fbxJMRaqrw
查询账户余额
$ omnicore-cli "omni_getbalance" "16M2hKHw9b5VuP21YBAJQmCd3VhuNtdDqG" 1
# 返回信息
{
"balance": "0.00000000",
"reserved": "0.00000000"
}
最后的参数 1 是 propertyid(资产标识ID),在 omni 钱包中,不同资产都有一个唯一的ID来标识,1 代表 omni。
propertyid 查询页面:
https://www.omniwallet.org/explorer/assets
发送代币
用于创建和广播一个Simple send交易,来完成代币资产所有权的转移,执行命令的钱包必须持有发送方的私钥。
例如我发送10个USDT给你:
$ omnicore-cli "omni_send" "3M9qvHKtgARhqcMtM5cRT9VaiDJ5PSfQGY" "37FaKponF7zqoMLUjEiko25pDiuVH5YLEa" 31 "10.0"
参数分别是:
- fromaddress
- toaddress
- propertyid
- amount
2个地址分别是我和你的钱包地址,返回值是一个16进制编码的交易Hash字符串。
propertyid 列表
$ omnicore-cli "omni_listproperties"
发现一个比较好的中文API文档:
https://www.codetd.com/article/1692438
账户列表
$ omnicore-cli listaccounts
{
"mytest": 0.97500000,
"mytest1": 0.16250000,
"mytest2": 1.95000546,
"mytest3": 0.32500000,
"mytest4": 3.23321757
}
取得某个账户的地址
$ omnicore-cli "getaddressesbyaccount" mytest
[
"mttDJCLFD3FpRXLu2qmgNoBqE5xYZqomud"
]
交易详情
$ omnicore-cli "omni_gettransaction" 3a8c7165b53248cd2e3d8b9881549f00bcf25ae5ab75f891fa7b53ad644e79c4
{
"txid": "3a8c7165b53248cd2e3d8b9881549f00bcf25ae5ab75f891fa7b53ad644e79c4",
"fee": "0.00035580",
"sendingaddress": "mqn2FFboeSKRHRWYcdMe7LupDX1QRzbHZp",
"referenceaddress": "mttDJCLFD3FpRXLu2qmgNoBqE5xYZqomud",
"ismine": true,
"version": 0,
"type_int": 0,
"type": "Simple Send",
"propertyid": 2,
"divisible": true,
"amount": "0.01000000",
"confirmations": 0
}
查看 omni info
$ omnicore-cli "omni_getinfo"
列出某块儿上的交易ID列表
$ omnicore-cli "omni_listblocktransactions" 1356321
列出所有本地address的收款信息
$ omnicore-cli listreceivedbyaddress
[
{
"address": "moURpc7XBZKYkXFRkyJxzvdwg3nisnW757",
"account": "mytest2",
"amount": 1.95001092,
"confirmations": 55627,
"label": "mytest2",
"txids": [
"147e660760ccc08a5148171700f0e3fa30c6ac6d406a5b88430461ab4dcbe230",
"5a60f725acc4d4ae0fe46622844f3cf676613e154cde21ff7456dddc51c8c8b4",
"ccef6e4003b0dfd72da5973700d413cb8ba1eda173119755b1dd9f585d7011ba",
"9dae377630186407b01339ef6e3663a4049d7c4e7779d4166ffb7d94761ccfbb"
]
},
......
]