本文作者:陈进坚
个人博客:https://jian1098.github.io
CSDN博客:https://blog.csdn.net/c_jian
简书:https://www.jianshu.com/u/8ba9ac5706b6
联系方式:jian1098@qq.com
参考文档:https://dev.bitshares.works/en/master/api/wallet_api.html#
查询节点信息
参数:无
1 | {"jsonrpc": "2.0", "method": "get_dynamic_global_properties", "params": [], "id": 1} |
返回:
1 | { |
通过区块id查询区块信息
参数:区块id
1 | {"jsonrpc": "2.0", "method": "get_block", "params": [19868], "id": 1} |
返回:
1 | { |
通过账号查询交易历史
参数:账户名,最小编号,最大返回数量,最大编号。编号从 1 开始。
1 | {"jsonrpc": "2.0", "method": "get_relative_account_history", "params": ["nathan",1,2,100], "id": 1} |
返回:
1 | { |
账户列表
参数:最顶层的账户名,获取数量
1 | {"jsonrpc": "2.0", "method": "list_accounts", "params": ["nathan",10], "id": 1} |
返回:
1 | { |
查询账户余额
参数:账户名
1 | {"jsonrpc": "2.0", "method": "list_account_balances", "params": ["nathan"], "id": 1} |
返回:
1 | { |
通过账户名查询账户id
参数:账户名
1 | {"jsonrpc": "2.0", "method": "get_account_id", "params": ["nathan"], "id": 1} |
返回:
1 | { |
通过账户id查询账户信息
参数:账户id
1 | {"jsonrpc": "2.0", "method": "get_object", "params": ["1.2.6","1.3.0"], "id": 1} |
或者用另一个端口的另一个方法:http://47.56.168.231:11011,可同时查询多个账户
1 | {"id":1,"method":"call","params":[0,"get_accounts",[["1.2.6"]]]} |
1 | { |
通过账户名查询账户信息
参数:账户名
1 | {"jsonrpc": "2.0", "method": "get_account", "params": ["nathan"], "id": 1} |
返回:
1 | { |
解锁钱包
参数:密码
1 | {"jsonrpc": "2.0", "method": "unlock", "params": ["supersecret"], "id": 1} |
返回:
1 | { |
转账
参数:源账户名,目的账户名,金额,币种,备注
1 | {"jsonrpc": "2.0", "method": "transfer2", "params": ["nathan","alpha",10,"BTS","This is memo"], "id": 1} |
返回:
1 | { |
查询资产详情
参数:资产名
1 | {"jsonrpc": "2.0", "method": "get_asset", "params": ["BTS"], "id": 1} |
返回:
1 | { |
所有钱包列表
参数:无
1 | {"jsonrpc": "2.0", "method": "list_my_accounts", "params": [], "id": 1} |
返回:
1 | { |
见证人列表
参数:最顶层的账户名,最大数量
1 | {"jsonrpc": "2.0", "method": "list_witnesses", "params": ["init0",10], "id": 1} |
返回:
1 | { |
通过用户名查询见证人详情
参数:见证人账号
1 | {"jsonrpc": "2.0", "method": "get_witness", "params": ["init0"], "id": 1} |
返回:
1 | { |
通过见证人id查询见证人详情
先查询见证人的普通账号id
1 | {"jsonrpc": "2.0", "method": "get_object", "params": ["1.6.1"], "id": 1} |
返回:
1 | { |
得到见证人对应的witness_account
,然后调用同一个方法,将witness_account
作为参数传入即可
1 | {"jsonrpc": "2.0", "method": "get_object", "params": ["1.2.6"], "id": 1} |
返回:
1 | { |
得到账户名name
委员会成员列表
参数:最顶层的账户名,最大数量
1 | {"jsonrpc": "2.0", "method": "list_committee_members", "params": ["init0",10], "id": 1} |
返回:
1 | { |
查询委员会账号详情
参数:委员会成员账号
1 | {"jsonrpc": "2.0", "method": "get_committee_member", "params": ["init0"], "id": 1} |
返回:
1 | { |
通过交易id查询交易
链接:http://47.56.168.231/index/index/getTransaction?id=0dcdbe50a128deee41a18fe6788b5933a19211ba
参数:id = 交易id
返回:
1 | { |
用助记词派生出公私钥
参数:助记词,生成的数量
1 | {"jsonrpc": "2.0", "method": "derive_owner_keys_from_brain_key", "params": ["IMPLIAL BURLY THYMY CAVITY GUNSHOP STOPE JAPE PENDA TOMBLET COUPLET RECENSE LUE ROTAL CIPPUS PRIER CODICES",5], "id": 1} |
返回:
1 | { |
创建账户
获取助记词
参数:无
1 | {"jsonrpc": "2.0", "method": "suggest_brain_key", "params": [], "id": 1} |
返回:
1 | { |
用助记词注册账号
参数:助记词,新账号名(8位以上字母开头,至少一个数字,特殊字符只能是-
),支付费用帐号,推荐人帐号,是否真实创建
例:创建账号test-123
,支付费用帐号和推荐人帐号是nathan
1 | {"jsonrpc": "2.0", "method": "create_account_with_brain_key", "params": ["IMPLIAL BURLY THYMY CAVITY GUNSHOP STOPE JAPE PENDA TOMBLET COUPLET RECENSE LUE ROTAL CIPPUS PRIER CODICES","test-123","nathan","nathan",true], "id": 1} |
返回:
1 | { |
账户
余额和资产列表
参数:账户名
1 | {"jsonrpc": "2.0", "method": "list_account_balances", "params": ["nathan"], "id": 1} |
返回:
1 | { |
通过资产id查询资产信息
参数:资产id
1 | {"jsonrpc": "2.0", "method": "get_asset", "params": ["1.3.0"], "id": 1} |
返回:
1 | { |
转账
参数:源账户名,要发往的账户名,金额,币种,备注
1 | {"jsonrpc": "2.0", "method": "transfer2", "params": ["nathan","alpha",10,"BTS","This is memo"], "id": 1} |
返回:
1 | { |
近期活动
参数:账号名,获取数量
1 | {"jsonrpc": "2.0", "method": "get_account_history", "params": ["nathan",10], "id": 1} |
返回:
1 | { |
查看指定类型的活动
参数:账户名,活动ID数组,开始下标,获取数量
1 | {"jsonrpc": "2.0", "method": "get_account_history_by_operations", "params": ["nathan",[0,5],1,1], "id": 2} |
返回:
1 | { |
投票
投票给超级节点
需要支付费用,所有必须要有余额
参数:投票账号,超级节点账号,投票(true)或取消投票(false),是否广播交易
1 | {"jsonrpc": "2.0", "method": "vote_for_witness", "params": ["nathan","init0",true,true], "id": 1} |
返回:
1 | { |
投票给理事会成员
需要支付费用,所有必须要有余额
参数:投票账号,理事会成员账号,投票(true)或取消投票(false),是否广播交易
1 | {"jsonrpc": "2.0", "method": "vote_for_committee_member", "params": ["nathan","init0",true,true], "id": 1} |
返回:
1 | { |
资产
资产列表
参数:列表中第一个资产的符号(可以是空),获取数量(最大100)
1 | {"jsonrpc": "2.0", "method": "list_assets", "params": ["",10], "id": 1} |
返回:
1 | { |
创建资产
暂无
查询见证人详情
参数:见证人账号
1 | {"jsonrpc": "2.0", "method": "get_witness", "params": ["init0"], "id": 1} |
返回:
1 | { |
活动id对照表
ID | 活动命令 | 备注 |
---|---|---|
0 | transfer_operation | 转账 |
1 | limit_order_create_operation | 创建限价单 |
2 | limit_order_cancel_operation | 取消限价单 |
3 | call_order_update_operation | 更新债仓 |
4 | fill_order_operation | |
5 | account_create_operation | 创建账户 |
6 | account_update_operation | 更新账户 |
7 | account_whitelist_operation | 账户白名单 |
8 | account_upgrade_operation | 升级账户 |
9 | account_transfer_operation | 账户转移 |
10 | asset_create_operation | 创建资产 |
11 | asset_update_operation | 更新资产 |
12 | asset_update_bitasset_operation | 更新智能货币 |
13 | asset_update_feed_producers_operation | 更新资产喂价提供者 |
14 | asset_issue_operation | 资产发行 |
15 | asset_reserve_operation | 销毁资产 |
16 | asset_fund_fee_pool_operation | 注资资产手续费池 |
17 | asset_settle_operation | 资产强清 |
18 | asset_global_settle_operation | 全局资产强清 |
19 | asset_publish_feed_operation | 发布资产喂价 |
20 | witness_create_operation | 创建见证人 |
21 | witness_update_operation | 更新见证人 |
22 | proposal_create_operation | 创建提议 |
23 | proposal_update_operation | 更新提议 |
24 | proposal_delete_operation | 删除提议 |
25 | withdraw_permission_create_operation | 授权提款 |
26 | withdraw_permission_update_operation | 更新提款授权 |
27 | withdraw_permission_claim_operation | 行使提款授权 |
28 | withdraw_permission_delete_operation | 删除提款授权 |
29 | committee_member_create_operation | 创建理事会成员 |
30 | committee_member_update_operation | 更新理事会成员 |
31 | committee_member_update_global_paramet | 全局参数更新 |
32 | vesting_balance_create_operation | 创建冻结账目余额 |
33 | vesting_balance_withdraw_operation | 提取解冻账户余额 |
34 | worker_create_operation | |
35 | custom_operation | 自定义 |
36 | assert_operation | 断言操作 |
37 | balance_claim_operation | 申领余额 |
38 | override_transfer_operation | 强制转账 |
39 | transfer_to_blind_operation | |
40 | blind_transfer_operation | 向隐私账户转账 |
41 | transfer_from_blind_operation | 从隐私账户转出 |
42 | asset_settle_cancel_operation | |
43 | asset_claim_fees_operation | 申领资产手续费 |
44 | fba_distribute_operation | |
45 | bid_collateral_operation | 抵押物竞价 |
46 | execute_bid_operation | |
47 | asset_claim_pool_operation | 申领资产手续费池 |
48 | asset_update_issuer_operation | 更新资产发行者 |
49 | custom_authority_create_operation | |
50 | custom_authority_update_operation | |
51 | custom_authority_delete_operation |
获取所有费用参数
参数:无
1 | {"jsonrpc": "2.0", "method": "get_object", "params": ["2.0.0"], "id": 1} |
返回:
1 | { |