Operation types
bts_signTransaction and bts_signAndBroadcast accept only params.operations. The wallet serializes the operations, asks the node for fees and a reference block, then opens the approval window.
Format and limits
Each operation is a pair: [type, data].
- The type should be a name string (
"transfer"). A numeric protocol id (0) also works. datais the operation's field object. Account fields must be account ids (1.2.x). Asset fields must be asset ids (1.3.x) plus integer strings in the asset's smallest unit.- A transaction may contain at most 10 operations; each level of
proposal_create.proposed_opshas the same limit of 10. - Proposals may nest at most 3 levels.
- The array must not be empty.
- Virtual operations (produced by the chain on fills, refunds and similar) cannot be signed; the wallet rejects them.
Fees: you may omit fee, or set fee.amount to "0". The wallet then queries the required fee and fills it in. If you set a non-zero fee, the wallet keeps that value (it must still pass serialization and later chain checks).
The wallet fills in the transaction envelope; do not send:
ref_block_num/ref_block_prefix(taken from the current head block);- transaction
expiration(head-block time plus 10 minutes, UTC, no zone suffix). This is not the same field as a limit order's ownexpiration.
Before signing, the wallet also checks that the node's chain_id equals the selected network, and that the transaction expiration is after the head block and no more than 1 hour ahead (stricter than the usual 1-day chain limit). The user can confirm only after these checks pass.
Plaintext memos
For the operations below you may set memo (extensions.memo on htlc_create) to a plain string, or to { "plaintext": "…" }. The wallet encrypts it in the service worker with the private key that matches the sender's current on-chain memo public key. The approval window shows the decrypted text:
transferoverride_transferasset_issuewithdraw_permission_claimhtlc_create(extensions.memo)
A plaintext memo on any other operation fails with <operation> 不支持明文备注. The memo may be at most 2048 bytes. If the wallet does not hold the current memo key for that account, the request is rejected with an explanatory message. A memo that is already { from, to, nonce, message } is left as-is.
A public node that a page uses to resolve names and symbols is only a convenience for filling forms. The approval window, decoded from the transaction bytes, is authoritative.
Examples
The following examples can be passed to bts_signTransaction as-is. Replace 1.2.x with an authorized account, and replace sample object ids with objects that exist on the current chain. Amounts are integers in the smallest unit.
Transfer transfer
[["transfer", {
"from": "1.2.100",
"to": "1.2.17",
"amount": { "amount": "100000", "asset_id": "1.3.0" },
"memo": "order #123",
"extensions": []
}]]Mainnet BTS (1.3.0) has precision 5, so 100000 means 1.00000 BTS.
Limit order limit_order_create
[["limit_order_create", {
"seller": "1.2.100",
"amount_to_sell": { "amount": "100000", "asset_id": "1.3.0" },
"min_to_receive": { "amount": "5", "asset_id": "1.3.113" },
"expiration": "2030-01-01T00:00:00",
"fill_or_kill": false,
"extensions": []
}]]This expiration is the order's lifetime, not the transaction expiration. An optional extensions.on_fill can place a take-profit order after a fill; add it only when you need it.
Cancel order limit_order_cancel
[["limit_order_cancel", {
"fee_paying_account": "1.2.100",
"order": "1.7.123456",
"extensions": []
}]]Pool swap liquidity_pool_exchange
[["liquidity_pool_exchange", {
"account": "1.2.100",
"pool": "1.19.2",
"amount_to_sell": { "amount": "100000", "asset_id": "1.3.0" },
"min_to_receive": { "amount": "1", "asset_id": "1.3.113" },
"extensions": []
}]]The approval window re-quotes against the current on-chain pool and compares the result with min_to_receive.
Pool deposit / withdraw
[["liquidity_pool_deposit", {
"account": "1.2.100",
"pool": "1.19.3",
"amount_a": { "amount": "100000", "asset_id": "1.3.0" },
"amount_b": { "amount": "10", "asset_id": "1.3.113" },
"extensions": []
}]][["liquidity_pool_withdraw", {
"account": "1.2.100",
"pool": "1.19.3",
"share_amount": { "amount": "100", "asset_id": "1.3.1000" },
"extensions": []
}]]Create a proposal proposal_create
[["proposal_create", {
"fee_paying_account": "1.2.100",
"expiration_time": "2030-01-01T00:00:00",
"proposed_ops": [
["transfer", {
"from": "1.2.100",
"to": "1.2.17",
"amount": { "amount": "12345", "asset_id": "1.3.0" },
"extensions": []
}]
],
"extensions": []
}]]proposed_ops may also be written as [{ "op": ["transfer", { … }] }]. The wallet normalizes to that wrapped form. Creating a proposal usually needs only the proposer's active authority; accounts affected by the inner operations approve later with proposal_update. If a nested operation would change owner authority, the approval window uses the highest risk level and asks for extra confirmation.
Approve or delete a proposal
[["proposal_update", {
"fee_paying_account": "1.2.100",
"proposal": "1.10.100",
"active_approvals_to_add": ["1.2.100"],
"active_approvals_to_remove": [],
"owner_approvals_to_add": [],
"owner_approvals_to_remove": [],
"key_approvals_to_add": [],
"key_approvals_to_remove": [],
"extensions": []
}]][["proposal_delete", {
"fee_paying_account": "1.2.100",
"using_owner_authority": false,
"proposal": "1.10.100",
"extensions": []
}]]The wallet loads the proposal from the chain and shows the inner operations in the approval window. If owner authority is required, the user must type the account name and re-enter the wallet password.
Lifetime-member upgrade account_upgrade
[["account_upgrade", {
"account_to_upgrade": "1.2.100",
"upgrade_to_lifetime_member": true,
"extensions": []
}]]All operations
The wallet implements operations 0–77 of the current BitShares-Core protocol, including serialization. The table below is generated from the source. The 7 virtual operations cannot be submitted.
| Id | Name | Description | Signable |
|---|---|---|---|
| 0 | transfer | 转账 | Yes |
| 1 | limit_order_create | 挂单(限价单) | Yes |
| 2 | limit_order_cancel | 撤单 | Yes |
| 3 | call_order_update | 调整抵押债仓 | Yes |
| 4 | fill_order | 订单成交(虚拟操作) | Virtual, not signable |
| 5 | account_create | 注册账户 | Yes |
| 6 | account_update | 修改账户(权限/投票/备注密钥) | Yes |
| 7 | account_whitelist | 账户白/黑名单 | Yes |
| 8 | account_upgrade | 升级为终身会员 | Yes |
| 9 | account_transfer | 转让账户(已停用) | Yes |
| 10 | asset_create | 创建资产 | Yes |
| 11 | asset_update | 修改资产参数 | Yes |
| 12 | asset_update_bitasset | 修改智能资产参数 | Yes |
| 13 | asset_update_feed_producers | 修改喂价人 | Yes |
| 14 | asset_issue | 发行资产 | Yes |
| 15 | asset_reserve | 销毁资产(不可逆) | Yes |
| 16 | asset_fund_fee_pool | 注资手续费池 | Yes |
| 17 | asset_settle | 强制清算(按喂价结算) | Yes |
| 18 | asset_global_settle | 全局清算(黑天鹅) | Yes |
| 19 | asset_publish_feed | 发布喂价 | Yes |
| 20 | witness_create | 创建见证人 | Yes |
| 21 | witness_update | 修改见证人 | Yes |
| 22 | proposal_create | 创建提案 | Yes |
| 23 | proposal_update | 批准/撤销批准提案 | Yes |
| 24 | proposal_delete | 否决/删除提案 | Yes |
| 25 | withdraw_permission_create | 授权他人定期提款 | Yes |
| 26 | withdraw_permission_update | 修改提款授权 | Yes |
| 27 | withdraw_permission_claim | 按授权提款 | Yes |
| 28 | withdraw_permission_delete | 撤销提款授权 | Yes |
| 29 | committee_member_create | 创建理事会成员 | Yes |
| 30 | committee_member_update | 修改理事会成员 | Yes |
| 31 | committee_member_update_global_parameters | 修改全局链参数(理事会) | Yes |
| 32 | vesting_balance_create | 创建锁仓余额 | Yes |
| 33 | vesting_balance_withdraw | 提取锁仓余额 | Yes |
| 34 | worker_create | 创建预算项目(worker) | Yes |
| 35 | custom | 自定义数据 | Yes |
| 36 | assert | 链上断言 | Yes |
| 37 | balance_claim | 领取创世/锁定余额 | Yes |
| 38 | override_transfer | 发行人强制转移 | Yes |
| 39 | transfer_to_blind | 转入隐私(盲)余额 | Yes |
| 40 | blind_transfer | 隐私(盲)转账 | Yes |
| 41 | transfer_from_blind | 从隐私(盲)余额转出 | Yes |
| 42 | asset_settle_cancel | 取消清算(虚拟操作) | Virtual, not signable |
| 43 | asset_claim_fees | 提取资产市场手续费 | Yes |
| 44 | fba_distribute | FBA 分配(虚拟操作) | Virtual, not signable |
| 45 | bid_collateral | 黑天鹅后竞价抵押 | Yes |
| 46 | execute_bid | 竞价成交(虚拟操作) | Virtual, not signable |
| 47 | asset_claim_pool | 提取手续费池 | Yes |
| 48 | asset_update_issuer | 转让资产发行人 | Yes |
| 49 | htlc_create | 创建哈希时间锁(HTLC) | Yes |
| 50 | htlc_redeem | 兑付 HTLC | Yes |
| 51 | htlc_redeemed | HTLC 已兑付(虚拟操作) | Virtual, not signable |
| 52 | htlc_extend | 延长 HTLC | Yes |
| 53 | htlc_refund | HTLC 退款(虚拟操作) | Virtual, not signable |
| 54 | custom_authority_create | 创建自定义权限 | Yes |
| 55 | custom_authority_update | 修改自定义权限 | Yes |
| 56 | custom_authority_delete | 删除自定义权限 | Yes |
| 57 | ticket_create | 创建投票锁仓票 | Yes |
| 58 | ticket_update | 修改投票锁仓票 | Yes |
| 59 | liquidity_pool_create | 创建流动池 | Yes |
| 60 | liquidity_pool_delete | 删除流动池 | Yes |
| 61 | liquidity_pool_deposit | 流动池注资 | Yes |
| 62 | liquidity_pool_withdraw | 流动池撤资 | Yes |
| 63 | liquidity_pool_exchange | 流动池兑换 | Yes |
| 64 | samet_fund_create | 创建闪电贷资金池 | Yes |
| 65 | samet_fund_delete | 删除闪电贷资金池 | Yes |
| 66 | samet_fund_update | 修改闪电贷资金池 | Yes |
| 67 | samet_fund_borrow | 闪电贷借款 | Yes |
| 68 | samet_fund_repay | 闪电贷还款 | Yes |
| 69 | credit_offer_create | 创建借贷报价 | Yes |
| 70 | credit_offer_delete | 删除借贷报价 | Yes |
| 71 | credit_offer_update | 修改借贷报价 | Yes |
| 72 | credit_offer_accept | 接受借贷报价(借款) | Yes |
| 73 | credit_deal_repay | 偿还借贷 | Yes |
| 74 | credit_deal_expired | 借贷到期(虚拟操作) | Virtual, not signable |
| 75 | liquidity_pool_update | 修改流动池费率 | Yes |
| 76 | credit_deal_update | 修改借贷自动还款 | Yes |
| 77 | limit_order_update | 修改限价单 | Yes |
Unknown types are always rejected: 不支持的操作类型: <type>(未知操作一律拒绝).
CubWallet