命令行参考

status

查询链的状态

示例

bhcli  status

成功返回

{
  "node_info": {
    "protocol_version": {
      "p2p": "7",
      "block": "10",
      "app": "0"
    },
    "id": "9481d28e98c150ad4870da193efffb8488c75dfc",
    "listen_addr": "tcp://0.0.0.0:26656",
    "network": "bhex-testnet",
    "version": "0.32.7",
    "channels": "402021222330380070",
    "moniker": "moniker",
    "other": {
      "tx_index": "on",
      "rpc_address": "tcp://127.0.0.1:26657"
    }
  },
  "sync_info": {
    "latest_block_hash": "B0003D14677A029F700B1D453EFD1FEF07419A24E073DD0112D90776175C802D",
    "latest_app_hash": "2ACF927F119C34AD6E0453E58663FA3BE8415CBD5551867A145198F0F617E2B0",
    "latest_block_height": "23",
    "latest_block_time": "2020-04-14T06:48:46.676629Z",
    "catching_up": false
  },
  "validator_info": {
    "address": "72549FB59081C03C47942C9C9F6772AB82903482",
    "pub_key": {
      "type": "tendermint/PubKeyEd25519",
      "value": "oPRW7385Qe+dd5Wka78vDLWUizXhShW854+jjj6fJuo="
    },
    "voting_power": "50"
  }
}

config

显示client 的配置

示例

bhcli config

成功返回

chain-id = "bhex-testnet"
indent = true
output = "json"
trust-node = true

配置client

将常用的配置信息存放在.bhcli/config/config.toml中

bhcli config <key> [value] [flags]

示例

bhcli config indent  false
bhcli config chain-id  bhex-testnet
bhcli config output  text
bhcli config trust-node  true

query

tendermint-validator-set

查询当前validators

bhcli query tendermint-validator-set

示例

bhcli query tendermint-validator-set

成功返回

{
  "block_height": "65",
  "validators": [
    {
      "address": "hbcvalcons1wf2fldvss8qrc3u59jwf7emj4wpfqdyzzekl8l",
      "pub_key": "hbcvalconspub1zcjduepq5r69dmml89q7l8thjkjxh0e0pj6efze4u99pt088373cu05lym4qf6f6v0",
      "proposer_priority": "0",
      "voting_power": "50"
    }
  ]
}

block

查询指定高度的区块内容

示例

bhcli query  block 50

成功返回

{
  "block_meta": {
    "block_id": {
      "hash": "FA1FCD8F8572A8063CDDD257948392056196FEA9AA21211EA1B41571D57C64BC",
      "parts": {
        "total": "1",
        "hash": "D06276C3CCCAB211B55B604E041573D0922231C9C3AC0DFE6F7BA0109420587C"
      }
    },
    "header": {
      "version": {
        "block": "10",
        "app": "0"
      },
      "chain_id": "bhex-testnet",
      "height": "50",
      "time": "2020-04-14T06:51:02.861804Z",
      "num_txs": "0",
      "total_txs": "0",
      "last_block_id": {
        "hash": "E468E15E142B4E9389A61001682E19B36DF44223FD53664F1DD1CE4A28453893",
        "parts": {
          "total": "1",
          "hash": "D0C914DF8B00F387345684AABE8141897A0F475507B9DDC4AFC15D3CC00D872D"
        }
      },
      "last_commit_hash": "E14461A6D39FC4D5093BDFEED79D160F5C5DD6340EDBBED6D365AA62AA24B47D",
      "data_hash": "",
      "validators_hash": "D46F0A134F3C91973543A26E82C8B81FAA010470494DEABF50CC77D9FCEF850D",
      "next_validators_hash": "D46F0A134F3C91973543A26E82C8B81FAA010470494DEABF50CC77D9FCEF850D",
      "consensus_hash": "048091BC7DDC283F77BFBF91D73C44DA58C3DF8A9CBC867405D8B7F3DAADA22F",
      "app_hash": "BE0BC9E5BC2E05072A61ED2B68EAAADFF70E6B38F048264C4EF0EBC67B58C5C6",
      "last_results_hash": "",
      "evidence_hash": "",
      "proposer_address": "72549FB59081C03C47942C9C9F6772AB82903482"
    }
  }
}

tx

根据hash查找交易

bhcli query tx [hash]

示例

bhcli query tx E81EC801B96C99E99BA2EAA73624AF5FAA7A0356894846BB11C70D57B62937AD --trust-node

成功返回

{
  "height": "130",
  "txhash": "E81EC801B96C99E99BA2EAA73624AF5FAA7A0356894846BB11C70D57B62937AD",
  "data": "{Category:4 Flows:[{Symbol:eth CUAddress:1A44C7E097ECA1EFB9EAE78853A0B8EDD70A069D OrderID:efc5b260-e389-48f6-ae8d-197d60ba6ce6 OrderType:4 OrderStatus:7} {CuAddress:HBCNanXfwZxZpTBTJAyMun8UMrfxdgoqqsP4 Multisignedadress:0x9F0Bc5D2DAFa22a8D1A496476D9abF4A7e3C2090 Symbol:eth Index:0 Txhash:0x5496614bbea29b2e91a90a285f809e9960e64f4ebe7c9ce2dd7c6b3384c0618d Amount:10000000000000000 OrderID:efc5b260-e389-48f6-ae8d-197d60ba6ce6 DepositType:10 Memo:memo}]}",
  "raw_log": "[{\"msg_index\":0,\"success\":true,\"log\":\"\",\"events\":[{\"type\":\"deposit\",\"attributes\":[{\"key\":\"sender\",\"value\":\"BHj2wujKtAxw9XZMA7zDDvjGqKjoYUdw1FZ\"},{\"key\":\"recipient\",\"value\":\"HBCNanXfwZxZpTBTJAyMun8UMrfxdgoqqsP4\"},{\"key\":\"symbol\",\"value\":\"eth\"},{\"key\":\"hash\",\"value\":\"0x5496614bbea29b2e91a90a285f809e9960e64f4ebe7c9ce2dd7c6b3384c0618d\"},{\"key\":\"amount\",\"value\":\"10000000000000000\"},{\"key\":\"index\",\"value\":\"0\"},{\"key\":\"memo\",\"value\":\"memo\"}]},{\"type\":\"message\",\"attributes\":[{\"key\":\"action\",\"value\":\"deposit\"}]}]}]",
  "logs": [
    {
      "msg_index": 0,
      "success": true

    }
  ]
}

mint

查询mint的参数

bhcli query mint params
示例
bhcli query mint params
成功返回
{
  "mint_denom": "hbc",
  "inflation": "0.030000000000000000",
  "mint_per_block": "60000000000000000"
}

token

查询所有支持币种名称

bhcli query token symbols
示例
bhcli query token symbols
成功返回
[
  "btc",
  "eth",
  "hbc",
  "tusdt"
]

查询所有支持币种信息

bhcli query token tokens
示例
bhcli query token tokens
成功返回
[
  {
    "symbol": "btc",
    "issuer": "",
    "chain": "btc",
    "type": "1",
    "is_send_enabled": true,
    "is_deposit_enabled": true,
    "is_withdrawal_enabled": true,
    "decimals": "8",
    "total_supply": "21000000000000000",
    "collect_threshold": "20000",
    "deposit_threshold": "20000",
    "open_fee": "28000000000000000000",
    "sys_open_fee": "28000000000000000000",
    "withdrawal_fee": "3000",
    "max_op_cu_number": "6",
    "sys_transfer_amount": "0",
    "op_cu_sys_transfer_amount": "0",
    "gas_limit": "1",
    "gas_price": "1000"
  },
  {
    "symbol": "eth",
    "issuer": "",
    "chain": "eth",
    "type": "2",
    "is_send_enabled": true,
    "is_deposit_enabled": true,
    "is_withdrawal_enabled": true,
    "decimals": "18",
    "total_supply": "0",
    "collect_threshold": "100000000000000000",
    "deposit_threshold": "100000000000000000",
    "open_fee": "28000000000000000000",
    "sys_open_fee": "28000000000000000000",
    "withdrawal_fee": "8000000000000000",
    "max_op_cu_number": "6",
    "sys_transfer_amount": "0",
    "op_cu_sys_transfer_amount": "0",
    "gas_limit": "21000",
    "gas_price": "1000"
  },
  {
    "symbol": "hbc",
    "issuer": "",
    "chain": "hbc",
    "type": "2",
    "is_send_enabled": true,
    "is_deposit_enabled": false,
    "is_withdrawal_enabled": false,
    "decimals": "18",
    "total_supply": "0",
    "collect_threshold": "0",
    "deposit_threshold": "0",
    "open_fee": "0",
    "sys_open_fee": "0",
    "withdrawal_fee": "0",
    "max_op_cu_number": "0",
    "sys_transfer_amount": "0",
    "op_cu_sys_transfer_amount": "0",
    "gas_limit": "1000000",
    "gas_price": "1"
  }

]

查询某一个币种信息

bhcli query token token [symbol] 
示例
bhcli query token token tusdt 
成功返回
{
  "symbol": "tusdt",
  "issuer": "0xC9476A4919a7E5c7e1760b68F945971769D5c1D8",
  "chain": "eth",
  "type": "2",
  "is_send_enabled": true,
  "is_deposit_enabled": true,
  "is_withdrawal_enabled": true,
  "decimals": "6",
  "total_supply": "30000000000000000",
  "collect_threshold": "50000000",
  "deposit_threshold": "50000000",
  "open_fee": "28000000000000000000",
  "sys_open_fee": "28000000000000000000",
  "withdrawal_fee": "20000000000000000",
  "max_op_cu_number": "6",
  "sys_transfer_amount": "8000000000000000",
  "op_cu_sys_transfer_amount": "100000000000000000",
  "gas_limit": "80000",
  "gas_price": "1000"
}                                                      

查询某一个币种的精度信息

bhcli query token decimal [symbol] 
示例
bhcli query token decimal tusdt 
成功返回
{
  "decimals": "6"
}                                                    

查询模块的参数

bhcli query token params 
示例
bhcli query token params
成功返回
{
  "token_cache_size": "32",
  "reserved_symbols": [
    "eos",
    "usdt",
    "bch",
    "bsv",
    "ltc",
    "bnb",
    "xrp",
    "okb",
    "ht",
    "dash",
    "etc",
    "neo",
    "atom",
    "zec",
    "ont",
    "doge",
    "tusd",
    "bat",
    "qtum",
    "vsys",
    "iost",
    "dcr",
    "zrx",
    "beam",
    "grin"
  ]
}                                                   

order

有些发送到链上的交易会产生order,比如keygen(创建资产地址)、deposit(充币),withdrawal(提币)等交易。可以根据交易返回的orderid,查询order详情。

bhcli query order order 3b16978a-a435-4b64-acc3-7e15b571319b 

成功返回

{
  "type": "bhexchain/order/OrderKeyGen",
  "value": {
    "OrderBase": {
      "cu_address": "HBCgS6KSUhmudwbh88tRynzVu86fFghFA6Pg",
      "id": "3b16978a-a435-4b64-acc3-7e15b571319b",
      "order_type": "1",
      "symbol": "btc",
      "status": "10"
    },
    "key_nodes": [
      "HBCjN2VxLCBMbFKafhjVa8auudMpTpmDgeE8",
      "HBCgS6KSUhmudwbh88tRynzVu86fFghFA6Pg",
      "HBCVtF1oamkwbczjt5R3mY8j64ZSx9tJqDgL",
      "HBCa7p52Zr1ZVj52Ldc5uFpEMDP6PhzbtxrN"
    ],
    "sign_threshold": "3",
    "to": "HBCNanXfwZxZpTBTJAyMun8UMrfxdgoqqsP4",
    "open_fee": [
      {
        "denom": "hbc",
        "amount": "28000000000000000000"
      }
    ],
    "multi_sign_address": "mwW98DAVfoojM7fkn1RW871PdjBZh7qF6L"
  }
}

Supply

查询token发行数量

bhcli query supply total
示例
bhcli query supply total
成功返回
[
  {
    "denom": "hbc",
    "amount": "3010000000060289755874971480550"
  }
]

查询token销毁数量

bhcli query supply burned
示例
bhcli query supply burned
成功返回
[
  {
    "denom": "hdt",
    "amount": "1000000000000"
  }
]

gov

查询gov模块所有参数

bhcli query gov params
示例
bhcli query gov params
成功返回
{
  "voting_params": {
    "voting_period": "172800000000000"
  },
  "tally_params": {
    "quorum": "0.334000000000000000",
    "threshold": "0.500000000000000000",
    "veto": "0.334000000000000000"
  },
  "deposit_params": {
    "min_init_deposit": [
      {
        "denom": "hbc",
        "amount": "100000000000000000000000"
      }
    ],
    "min_deposit": [
      {
        "denom": "hbc",
        "amount": "10000000000000000000000000"
      }
    ],
    "max_deposit_period": "172800000000000"
  }
}

查询gov模块的抵押,投票等参数

bhcli query gov param [voting/tallying/deposit]
示例
bhcli  query gov param deposit
成功返回
{
  "min_init_deposit": [
    {
      "denom": "hbc",
      "amount": "100000000000000000000000"
    }
  ],
  "min_deposit": [
    {
      "denom": "hbc",
      "amount": "10000000000000000000000000"
    }
  ],
  "max_deposit_period": "180000000000"
}

查询一个提案

根据proposal id精确的查询某个提案的内容

bhcli query gov proposal [proposal-id] [flags]
参数说明
名称 类型 参数说明
proposal-id string proposal id
示例
bhcli query gov proposal 1
成功返回
{
  "content": {
    "type": "bhexchain/TextProposal",
    "value": {
      "title": "Test Proposal Title",
      "description": "Test Proposal Contents"
    }
  },
  "id": "1",
  "proposal_status": "DepositPeriod",
  "final_tally_result": {
    "yes": "0",
    "abstain": "0",
    "no": "0",
    "no_with_veto": "0"
  },
  "submit_time": "2020-03-12T15:19:32.4261328Z",
  "deposit_end_time": "2020-03-14T15:19:32.4261328Z",
  "total_deposit": [
    {
      "denom": "hbc",
      "amount": "100000000000000000000000"
    }
  ],
  "voting_start_time": "0001-01-01T00:00:00Z",
  "voting_end_time": "0001-01-01T00:00:00Z"
}

查询一类提案

bhcli query gov proposals  [flags]
常用查询选项
名称 类型 参数说明
--depositor string 查询depositor抵押了资产的提案
--voter string voter 投过票的提案
--status string 提案目前的状态
示例
bhcli query gov proposals --depositor $(bhcli keys show -a alice)
bhcli query gov proposals --voter $(bhcli keys show -a alice)
bhcli query gov proposals --status (DepositPeriod|VotingPeriod|Passed|Rejected)

查询某voter对某提案的抵押信息

bhcli query gov deposit [proposal-id] [depositor-addr] [flags]
参数说明
名称 类型 参数说明
proposal-id string proposal id
depositor-addr string depositor地址
示例
bhcli query gov deposit 1 $(bhcli keys show -a alice)
成功返回
{
  "proposal_id": "1",
  "depositor": "HBCgS6KSUhmudwbh88tRynzVu86fFghFA6Pg",
  "amount": [
    {
      "denom": "hbc",
      "amount": "10100000000000000000000000"
    }
  ]
}

查询某提案的全部抵押信息

bhcli query gov deposits [proposal-id][flags] 
参数说明
名称 类型 参数说明
proposal-id string proposal id
示例
bhcli query gov deposits 1 
成功返回
{
  "proposal_id": "1",
  "depositor": "HBCgS6KSUhmudwbh88tRynzVu86fFghFA6Pg",
  "amount": [
    {
      "denom": "hbc",
      "amount": "10100000000000000000000000"
    }
  ]
}

查询某voter对某提案的投票信息

bhcli query gov vote [proposal-id] [voter-addr] [flags]
参数说明
名称 类型 参数说明
proposal-id string proposal id
depositor-addr string depositor地址
示例
bhcli query gov vote 1 $(bhcli keys show -a alice)
成功返回
{
  "proposal_id": "1",
  "voter": "HBCgS6KSUhmudwbh88tRynzVu86fFghFA6Pg",
  "option": "Yes"
}

查询某提案的全部投票信息

bhcli query gov votes [proposal-id] [flags]
参数说明
名称 类型 参数说明
proposal-id string proposal id
示例
bhcli query gov votes 1 
成功返回
[
  {
    "proposal_id": "1",
    "voter": "HBCjN2VxLCBMbFKafhjVa8auudMpTpmDgeE8",
    "option": "No"
  },
  {
    "proposal_id": "1",
    "voter": "HBCgS6KSUhmudwbh88tRynzVu86fFghFA6Pg",
    "option": "Yes"
  }
]

查询某提案的发起者

bhcli query gov proposer [proposal-id] [flags] 
参数说明
名称 类型 参数说明
proposal-id string proposal id
示例
bhcli query gov proposer 1
成功返回
{
  "proposal_id": "1",
  "proposer": "HBCgS6KSUhmudwbh88tRynzVu86fFghFA6Pg"
}

查询某提案投票结果

bhcli query gov tally [proposal-id] [flags] 
参数说明
名称 类型 参数说明
proposal-id string proposal id
示例
bhcli query gov tally 1
成功返回
{
  "yes": "0",
  "abstain": "0",
  "no": "0",
  "no_with_veto": "0"
}

staking

查询staking模块的参数

bhcli query staking params
示例
bhcli query staking params
成功返回
{
  "unbonding_time": "1814400000000000",
  "max_validators": 100,
  "max_entries": 7,
  "bond_denom": "hbc",
  "MinSelfDelegation": "5000000000000000000000000"
}

查询所有的validators

bhcli query staking validators
示例
bhcli query staking validators
成功返回
[
  {
    "operator_address": "hbcvaloper1mcfzdxltqmjfa8v5wrqrjjedqd8lu88f3hsmun",
    "consensus_pubkey": "hbcvalconspub1zcjduepq5r69dmml89q7l8thjkjxh0e0pj6efze4u99pt088373cu05lym4qf6f6v0",
    "jailed": false,
    "status": 2,
    "tokens": "50000000000000000000000000",
    "delegator_shares": "50000000000000000000000000.000000000000000000",
    "description": {
      "moniker": "moniker",
      "identity": "",
      "website": "",
      "details": ""
    },
    "unbonding_height": "0",
    "unbonding_time": "1970-01-01T00:00:00Z",
    "commission": {
      "commission_rates": {
        "rate": "0.100000000000000000",
        "max_rate": "0.200000000000000000",
        "max_change_rate": "0.010000000000000000"
      },
      "update_time": "2020-04-14T06:43:46.28981Z"
    },
    "min_self_delegation": "50000000000000000000000000"
  }

]

查询某一个validator

bhcli query staking validator [validator-addr] [flags]
参数说明
名称 类型 参数说明
validator-addr string 以hbcvaloper开头的validator地址
示例
bhcli query staking validator hbcvaloper1mcfzdxltqmjfa8v5wrqrjjedqd8lu88f3hsmun
成功返回
{
  "operator_address": "hbcvaloper1mcfzdxltqmjfa8v5wrqrjjedqd8lu88f3hsmun",
  "consensus_pubkey": "hbcvalconspub1zcjduepq5r69dmml89q7l8thjkjxh0e0pj6efze4u99pt088373cu05lym4qf6f6v0",
  "jailed": false,
  "status": 2,
  "tokens": "50000000000000000000000000",
  "delegator_shares": "50000000000000000000000000.000000000000000000",
  "description": {
    "moniker": "moniker",
    "identity": "",
    "website": "",
    "details": ""
  },
  "unbonding_height": "0",
  "unbonding_time": "1970-01-01T00:00:00Z",
  "commission": {
    "commission_rates": {
      "rate": "0.100000000000000000",
      "max_rate": "0.200000000000000000",
      "max_change_rate": "0.010000000000000000"
    },
    "update_time": "2020-04-14T06:43:46.28981Z"
  },
  "min_self_delegation": "50000000000000000000000000"
}

查询某delegtor给某validator的抵押

bhcli query staking delegation [delegator-addr] [validator-addr] [flags]
参数说明
名称 类型 参数说明
delegator-addr string 以HBC开头的delegator地址
validator-addr string 以hbcvaloper开头的validator地址
示例
bhcli query staking delegation HBCgS6KSUhmudwbh88tRynzVu86fFghFA6Pg hbcvaloper1mcfzdxltqmjfa8v5wrqrjjedqd8lu88f3hsmun
成功返回
{
  "delegator_address": "HBCgS6KSUhmudwbh88tRynzVu86fFghFA6Pg",
  "validator_address": "hbcvaloper1mcfzdxltqmjfa8v5wrqrjjedqd8lu88f3hsmun",
  "shares": "120000000000000000000.000000000000000000",
  "balance": "120000000000000000000"
}

查询某delegtor所有的抵押

bhcli query staking delegations [delegator-addr] [flags]
参数说明
名称 类型 参数说明
delegator-addr string 以HBC开头的delegator地址
示例
bhcli query staking delegations HBCgS6KSUhmudwbh88tRynzVu86fFghFA6Pg
成功返回
[
  {
    "delegator_address": "HBCgS6KSUhmudwbh88tRynzVu86fFghFA6Pg",
    "validator_address": "hbcvaloper136g7jus2k0x7xv7wfusf5npzl5c3uf2cgrwf7z",
    "shares": "50000000000000000000.000000000000000000",
    "balance": "50000000000000000000"
  },
  {
    "delegator_address": "HBCgS6KSUhmudwbh88tRynzVu86fFghFA6Pg",
    "validator_address": "hbcvaloper1mcfzdxltqmjfa8v5wrqrjjedqd8lu88f3hsmun",
    "shares": "120000000000000000000.000000000000000000",
    "balance": "120000000000000000000"
  }
]

查询某delegtor给某validator的正在解冻的抵押

bhcli query staking unbonding-delegation [delegator-addr] [validator-addr] [flags]
参数说明
名称 类型 参数说明
delegator-addr string 以HBC开头的delegator地址
validator-addr string 以hbcvaloper开头的validator地址
示例
bhcli query staking unbonding-delegation HBCgS6KSUhmudwbh88tRynzVu86fFghFA6Pg hbcvaloper1mcfzdxltqmjfa8v5wrqrjjedqd8lu88f3hsmun
成功返回
{
  "delegator_address": "HBCgS6KSUhmudwbh88tRynzVu86fFghFA6Pg",
  "validator_address": "hbcvaloper1mcfzdxltqmjfa8v5wrqrjjedqd8lu88f3hsmun",
  "entries": [
    {
      "creation_height": "5300",
      "completion_time": "2020-04-14T08:23:33.8255297Z",
      "initial_balance": "30000000000000000000",
      "balance": "30000000000000000000"
    }
  ]
}

查询某delegtor所有的正在解冻的抵押

bhcli query staking unbonding-delegations [delegator-addr] [flags]
参数说明
名称 类型 参数说明
delegator-addr string 以BHC开头的delegator地址
示例
bhcli query staking unbonding-delegations HBCgS6KSUhmudwbh88tRynzVu86fFghFA6Pg
成功返回
[
  {
    "delegator_address": "HBCgS6KSUhmudwbh88tRynzVu86fFghFA6Pg",
     "validator_address": "hbcvaloper1mcfzdxltqmjfa8v5wrqrjjedqd8lu88f3hsmun",
     "entries": [
       {
         "creation_height": "5300",
         "completion_time": "2020-04-14T08:23:33.8255297Z",
         "initial_balance": "30000000000000000000",
         "balance": "30000000000000000000"
       }
     ]
  }
]

查询某delegtor redeleagte的抵押

bhcli query staking redelegation [delegator-addr] [src-validator-addr] [dst-validator-addr] [flags]
参数说明
名称 类型 参数说明
delegator-addr string 以HBC开头的delegator地址
src-validator-add string 以hbcvaloper开头的源validator地址
dst-validator-addr string 以hbcvaloper开头的目的validator地址
示例
query staking redelegation HBCgS6KSUhmudwbh88tRynzVu86fFghFA6Pg hbcvaloper1mcfzdxltqmjfa8v5wrqrjjedqd8lu88f3hsmun hbcvaloper136g7jus2k0x7xv7wfusf5npzl5c3uf2cgrwf7z
成功返回
[
  {
    "delegator_address": "HBCgS6KSUhmudwbh88tRynzVu86fFghFA6Pg",
    "validator_src_address": "hbcvaloper1mcfzdxltqmjfa8v5wrqrjjedqd8lu88f3hsmun",
    "validator_dst_address": "hbcvaloper136g7jus2k0x7xv7wfusf5npzl5c3uf2cgrwf7z",
    "entries": [
      {
        "creation_height": 5891,
        "completion_time": "2020-04-14T08:19:58.6984724Z",
        "initial_balance": "50000000000000000000",
        "shares_dst": "50000000000000000000.000000000000000000",
        "balance": "50000000000000000000"
      }
    ]
  }
]

查询某delegtor所有redelegate抵押

bhcli query staking redelegations 
示例
bhcli query staking redelegations HBCgS6KSUhmudwbh88tRynzVu86fFghFA6Pg
成功返回
[
  {
    "delegator_address": "HBCgS6KSUhmudwbh88tRynzVu86fFghFA6Pg",
    "validator_src_address": "hbcvaloper1mcfzdxltqmjfa8v5wrqrjjedqd8lu88f3hsmun",
    "validator_dst_address": "hbcvaloper136g7jus2k0x7xv7wfusf5npzl5c3uf2cgrwf7z",
    "entries": [
      {
        "creation_height": 5891,
        "completion_time": "2020-04-14T08:19:58.6984724Z",
        "initial_balance": "50000000000000000000",
        "shares_dst": "50000000000000000000.000000000000000000",
        "balance": "50000000000000000000"
      }
    ]
  }
]

查询validator收到的所有抵押

  bhcli query staking delegations-to [validator-addr] [flags]
参数说明
名称 类型 参数说明
validator-addr string 以hbcvaloper开头的validator地址
示例
 bhcli query staking delegations-to hbcvaloper1mcfzdxltqmjfa8v5wrqrjjedqd8lu88f3hsmun
成功返回
[
  {
    "delegator_address": "HBCgS6KSUhmudwbh88tRynzVu86fFghFA6Pg",
    "validator_address": "hbcvaloper1mcfzdxltqmjfa8v5wrqrjjedqd8lu88f3hsmun",
    "shares": "120000000000000000000.000000000000000000",
    "balance": "120000000000000000000"
  },
  {
    "delegator_address": "BHj2wujKtAxw9XZMA7zDDvjGqKjoYUdw1FZ",
    "validator_address": "hbcvaloper1mcfzdxltqmjfa8v5wrqrjjedqd8lu88f3hsmun",
    "shares": "100000000000000000000000000.000000000000000000",
    "balance": "100000000000000000000000000"
  }
]

查询所有从某validator redelegate给其他validator 的抵押

bhcli query staking redelegations-from [validator-addr] [flags]
参数说明
名称 类型 参数说明
validator-addr string 以hbcvaloper开头的validator地址
示例
bhcli query staking redelegations-from hbcvaloper1mcfzdxltqmjfa8v5wrqrjjedqd8lu88f3hsmun
成功返回
[
  {
    "delegator_address": "HBCgS6KSUhmudwbh88tRynzVu86fFghFA6Pg",
    "validator_src_address": "hbcvaloper1mcfzdxltqmjfa8v5wrqrjjedqd8lu88f3hsmun",
    "validator_dst_address": "hbcvaloper136g7jus2k0x7xv7wfusf5npzl5c3uf2cgrwf7z",
    "entries": [
      {
        "creation_height": 5891,
        "completion_time": "2020-04-14T08:19:58.6984724Z",
        "initial_balance": "50000000000000000000",
        "shares_dst": "50000000000000000000.000000000000000000",
        "balance": "50000000000000000000"
      }
    ]
  }
]

查询validator正在解冻的抵押

bhcli query staking unbonding-delegations-from [validator-addr] [flags]
参数说明
名称 类型 参数说明
validator-addr string 以hbcvaloper开头的validator地址
示例
bhcli query staking unbonding-delegations-from hbcvaloper1mcfzdxltqmjfa8v5wrqrjjedqd8lu88f3hsmun
成功返回
[
  {
    "delegator_address": "HBCgS6KSUhmudwbh88tRynzVu86fFghFA6Pg",
    "validator_address": "hbcvaloper1mcfzdxltqmjfa8v5wrqrjjedqd8lu88f3hsmun",
    "entries": [
      {
        "creation_height": "5931",
        "completion_time": "2020-04-03T08:23:33.8255297Z",
        "initial_balance": "30000000000000000000",
        "balance": "30000000000000000000"
      }
    ]
  }
]

查询staking pool中的金额

$bhcli query staking pool
示例
$bhcli query staking pool
成功返回
{
  "not_bonded_tokens": "30000000000000000000",
  "bonded_tokens": "400000170000000000000000000"
}

distribution

查询distribution的参数

bhcli query distribution params
示例
bhcli query distribution params
成功返回
{
  "community_tax": "0.020000000000000000",
  "base_proposer_reward": "0.010000000000000000",
  "bonus_proposer_reward": "0.040000000000000000",
  "withdraw_addr_enabled": true
}

查询validator-outstanding-rewards

bhcli query distribution validator-outstanding-rewards [validator] [flags]
参数说明
名称 类型 参数说明
validator string 以hbcvaloper开头的validator地址
示例
bhcli query distribution validator-outstanding-rewards hbcvaloper1mcfzdxltqmjfa8v5wrqrjjedqd8lu88f3hsmun
成功返回
[
  {
    "denom": "hbc",
    "amount": "2660287954396406984212.455000000000000000"
  }
]

查询validator的commisssion

 bhcli query distribution commission [validator] [flags]
参数说明
名称 类型 参数说明
validator string 以hbcvaloper开头的validator地址
示例
bhcli query distribution commission hbcvaloper1mcfzdxltqmjfa8v5wrqrjjedqd8lu88f3hsmun
成功返回
null

注:因为目前几个validator 的commission都设置为0

查询validator的slashes

bhcli query distribution slashes [validator] [start-height] [end-height] [flags]
参数说明
名称 类型 参数说明
validator string hbcvaloper开头的validator地址
start-height string start hegiht
end-height string end hegiht
示例
bhcli query distribution slashes hbcvaloper1mcfzdxltqmjfa8v5wrqrjjedqd8lu88f3hsmun 0 100
成功返回
null

查询validator的rewards

bhcli query distribution rewards [delegator-addr] [<validator-addr>] [flags]
参数说明
名称 类型 参数说明
delegator-addr string 以HBC开头的delegator地址
validator-addr string 以hbcvaloper开头的validator地址,可选
示例
bhcli query distribution rewards HBCgS6KSUhmudwbh88tRynzVu86fFghFA6Pg hbcvaloper1mcfzdxltqmjfa8v5wrqrjjedqd8lu88f3hsmun
成功返回
[
  {
    "denom": "hbc",
    "amount": "962401463225280.000000000000000000"
  }
]

查询community-pool

bhcli query distribution community-pool
示例
bhcli query distribution community-pool
成功返回
[
  {
    "denom": "hbc",
    "amount": "219939930488250056843.400000000000000000"
  }
]

slashing

查询slashing的参数

bhcli query slashing params
示例
bhcli query slashing params
成功返回
{
  "max_evidence_age": "120000000000",
  "signed_blocks_window": "100",
  "min_signed_per_window": "0.500000000000000000",
  "downtime_jail_duration": "600000000000",
  "slash_fraction_double_sign": "0.050000000000000000",
  "slash_fraction_downtime": "0.010000000000000000"
}

查询一个validator 的签名信息

bhcli query slashing signing-info [validator-conspub] [flags]
参数说明
名称 类型 参数说明
validator-conspub string 以hbcvalconspub开头的validator 公钥
示例
bhcli query slashing signing-info hbcvalconspub1zcjduepq69plcv4nzg27qashf328q0p6uc8cdpl4u3fz5sd2ugz34nk0u4ws2zrp0f
成功返回
{
  "address": "hbcvalcons1h0muy2683gyp6ra2qph9hxwdfmxzw6x4xtkm8m",
  "start_height": "0",
  "index_offset": "8606",
  "jailed_until": "1970-01-01T00:00:00Z",
  "tombstoned": false,
  "missed_blocks_counter": "0"
}

hrc20

查询hrc20模块参数

bhcli query hrc20 params
示例
bhcli query hrc20 params
成功返回
{
  "issue_token_fee": "10000000000000000000000"
}

cu

查询某个cu的信息

bhcli query cu cuinfo [cu_addr][flags] 
参数说明
名称 类型 参数说明
cu-addr string 以HBC开头的托管托单元地址
示例
bhcli query cu cuinfo $(bhcli keys show -a alice)
成功返回
{
  "type": "bhexchain/CustodianUnit",
  "value": {
    "cu_type": "1",
    "address": "HBCgS6KSUhmudwbh88tRynzVu86fFghFA6Pg",
    "public_key": {
      "type": "tendermint/PubKeySecp256k1",
      "value": "AwvzJMjkXTRO9jmkEHiLi/2BHpwLuAR+SohLW2t3vwe/"
    },
    "sequence": "8",
    "coins": [
      {
        "denom": "hbc",
        "amount": "299999974110000000000000000"
      },
      {
        "denom": "eth",
        "amount": "17800000000000000"
      }
    ],
    "coins_hold": [
      {
        "denom": "eth",
        "amount": "2200000000000000"
      }
    ],
    "assets": [
      {
        "denom": "eth",
        "address": "0x0B2dE9E53f794A51D133afae5cF6142DA4130Fb3",
        "enbale_sendtx": false,
        "epoch": 1,
        "nonce": 0,
      }
    ],
    "asset_coins": [
      {
        "denom": "eth",
        "amount": "20000000000000000"
      }
    ],
    "asset_coins_hold": [],
    "cu_number": "0",
    "asset_pubkey": "Ats0/JuoM9z3VhMGRoUGoxXiZ+Uc9NUooVg+FtJL+Hrf",
    "gas_used": [],
    "gas_received": []
  }
}

查询某个cu 某个币种的数量

bhcli query cu cucoin [cu_addr][symbol] 
参数说明
名称 类型 参数说明
cu-addr string 以HBC开头的托管托单元地址
symbol string 币种名称
示例
bhcli query cu cucoin $(bhcli keys show -a alice) eth
成功返回
{
  "type": "bhexchain/CUCoin",
  "value": {
    "address": "HBCgS6KSUhmudwbh88tRynzVu86fFghFA6Pg",
    "denom": "eth",
    "amount": "17800000000000000",
    "amount_hold": "2200000000000000",
    "ext_amount": "20000000000000000",
    "ext_amount_hold": "0"
  }
}

查询某个币种的opcu信息

bhcli query cu op [symbol] 
参数说明
名称 类型 参数说明
symbol string 币种名称
示例
bhcli query cu op eth
成功返回
[
  {
    "symbol": "eth",
    "cu_address": "HBCaxX5tAug3F6Ygw5zBwSMtSA16MoLM4ULJ",
    "locked": false,
    "amount": "0",
    "multisign_adress": "",
    "deposit_list": null,
    "main_net_amount": "0",
    "gas_used": "0",
    "gas_received": "0"
  }
]

mapping

用于查询资产映射模块的信息

查询单个资产映射合约

bhcli query mapping info [issue-symbol]
参数说明
名称 类型 参数说明
issue-symbol string 被查询的资产映射合约的发行token symbol
返回值说明
名称 类型 返回值说明
issue_symbol string 资产映射合约的发行token symbol
target_symbol string 资产映射合约的映射目标token symbol
total_supply string 发行token总量,于映射目标token发行量一致
issue_pool string 发行池里剩余token总量,total_supply - issue-pool为发行出去的token总量
enabled bool 是否允许发行和兑换
示例
bhcli query mapping info cbtc
成功返回
{
  "issue_symbol": "cbtc",
  "target_symbol": "btc",
  "total_supply": "2100000000000000",
  "issue_pool": "2099999999876644",
  "enabled":true
}

查询所有资产映射合约

bhcli query mapping list
返回值说明

返回所有资产映射合约的信息,以数组方式,每个项内容参考上一节

示例
bhcli query mapping list
成功返回
[
	{
	  "issue_symbol": "cbtc",
	  "target_symbol": "btc",
	  "total_supply": "2100000000000000",
	  "issue_pool": "2099999999876644",
	  "enabled":true
	}
]

openswap

用于查询 openswap 模块的信息

查询交易对

bhcli query openswap pair [tokenA] [tokenB]
参数说明
名称 类型 参数说明
tokenA string 交易对的第一个币种
tokenB string 交易对的第二个币种
返回值说明
名称 类型 返回值说明
token_a string 交易对的第一个币种
token_b string 交易对的第二个币种
token_a_amount string 第一个币种的存量
token_b_amount string 第二个币种的存量
total_liquidity string 总流动性
示例
bhcli query openswap pair btc hbc
成功返回
{
  "token_a": "btc",
  "token_b": "hbc",
  "token_a_amount": "59384999484685",
  "token_b_amount": "3387962241353415397518",
  "total_liquidity": "447882661837354805"
}

查询某地址提供的流动性列表

bhcli query openswap liquidity [addr]
参数说明
名称 类型 参数说明
addr string 被查询的地址
返回值说明
名称 类型 返回值说明
trading_pair object 交易对信息
liquidity string 提供的流动性
liquidity_share string 提供的流动性占比
示例
bhcli query openswap liquidity HBCioVa2xVPuXhseov7KkMMNdV2GwnEuEopd
成功返回
[
  {
    "trading_pair": {
      "token_a": "btc",
      "token_b": "hbc",
      "token_a_amount": "10000000000000000000000",
      "token_b_amount": "4000000000000000000",
      "total_liquidity": "200000000000000000000"
    },
    "liquidity": "199999999999999999000",
    "liquidity_share": "0.999999999999999995"
  }
]

查询订单

bhcli query openswap order [orderID]
参数说明
名称 类型 参数说明
orderID string 订单号
返回值说明
名称 类型 返回值说明
order_id object 订单号
base_symbol string 基础币种
quote_symbol string 竞价币种
from string 交易对发起者
referer string 邀请人
receiver string 收款地址
created_time string 创建时间
expired_time string 订单过期时间,小于0表示不过期
finished_time string 订单完成时间
status int 订单状态,0-未成交;1-部分成交;2-完全成交;3-取消;4-过期
side int 订单方向,0-买;1-卖
price string 价格
amount_in string 花费的总资产数量
locked_fund string 锁定的资产数量
remain_quantity string 未成交数量
示例
bhcli query openswap order 75d04ab1-bb96-4874-b0a6-a1b0fbd2aa0b
成功返回
{
  "order_id": "75d04ab1-bb96-4874-b0a6-a1b0fbd2aa0b",
  "from": "HBCioVa2xVPuXhseov7KkMMNdV2GwnEuEopd",
  "referer": "HBCioVa2xVPuXhseov7KkMMNdV2GwnEuEopd",
  "receiver": "HBCioVa2xVPuXhseov7KkMMNdV2GwnEuEopd",
  "created_time": "1600668034",
  "expired_time": "-1",
  "finished_time": "0",
  "status": 0,
  "side": 1,
  "base_symbol": "btc",
  "quote_symbol": "hbc",
  "price": "650000000.000000000000000000",
  "amount_int": "3540000000",
  "locked_fund": "3540000000",
  "remain_quantity": "3540000000"
}

查询交易对的订单簿

bhcli query openswap orderbook [pair]
参数说明
名称 类型 参数说明
pair string 交易对
返回值说明
名称 类型 返回值说明
buy array 买单列表
sell array 卖单列表
示例
bhcli query openswap orderbook btc-hbc
成功返回
{
  "buy": [
    {
      "order_id": "bc18f239-993b-4682-bfba-0df70df92f8e",
      "from": "HBCioVa2xVPuXhseov7KkMMNdV2GwnEuEopd",
      "referer": "HBCioVa2xVPuXhseov7KkMMNdV2GwnEuEopd",
      "receiver": "HBCioVa2xVPuXhseov7KkMMNdV2GwnEuEopd",
      "created_time": "1600675273",
      "expired_time": "-1",
      "finished_time": "0",
      "status": 1,
      "side": 0,
      "base_symbol": "btc",
      "quote_symbol": "hbc",
      "price": "56000000.000000000000000000",
      "amount_int": "10000000000000000000",
      "locked_fund": "1325506233937552314"
   	}
  ],
  "sell": [
    {
      "order_id": "75d04ab1-bb96-4874-b0a6-a1b0fbd2aa0b",
      "from": "HBCioVa2xVPuXhseov7KkMMNdV2GwnEuEopd",
      "referer": "HBCioVa2xVPuXhseov7KkMMNdV2GwnEuEopd",
      "receiver": "HBCioVa2xVPuXhseov7KkMMNdV2GwnEuEopd",
      "created_time": "1600668034",
      "expired_time": "-1",
      "finished_time": "0",
      "status": 0,
      "side": 1,
      "base_symbol": "btc",
      "quote_symbol": "hbc",
      "price": "650000000.000000000000000000",
      "amount_int": "3540000000",
      "locked_fund": "3540000000"
    }
  ]

查询某地址的未成交订单

bhcli query openswap pending-orders [pair] [addr]
参数说明
名称 类型 参数说明
pair string 交易对
addr string 待查询地址
示例
bhcli query openswap pending-orders btc-hbc HBCioVa2xVPuXhseov7KkMMNdV2GwnEuEopd
成功返回
[
  {
    "order_id": "bc18f239-993b-4682-bfba-0df70df92f8e",
    "from": "HBCioVa2xVPuXhseov7KkMMNdV2GwnEuEopd",
    "referer": "HBCioVa2xVPuXhseov7KkMMNdV2GwnEuEopd",
    "receiver": "HBCioVa2xVPuXhseov7KkMMNdV2GwnEuEopd",
    "created_time": "1600675273",
    "expired_time": "-1",
    "finished_time": "0",
    "status": 1,
    "side": 0,
    "base_symbol": "btc",
    "quote_symbol": "hbc",
    "price": "56000000.000000000000000000",
    "amount_int": "10000000000000000000",
    "locked_fund": "1325506233937552314",
    "remain_quantity": "23669754177"
  }
]

查询某地址的未领取收益

bhcli query openswap earnings [addr]
参数说明
名称 类型 参数说明
addr string 待查询地址
返回值说明
名称 类型 返回值说明
token_a string 交易对的第一个币种
token_b string 交易对的第二个币种
amount string 待领取的 hdt 数量
示例
bhcli query openswap earnings HBCioVa2xVPuXhseov7KkMMNdV2GwnEuEopd
成功返回
[
  {
    "token_a": "btc",
    "token_a": "hbc",
    "amount": "120000000"
  }
]

查询openswap模块参数

bhcli query openswap params
返回值说明
名称 类型 返回值说明
minimum_liquidity string 交易对的最小流动性
fee_rate string 交易手续费比例
repurchase_rate string 回购资金比例
referer_transaction_bonus_rate string 邀请人奖励比例
referer_mining_bonus_rate string 邀请人挖矿奖励比例
mining_weights array 挖矿交易对权重
mining_plans array 代币挖矿周期
示例
bhcli query openswap params
成功返回
{
	"minimum_liquidity":"1000",
	"fee_rate":"0.002250000000000000",
	"repurchase_rate":"0.000500000000000000",
	"referer_transaction_bonus_rate":"0.000250000000000000",
	"referer_mining_bonus_rate":"0.100000000000000000",
	"mining_weights":[{"token_a":"hbc","token_b":"test","weight":"1"}],
	"mining_plans":[{"start_height":"1","mining_per_block":"3000000000"},{"start_height":"650001","mining_per_block":"1500000000"},{"start_height":"1000001","mining_per_block":"750000000"},{"start_height":"1700001","mining_per_block":"375000000"},{"start_height":"3500001","mining_per_block":"300000000"}]
}

tx

keygen

创建运营托管单元(OPCU)

bhcli tx keygen newopcu [from_key_or_address] [symbol] [Op_CU_address]
参数说明
名称 类型 参数说明
from_key_or_address string newopcu交易发起者地址
symbol string 币种
to string OPCU地址
示例

创建一个eth运营托管单元,地址为HBCPoshPen4yTWCwCvCVuwbfSmrb3EzNbXTo, 该地址必须是未被使用的地址

bhcli tx keygen newopcu HBCgS6KSUhmudwbh88tRynzVu86fFghFA6Pg eth HBCPoshPen4yTWCwCvCVuwbfSmrb3EzNbXTo --chain-id bhex-testnet --gas-prices 1000000000000.0hbc --home ../testnetdocker/node0/bhcli
成功返回
{
  "chain_id": "bhex-testnet",
  "cu_number": "0",
  "sequence": "664",
  "fee": {
    "amount": [
      {
        "denom": "hbc",
        "amount": "200000000000000000"
      }
    ],
    "gas": "200000"
  },
  "msgs": [
    {
      "type": "bhexchain/keygen/MsgNewOpCU",
      "value": {
        "Symbol": "eth",
        "From": "HBCgS6KSUhmudwbh88tRynzVu86fFghFA6Pg",
        "OpCUAddress": "HBCPoshPen4yTWCwCvCVuwbfSmrb3EzNbXTo"
      }
    }
  ],
  "memo": ""
}

confirm transaction before signing and broadcasting [y/N]: y
Password to sign with 'node0':<输入密码>
height: 0
txhash: B8FEF2E621686136882ADA19C939D959982D979C13BB51D3ACA29C4C964AC777
code: 0
data: ""
rawlog: '[{"msg_index":0,"success":true,"log":"","events":[{"type":"message","attributes":[{"key":"action","value":"new_op_cu"}]}]}]'
logs:
- msgindex: 0
  success: true
  log: ""
  events:
  - type: message
    attributes:
    - key: action
      value: new_op_cu
info: ""
gaswanted: 0
gasused: 0
codespace: ""
tx: null
timestamp: ""
events: []

为托管单元(CU)生成币种地址

keygen [from_key_or_address] [symbol] [to]
参数说明
名称 类型 参数说明
from_key_or_address string keygen交易发起者地址
symbol string 币种
to string 创建币种地址的所有者
示例

为HBCPoshPen4yTWCwCvCVuwbfSmrb3EzNbXTo 生成eth地址

bhcli tx keygen keygen HBCgS6KSUhmudwbh88tRynzVu86fFghFA6Pg eth HBCPoshPen4yTWCwCvCVuwbfSmrb3EzNbXTo --chain-id bhex-testnet --gas-prices 1000000000000.0hbc --home ../testnetdocker/node0/bhcli
成功返回
{
  "chain_id": "bhex-testnet",
  "cu_number": "0",
  "sequence": "603",
  "fee": {
    "amount": [
      {
        "denom": "hbc",
        "amount": "200000000000000000"
      }
    ],
    "gas": "200000"
  },
  "msgs": [
    {
      "type": "bhexchain/keygen/MsgKeyGen",
      "value": {
        "OrderId": "8aa29c69-2cd4-4dde-bb5c-273757bfdd6e",
        "Symbol": "eth",
        "From": "HBCgS6KSUhmudwbh88tRynzVu86fFghFA6Pg",
        "To": "HBCPoshPen4yTWCwCvCVuwbfSmrb3EzNbXTo"
      }
    }
  ],
  "memo": ""
}

confirm transaction before signing and broadcasting [y/N]: y
Password to sign with 'node0':<输入密码>
height: 0
txhash: 4ABC263EFFAC364ED966EE4654ADEC050D6A1C2886B229CE13556010111531E9
code: 4
data: ""
rawlog: '{"codespace":"bhexchain_base\","code":4,"message":"signature verification failed;
  verify correct CU sequence and chain-id"}'
logs: []
info: ""
gaswanted: 0
gasused: 0
codespace: ""
tx: null
timestamp: ""
events: []

gov

发起文本提案

bhcli tx gov submit-proposal --title="Test Proposal Title" --description="Test Proposal Contents" --type="Text" --deposit="10hbc" --from mykey --gas-prices 1000000000000.0hbc --votetime 1440

或者

bhcli tx gov submit-proposal --proposal="path/to/proposal.json" --from mykey --gas-prices 1000000000000.0hbc
参数说明
名称 类型 参数说明
title string 提案的标题
description string 提案的内容
type string 发起提案的类型(这里指定为Text
from string 提案发起者
votetime int 投票时间
示例
bhcli tx gov submit-proposal --title="Test Proposal Title" --description="Test Proposal Contents" --type="Text" --deposit="100000000000000000000000hbc" --from alice --gas-prices 1000000000000.0hbc
成功返回
{
  "height": "0",
  "txhash": "0CC5E052CBCEDE6167BEF4B818C2D728D52857C0C9514211BD389FCAD1723F03",
  "raw_log": "[{\"msg_index\":0,\"success\":true,\"log\":\"\",\"events\":[{\"type\":\"message\",\"attributes\":[{\"key\":\"action\",\"value\":\"submit_proposal\"}]}]}]",
  "logs": [
    {
      "msg_index": 0,
      "success": true,
      "log": "",
      "events": [
        {
          "type": "message",
          "attributes": [
            {
              "key": "action",
              "value": "submit_proposal"
            }
          ]
        }
      ]
    }
  ]
}

发起修改参数提案

tx gov submit-proposal param-change <path/to/proposal.json> --from=<key_or_address>
示例
bhcli tx gov submit-proposal param-change staking_params_change.json --from alice
成功返回
{
  "height": "0",
  "txhash": "1F065ACEB801774009F276623F241B5071222700F607015BAC2FCCC7D41C049F",
  "raw_log": "[{\"msg_index\":0,\"success\":true,\"log\":\"\",\"events\":[{\"type\":\"message\",\"attributes\":[{\"key\":\"action\",\"value\":\"submit_proposal\"}]}]}]",
  "logs": [
    {
      "msg_index": 0,
      "success": true,
      "log": "",
      "events": [
        {
          "type": "message",
          "attributes": [
            {
              "key": "action",
              "value": "submit_proposal"
            }
          ]
        }
      ]
    }
  ]
}

发起community-pool-spend提案

tx gov submit-proposal community-pool-spend <path/to/proposal.json> --from=<key_or_address>
示例
bhcli tx gov submit-proposal community-pool-spend community_pool_spend.json --from alice
成功返回
{
  "height": "0",
  "txhash": "1997BF6C8894CA067489367B2068F6A6CF31D73CF9BC7C2FB499E544B3573490",
  "raw_log": "[{\"msg_index\":0,\"success\":true,\"log\":\"\",\"events\":[{\"type\":\"message\",\"attributes\":[{\"key\":\"action\",\"value\":\"submit_proposal\"}]}]}]",
  "logs": [
    {
      "msg_index": 0,
      "success": true,
      "log": "",
      "events": [
        {
          "type": "message",
          "attributes": [
            {
              "key": "action",
              "value": "submit_proposal"
            }
          ]
        }
      ]
    }
  ]
}

发起投票上币提案

tx gov submit-proposal add-token <path/to/proposal.json> --from=<key_or_address>
示例
bhcli tx gov submit-proposal add-token add_token_proposal.json --from alice
成功返回
{
  "height": "0",
  "txhash": "CB3D975A6F6E8A77BAD7C0E6A4C6501E37E22A3BFF8960728039163217FC59CC",
  "raw_log": "[{\"msg_index\":0,\"success\":true,\"log\":\"\",\"events\":[{\"type\":\"message\",\"attributes\":[{\"key\":\"action\",\"value\":\"submit_proposal\"}]}]}]",
  "logs": [
    {
      "msg_index": 0,
      "success": true,
      "log": "",
      "events": [
        {
          "type": "message",
          "attributes": [
            {
              "key": "action",
              "value": "submit_proposal"
            }
          ]
        }
      ]
    }
  ]
}

发起修改币种参数提案

tx gov submit-proposal token-params-change <path/to/proposal.json> --from=<key_or_address>
示例
bhcli tx gov submit-proposal token-params-change token_params_change_proposal.json --from alice
成功返回
{
  "height": "0",
  "txhash": "BF91334DE36B2A5AAE41BC9A386CDDA89267D37C1B55692150C7AA11F4FB11A1",
  "raw_log": "[{\"msg_index\":0,\"success\":true,\"log\":\"\",\"events\":[{\"type\":\"message\",\"attributes\":[{\"key\":\"action\",\"value\":\"submit_proposal\"}]}]}]",
  "logs": [
    {
      "msg_index": 0,
      "success": true,
      "log": "",
      "events": [
        {
          "type": "message",
          "attributes": [
            {
              "key": "action",
              "value": "submit_proposal"
            }
          ]
        }
      ]
    }
  ]
}

发起投票下币提案

tx gov submit-proposal disable-token <path/to/proposal.json> --from=<key_or_address>
示例
bhcli tx gov submit-proposal disable-token disable_token_proposal.json --from alice
成功返回
{
  "height": "0",
  "txhash": "39C6730F288E515D02B5B233A8022E51C56A54C807BB2BC9E4A5DB4657A17CB7",
  "raw_log": "[{\"msg_index\":0,\"success\":true,\"log\":\"\",\"events\":[{\"type\":\"message\",\"attributes\":[{\"key\":\"action\",\"value\":\"submit_proposal\"}]}]}]",
  "logs": [
    {
      "msg_index": 0,
      "success": true,
      "log": "",
      "events": [
        {
          "type": "message",
          "attributes": [
            {
              "key": "action",
              "value": "submit_proposal"
            }
          ]
        }
      ]
    }
  ]
}

发起软件升级提案

bhcli tx gov submit-proposal software-upgrade [name] (--upgrade-height [height] | --upgrade-time [time]) (--upgrade-info [info]) --from=<key_or_address>
示例
bhcli tx gov submit-proposal software-upgrade mainnet_v2 --upgrade-height 100000000 --from alice
成功返回
{
  "height": "0",
  "txhash": "39C6730F288E515D02B5B233A8022E51C56A54C807BB2BC9E4A5DB4657A17CB7",
  "raw_log": "[{\"msg_index\":0,\"success\":true,\"log\":\"\",\"events\":[{\"type\":\"message\",\"attributes\":[{\"key\":\"action\",\"value\":\"submit_proposal\"}]}]}]",
  "logs": [
    {
      "msg_index": 0,
      "success": true,
      "log": "",
      "events": [
        {
          "type": "message",
          "attributes": [
            {
              "key": "action",
              "value": "submit_proposal"
            }
          ]
        }
      ]
    }
  ]
}

发起取消软件升级提案

bhcli tx gov submit-proposal cancel-software-upgrade --from=<key_or_address>
示例
bhcli tx gov submit-proposal cancel-software-upgrade --from alice
成功返回
{
  "height": "0",
  "txhash": "39C6730F288E515D02B5B233A8022E51C56A54C807BB2BC9E4A5DB4657A17CB7",
  "raw_log": "[{\"msg_index\":0,\"success\":true,\"log\":\"\",\"events\":[{\"type\":\"message\",\"attributes\":[{\"key\":\"action\",\"value\":\"submit_proposal\"}]}]}]",
  "logs": [
    {
      "msg_index": 0,
      "success": true,
      "log": "",
      "events": [
        {
          "type": "message",
          "attributes": [
            {
              "key": "action",
              "value": "submit_proposal"
            }
          ]
        }
      ]
    }
  ]
}

发起增加 mapping 币对提案

bhcli tx gov submit-proposal add-mapping [issue-symbol] [target-symbol] [total-supply] --from=<key_or_address>
示例
bhcli tx gov submit-proposal add-mapping cbtc btc 2100000000000000 --from alice
成功返回
{
  "height": "0",
  "txhash": "39C6730F288E515D02B5B233A8022E51C56A54C807BB2BC9E4A5DB4657A17CB7",
  "raw_log": "[{\"msg_index\":0,\"success\":true,\"log\":\"\",\"events\":[{\"type\":\"message\",\"attributes\":[{\"key\":\"action\",\"value\":\"submit_proposal\"}]}]}]",
  "logs": [
    {
      "msg_index": 0,
      "success": true,
      "log": "",
      "events": [
        {
          "type": "message",
          "attributes": [
            {
              "key": "action",
              "value": "submit_proposal"
            }
          ]
        }
      ]
    }
  ]
}

发起开启/关闭 mapping 币对提案

bhcli tx gov submit-proposal switch-mapping [issue-symbol] [enable] --from=<key_or_address>
示例
bhcli tx gov submit-proposal switch-mapping cbtc false --from alice
成功返回
{
  "height": "0",
  "txhash": "39C6730F288E515D02B5B233A8022E51C56A54C807BB2BC9E4A5DB4657A17CB7",
  "raw_log": "[{\"msg_index\":0,\"success\":true,\"log\":\"\",\"events\":[{\"type\":\"message\",\"attributes\":[{\"key\":\"action\",\"value\":\"submit_proposal\"}]}]}]",
  "logs": [
    {
      "msg_index": 0,
      "success": true,
      "log": "",
      "events": [
        {
          "type": "message",
          "attributes": [
            {
              "key": "action",
              "value": "submit_proposal"
            }
          ]
        }
      ]
    }
  ]
}

为某个提案抵押资金

bhcli tx gov deposit [proposal-id] [amount]
参数说明
名称 类型 参数说明
proposal-id string proposal id
amount string 抵押的资金
示例
bhcli tx gov deposit 1 10000000000000000000000000hbc --gas-prices 1000000000000.0hbc --from alice
成功返回
{
  "height": "0",
  "txhash": "83729758C6E2986772AED8CFB244B7954CF1EA5C044577101226A0EBFDCC4E68",
  "raw_log": "[{\"msg_index\":0,\"success\":true,\"log\":\"\",\"events\":[{\"type\":\"message\",\"attributes\":[{\"key\":\"action\",\"value\":\"deposit\"}]}]}]",
  "logs": [
    {
      "msg_index": 0,
      "success": true,
      "log": "",
      "events": [
        {
          "type": "message",
          "attributes": [
            {
              "key": "action",
              "value": "deposit"
            }
          ]
        }
      ]
    }
  ]
}

为某个提案投票

bhcli tx gov vote [proposal-id] [option] [flags]
参数说明
名称 类型 参数说明
proposal-id string proposal id
options string 投票选项yes/no/abstain/nowithveto
示例
bhcli tx gov vote 1 yes --from alice --gas-prices 1000000000000.0hbc
成功返回
{
  "height": "0",
  "txhash": "479517D2CDC084C0393DD4E9DB2B7FDDD6A1E9C166EAF893ABAB089B27A8F667",
  "raw_log": "[{\"msg_index\":0,\"success\":true,\"log\":\"\",\"events\":[{\"type\":\"message\",\"attributes\":[{\"key\":\"action\",\"value\":\"vote\"}]}]}]",
  "logs": [
    {
      "msg_index": 0,
      "success": true,
      "log": "",
      "events": [
        {
          "type": "message",
          "attributes": [
            {
              "key": "action",
              "value": "vote"
            }
          ]
        }
      ]
    }
  ]
}

为 DAO 提案投票

DAO 提案为通过特定代币进行投票的提案,投票后会锁定对应数量的代币,取消投票或者投票结束后会立即反还代币。

bhcli tx gov daovote [proposal-id] [coin] [option] [flags]
参数说明
名称 类型 参数说明
proposal-id string proposal id
coin string 代币数量
options string 投票选项yes/no/abstain/nowithveto
示例

用 hdt 代币对 1 号提案投 3000 赞成票。

bhcli tx gov daovote 1 3000hdt yes --from alice --gas-prices 1000000000000.0hbc

取消 DAO 投票

bhcli tx gov canceldaovote [proposal-id] [flags]
参数说明
名称 类型 参数说明
proposal-id string proposal id
示例

对 1 号提案取消 DAO 投票。

bhcli tx gov canceldaovote 1 --from alice --gas-prices 1000000000000.0hbc

staking

创建 validator

bhcli tx staking create-validator [flags]
参数说明
名称 类型 参数说明
pubkey string 签名区块的公私钥对的公钥
amount string 质押的币种以及金额
commission-max-rate string 佣金最大比例
commission-rate string 佣金比例
commission-max-change-rate string 佣金最大更新比例
min-self-delegation string 最少自我质押数量
moniker string 节点名称
website string 节点网站
details string 节点描述
示例
bhcli tx staking create-validator --moniker alice --pubkey hbcvalconspub1zcjduepqcwj0py8n8rp5xf56744eydnsd3vpt9auhlste8ex0u863h9hvzesyqv5l8 --amount 100000000000000000000000hbc --commission-max-rate 0 --commission-rate 0 --commission-max-change-rate 0 --min-self-delegation 1000000000000000000 --from node0 --home testnet/node0/bhcli --from alice --gas-prices 1000000000000.0hbc

更新 validator 信息

bhcli tx staking edit-validator [flags]
参数说明
名称 类型 参数说明
description string 节点描述
commission-rate string 佣金比例
min-self-delegation string 最少自我质押数量
moniker string 节点名称
website string 节点网站
details string 节点描述
key-node bool 是否成为核心节点
示例
bhcli tx staking edit-validator --key-node true --from alice --gas-prices 1000000000000.0hbc

将资产抵押给validator

bhcli tx staking delegate [validator-addr] [amount] [flags]
参数说明
名称 类型 参数说明
validator-addr string 以hbcvaloper开头的validator地址
amount string 币种以及金额
示例
bhcli tx staking delegate hbcvaloper1mcfzdxltqmjfa8v5wrqrjjedqd8lu88f3hsmun  100000000000000000000hbc --from alice --gas-prices 1000000000000.0hbc
成功返回
{
  "height": "0",
  "txhash": "127DE69768E413CDBADB15F3A220DD22FE5D1984F1143D525EBE934A6D4DD171",
  "raw_log": "[{\"msg_index\":0,\"success\":true,\"log\":\"\",\"events\":[{\"type\":\"message\",\"attributes\":[{\"key\":\"action\",\"value\":\"delegate\"}]}]}]",
  "logs": [
    {
      "msg_index": 0,
      "success": true,
      "log": "",
      "events": [
        {
          "type": "message",
          "attributes": [
            {
              "key": "action",
              "value": "delegate"
            }
          ]
        }
      ]
    }
  ]
}

将资产从一个validator 抵押给另外一个validator

bhcli tx staking redelegate [src-validator-addr] [dst-validator-addr] [amount] [flag]
参数说明
名称 类型 参数说明
src-validator-addr string 以hbcvaloper开头的源validator地址
dst-validator-addr string 以hbcvaloper开头的目的validator地址
amount string 币种以及金额
示例
bhcli tx staking redelegate hbcvaloper1mcfzdxltqmjfa8v5wrqrjjedqd8lu88f3hsmun hbcvaloper136g7jus2k0x7xv7wfusf5npzl5c3uf2cgrwf7z 50000000000000000000hbc --from alice --gas-prices 1000000000000.0hbc
成功返回
{
  "height": "0",
  "txhash": "1B72BF06683454C90E4C956B5AE865F782CF9777B71481CA9211CB92236AA7A1",
  "raw_log": "[{\"msg_index\":0,\"success\":true,\"log\":\"\",\"events\":[{\"type\":\"message\",\"attributes\":[{\"key\":\"action\",\"value\":\"begin_redelegate\"}]}]}]",
  "logs": [
    {
      "msg_index": 0,
      "success": true,
      "log": "",
      "events": [
        {
          "type": "message",
          "attributes": [
            {
              "key": "action",
              "value": "begin_redelegate"
            }
          ]
        }
      ]
    }
  ]
}

取消抵押给validator

bhcli tx staking unbond [validator-addr] [amount] [flags]
参数说明
名称 类型 参数说明
validator-addr string 以hbcvaloper开头的validator地址
amount string 币种以及金额
示例
bhcli tx staking unbond hbcvaloper1mcfzdxltqmjfa8v5wrqrjjedqd8lu88f3hsmun 100000000000000000000hbc --from alice --gas-prices 1000000000000.0hbc

distribution

设置delegator rewards 的受益地址

 bhcli tx distribution set-withdraw-addr [withdraw-addr] [flags]
参数说明
名称 类型 参数说明
withdraw-addr string 以HBC开头受益托管单元地址
示例
 bhcli tx distribution set-withdraw-addr HBCgS6KSUhmudwbh88tRynzVu86fFghFA6Pg --from mykey --gas-prices 1000000000000.0hbc
成功返回
{
  "height": "0",
  "txhash": "24476645A437C61A6560E1B3C12A94A21265223AE20649148EA238BD323C84C8",
  "raw_log": "[{\"msg_index\":0,\"success\":true,\"log\":\"\",\"events\":[{\"type\":\"message\",\"attributes\":[{\"key\":\"action\",\"value\":\"set_withdraw_address\"}]}]}]",
  "logs": [
    {
      "msg_index": 0,
      "success": true,
      "log": "",
      "events": [
        {
          "type": "message",
          "attributes": [
            {
              "key": "action",
              "value": "set_withdraw_address"
            }
          ]
        }
      ]
    }
  ]
}

从某个validator提取抵押收益

bhcli tx distribution withdraw-rewards [validator-addr] [flags]
参数说明
名称 类型 参数说明
validator-addr string 以hbcvaloper开头的validator地址
示例
bhcli tx distribution withdraw-rewards hbcvaloper1mcfzdxltqmjfa8v5wrqrjjedqd8lu88f3hsmun --from alice --gas-prices 1000000000000.0hbc
成功返回
{
  "height": "0",
  "txhash": "FE63EC4BE20EF947F58C847DF935F6951155F4F9DD1AE519A7F9FBAF6925B7F5",
  "raw_log": "[{\"msg_index\":0,\"success\":true,\"log\":\"\",\"events\":[{\"type\":\"message\",\"attributes\":[{\"key\":\"action\",\"value\":\"withdraw_delegator_reward\"}]}]}]",
  "logs": [
    {
      "msg_index": 0,
      "success": true,
      "log": "",
      "events": [
        {
          "type": "message",
          "attributes": [
            {
              "key": "action",
              "value": "withdraw_delegator_reward"
            }
          ]
        }
      ]
    }
  ]
}

从所有validator提取抵押收益

bhcli tx distribution withdraw-all-rewards [flags]
示例
bhcli tx distribution withdraw-all-rewards --from alice --gas-prices 1000000000000.0hbc
成功返回
{
  "height": "0",
  "txhash": "E8602B91CC973EBB4369277C18364CFB1663BED3F1E565FFBE19C0D2AE47F7BE",
  "raw_log": "[{\"msg_index\":0,\"success\":true,\"log\":\"\",\"events\":[{\"type\":\"message\",\"attributes\":[{\"key\":\"action\",\"value\":\"withdraw_delegator_reward\"}]}]},{\"msg_index\":1,\"success\":true,\"log\":\"\",\"events\":[{\"type\":\"message\",\"attributes\":[{\"key\":\"action\",\"value\":\"withdraw_delegator_reward\"},{\"key\":\"action\",\"value\":\"withdraw_delegator_reward\"}]}]}]",
  "logs": [
    {
      "msg_index": 0,
      "success": true,
      "log": "",
      "events": [
        {
          "type": "message",
          "attributes": [
            {
              "key": "action",
              "value": "withdraw_delegator_reward"
            }
          ]
        }
      ]
    },
    {
      "msg_index": 1,
      "success": true,
      "log": "",
      "events": [
        {
          "type": "message",
          "attributes": [
            {
              "key": "action",
              "value": "withdraw_delegator_reward"
            },
            {
              "key": "action",
              "value": "withdraw_delegator_reward"
            }
          ]
        }
      ]
    }
  ]
}

transfer

Bhex Chain系统内部转账

bhcli tx transfer send [from] [to][amount][flags] 
参数说明
名称 类型 参数说明
from string 资产的所有者
to string 转入的托管单元地址
amount string 币种以及金额,多个资产是以逗号分隔。例如100hbc,2btc
示例
bhcli tx transfer send alice  HBCjN2VxLCBMbFKafhjVa8auudMpTpmDgeE8  1000000000000000hbc --chain-id bhex-testnet  --gas-prices 1000000000000.0hbc

成功返回

{
  "height": "0",
  "txhash": "229673703B6FB3CDE418436B8B7B7C39D13A9B7FA643A77500E0D915A4872DD8",
  "raw_log": "[{\"msg_index\":0,\"success\":true,\"log\":\"\",\"events\":[{\"type\":\"message\",\"attributes\":[{\"key\":\"action\",\"value\":\"new-token\"}]}]}]",
  "logs": [
    {
      "msg_index": 0,
      "success": true,
      "log": "",
      "events": [
        {
          "type": "message",
          "attributes": [
            {
              "key": "action",
              "value": "new-token"
            }
          ]
        }
      ]
    }
  ]
}

将外链资产充值到Bhex Chain

bhcli tx transfer deposit [from_key_or_address] [toCU_address] [to_address] [coin] [txhash] [index] [memo] [height] [flags]
参数说明
名称 类型 参数说明
from_key_or_address string 充值的发起人,可以是toCU的所有者也可以是其他人
to_cu string 被充值的托管单元地址
to_address string 被充值的托管单元地址对应币种的外链(例如:btc eth)地址
amount string 币种以及金额
hash string 外链交易hash
index string 外链交易索引,对于utxo类型资产, index 等于Vout中的index值;对于账户类型资产,index = 0
memo string 外链交易中附带的memo
height string 外链交易发生的区块高度
示例
bhcli tx transfer deposit alice $(bhcli keys show -a bob) 0x6537f7fb0064aaa4b5b9f379d24133027155b727 10000000000000000eth 0x228409bb2999911b94f0513f101f3fcf212058b7af18c88c625b41ddf20a0c6b 0 memo 7505327 --chain-id bhex-testnet --gas-prices 1000000000000.0hbc
成功返回
{ 
height: 0
txhash: E81EC801B96C99E99BA2EAA73624AF5FAA7A0356894846BB11C70D57B62937AD
code: 0
data: ""
rawlog: '[{"msg_index":0,"success":true,"log":"","events":[{"type":"message","attributes":[{"key":"action","value":"deposit"}]}]}]'
logs:
- msgindex: 0
  success: true
  log: ""
  events:
  - type: message
    attributes:
    - key: action
      value: deposit
info: ""
gaswanted: 0
gasused: 0
codespace: ""
tx: null
timestamp: ""
events: []
}

将资产提现到外链地址

bhcli tx transfer withdrawal [from_key_or_address] [to_address] [amount] [gas] [flags]
参数说明
名称 类型 参数说明
from_key_or_address string 充值的发起人,可以是toCU的所有者也可以是其他人
to_address string 被充值的托管单元地址对应币种的外链(例如:btc eth)地址
amount string 币种以及金额
gas string 以外链币计价的手续费
示例
bhcli tx transfer withdrawal --chain-id bhex-testnet alice  0xc96d141c9110a8E61eD62caaD8A7c858dB15B82c  1200000000000000eth  1000000000000000 --gas-prices 1000000000000.0hbc
成功返回
{
  "height": "0",
  "txhash": "F240EB278D946EA9C1DD999A56E54D8ADD3BE16FA9A93F5CF9BD8DE4DAD179DA",
  "raw_log": "[{\"msg_index\":0,\"success\":true,\"log\":\"\",\"events\":[{\"type\":\"message\",\"attributes\":[{\"key\":\"action\",\"value\":\"withdrawal\"}]}]}]",
  "logs": [
    {
      "msg_index": 0,
      "success": true,
      "log": "",
      "events": [
        {
          "type": "message",
          "attributes": [
            {
              "key": "action",
              "value": "withdrawal"
            }
          ]
        }
      ]
    }
  ]
}

hrc20

一键发币

在bhex链上,用户缴纳了hrc20 参数中定义的发行费用(缺省为10000000000000000000000 * pow(10, -18)hbc)

bhcli tx hrc20 new-token [to][symbol][decimals][totalSupply] [flags]
参数说明
名称 类型 参数说明
to string 资产的所有者
symbol string 新发币种的名称,不能与token模块中已有币种名称和预留币种名称冲突
decimals int 精度,最小精度不能超过18位
totalSupply int 总发行量,以最小精度为单位
示例
bhcli tx hrc20 new-token $(bhcli keys show -a alice) mytoken 18 10000000000000000000000000000 --from alice
成功返回
{
  "height": "0",
  "txhash": "229673703B6FB3CDE418436B8B7B7C39D13A9B7FA643A77500E0D915A4872DD8",
  "raw_log": "[{\"msg_index\":0,\"success\":true,\"log\":\"\",\"events\":[{\"type\":\"message\",\"attributes\":[{\"key\":\"action\",\"value\":\"new-token\"}]}]}]",
  "logs": [
    {
      "msg_index": 0,
      "success": true,
      "log": "",
      "events": [
        {
          "type": "message",
          "attributes": [
            {
              "key": "action",
              "value": "new-token"
            }
          ]
        }
      ]
    }
  ]
}

mapping

映射发行和兑换

通过一个资产映射合约,用户可以抵押映射发行或者兑换发行token和目标token。

bhcli tx mapping swap [issue-symbol] [coins] [flags]
参数说明
名称 类型 参数说明
issue-symbol string 资产映射合约的发行token
coins string 需要兑换的coins,只能有一个coin,必须是发行token或者目标token
示例
# 从cbtc映射合约里,抵押50btc,发行出50cbtc
bhcli tx mapping swap --chain-id bhex-testnet cbtc 50btc --from alice
# 从cbtc映射合约里,抵押50cbtc,兑换回50btc
bhcli tx mapping swap --chain-id bhex-testnet cbtc 50cbtc --from alice
成功返回
{
  "height":"322",
  "txhash":"DA166288EEEAFD331C5C4DA8E74F03591AA6349E6D0FF6EB9B2C1F7FD6FDFA51",
  "data":"{Category:9 Flows:[{CUAddress:A8909558F38E0758CAFC0FFE47E396E3F9209F19 Symbol:btc PreviousBalance:123333 BalanceChange:-50 PreviousBalanceOnHold:0 BalanceOnHoldChange:0} {CUAddress:A8909558F38E0758CAFC0FFE47E396E3F9209F19 Symbol:cbtc PreviousBalance:2099999986296176 BalanceChange:50 PreviousBalanceOnHold:0 BalanceOnHoldChange:0} {IssueSymbol:cbtc PreviousIssuePool:2099999999876644 IssuePoolChange:50}]}",
  "raw_log":"[{\"msg_index\":0,\"success\":true,\"log\":\"\",\"events\":[{\"type\":\"message\",\"attributes\":[{\"key\":\"action\",\"value\":\"mapping-swap\"}]}]}]",
  "logs":[
    {
      "msg_index":0,
      "success":true,
      "log":"",
      "events":[
        {
          "type":"message",
          "attributes":[
            {
              "key":"action",
              "value":"mapping-swap"
            }
          ]
        }
      ]
    }
  ],
  "gas_wanted":"200000",
  "gas_used":"43214",
  "tx":{
    "type":"bhexchain/StdTx",
    "value":{
      "msg":[
        {
          "type":"bhexchain/mapping/MsgMappingSwap",
          "value":{
            "from":"HBCbZBHmdhWg191SuYwaCVeco124THfZX1r5",
            "issue_symbol":"cbtc",
            "coins":[
              {
                "denom":"btc",
                "amount":"50"
              }
            ]
          }
        }
      ],
      "fee":{
        "amount":[

        ],
        "gas":"200000"
      },
      "signatures":[
        {
          "pub_key":{
            "type":"tendermint/PubKeySecp256k1",
            "value":"AvVo1DcSSvHMErFKfvcAM+JmJ0RytYGXg9Tlj0Dy7IIY"
          },
          "signature":"1+tLQUE8OWAcAcNAwugTzq9UyTMKF2EBM8Ru6OwygL88HAnAzDmrSEzmiI3n8dWzUJqIIIPbcR6bmktmYWLwOg=="
        }
      ],
      "memo":""
    }
  },
  "timestamp":"2020-04-16T09:47:53Z",
  "events":[
    {
      "type":"message",
      "attributes":[
        {
          "key":"action",
          "value":"mapping-swap"
        }
      ]
    }
  ]
}

openswap

增加流动性

 bhcli tx openswap add-liquidity [flags]
参数说明
名称 类型 参数说明
token-a string 交易对的第一个币种
token-b string 交易对的第二个币种
token-a-amt string 第一个币种的数量
token-b-amt string 第二个币种的数量
示例
bhcli tx openswap add-liquidity --token-a btc --token-b hbc --token-a-amt 300000000 --token-b-amt 300000000000 --from mykey --gas-prices 1000000000000.0hbc

移除流动性

 bhcli tx openswap remove-liquidity [flags]
参数说明
名称 类型 参数说明
token-a string 交易对的第一个币种
token-b string 交易对的第二个币种
liquidity string 移除的流动性数值
示例
bhcli tx openswap remove-liquidity --token-a btc --token-b hbc --liquidity 547720 --from mykey --gas-prices 1000000000000.0hbc

用固定数量的代币兑换另一种代币

 bhcli tx openswap exact-in [flags]
参数说明
名称 类型 参数说明
amt-in string 花费的代币数量
min-amt-out string 期望获得的最小代币数量
path string 兑换路径
示例
bhcli tx openswap exact-in --amt-in 5000000 --path btc,hbc --min-amt-out 1 --from mykey --gas-prices 1000000000000.0hbc

用未知数量的代币兑换固定数量的另一种代币

 bhcli tx openswap exact-out [flags]
参数说明
名称 类型 参数说明
max-amt-in string 期望花费的最大代币数量
amt-out string 获得的代币数量
path string 兑换路径
示例
bhcli tx openswap exact-out --max-amt-in 5000000 --path btc,hbc --amt-out 1 --from mykey --gas-prices 1000000000000.0hbc

创建限价订单

 bhcli tx openswap limit [flags]
参数说明
名称 类型 参数说明 备注
base-symbol string 基础币种 base-symbol 为交易对中按字符排序较小的币种,如 btc-hbc 交易对,btc 的字符排序小,所以 base-symbol 为 btc
quote-symbol string 竞价币种 quote-symbol 为交易对中按字符排序较大的币种,如 btc-hbc 交易对,hbc 的字符排序大,所以 quote-symbol 为 hbc
side int 方向,0-买;1-卖
amt-in string 花费的代币数量 当为买单时(side为0),amt-in 为 quote-symbol 的数量;当为卖单时(side为1),amt-in 为 base-symbol 的数量;
price string 兑换价格 price 为兑换 1 个 base-symbol 所需的 quote-symbol 数量,要按照币种的最小精度计算
示例
bhcli tx openswap limit --base-symbol btc --quote-symbol hbc --price 1 --amt-in 340000 --side 0 --from mykey --gas-prices 1000000000000.0hbc

取消限价订单

 bhcli tx openswap cancel [order-ids]
参数说明
名称 类型 参数说明
order-ids string 批量取消的订单号,若有多个订单号,需要用逗号连接
示例
bhcli tx openswap cancel 99466110-708d-47b4-8276-390bf115d675,27eca534-7cd8-4c78-abec-823ffff78afb --from mykey --gas-prices 1000000000000.0hbc

领取某交易对的流动性奖励

 bhcli tx openswap claim [flags]
参数说明
名称 类型 参数说明
token-a string 交易对的第一个币种
token-b string 交易对的第二个币种
示例
bhcli tx openswap claim --token-a btc --token-b hbc --from mykey --gas-prices 1000000000000.0hbc

rest-server

从本地启动一个rest server

bhcli rest-server [flags] 
名称 类型 flag说明
laddr string string rest server监听地址,(default "tcp://localhost:1317")
max-open uint 最大连接数
node string 链节点地址:,(default "tcp://localhost:26657")
trust-node string 信任连接的节点

示例

bhcli rest-server --home node0/bhcli --chain-id bhex-testnet --node tcp://127.0.0.1:26657 --trust-node true 

正常返回

I[2020-03-14|09:18:04.726] Starting application REST service (chain-id: "bhex-testnet")... module=rest-server
I[2020-03-14|09:18:04.727] Starting RPC HTTP server on 127.0.0.1:1317   module=rest-server

keys

本地密钥库主要包含以下指令:

密钥库为本地存储,默认存储位置为:$HOME/.bhcli/keys/,删除存储文件会清空本地存储所有私钥。通过keys相关指令操作密钥不影响QOS网络中账户状态,请妥善保管账户私钥信息。

新增

bhcli keys add <key_name>

<key_name>可随意填写,仅作为本地密钥库密钥区分。

如下指令将生成一个名字为Alice的密钥到本地密钥库:

$ bhcli keys add Alice
Enter a passphrase to encrypt your key to disk:<输入密码>
Repeat the passphrase:<重复上面输入的密码>
NAME:	TYPE:	ADDRESS:						PUBKEY:
- name: alice
  type: local
  address: HBCgS6KSUhmudwbh88tRynzVu86fFghFA6Pg
  pubkey: hbcpub1addwnpepqwkg5c0dvfpz9guv3hegastumkre8e5lh2fvw6kgxhq74vxd97am6kmsnf0
  mnemonic: ""
  threshold: 0
  pubkeys: []


**Important** write this mnemonic phrase in a safe place.
It is the only way to recover your CU if you ever forget your password.

rare nuclear foster thunder wonder core section file utility service quiz correct lion frost piano split aisle weather depth main trumpet lobster fire connect

其中HBCgS6KSUhmudwbh88tRynzVu86fFghFA6Pg为适用于QOS网络的账户地址,hbcpub1addwnpepqwkg5c0dvfpz9guv3hegastumkre8e5lh2fvw6kgxhq74vxd97am6kmsnf0为账户公钥信息,rare nuclear foster thunder wonder core section file utility service quiz correct lion frost piano split aisle weather depth main trumpet lobster fire connect为助记词,可用于账户私钥找回,请妥善保管助记词。

列表

bhcli keys list

$ bhcli keys list

[
  {
    "name": "alice",
    "type": "local",
    "address": "HBCgS6KSUhmudwbh88tRynzVu86fFghFA6Pg",
    "pubkey": "hbcpub1addwnpepqwkg5c0dvfpz9guv3hegastumkre8e5lh2fvw6kgxhq74vxd97am6kmsnf0"
  },
  {
    "name": "bob",
    "type": "local",
    "address": "HBCjN2VxLCBMbFKafhjVa8auudMpTpmDgeE8",
    "pubkey": "hbcpub1addwnpepqdds5tew3ekhjnjsn0yekl3wralnncek49399yhj79c97d7mzt90zgh3l3f"
  },
  {
    "name": "jack",
    "type": "local",
    "address": "HBCVtF1oamkwbczjt5R3mY8j64ZSx9tJqDgL",
    "pubkey": "hbcpub1addwnpepqdnx9rkxuxmc0g35xxjalhd7wcq8lc40zjs7yra00vjt8h0pphgt62weaw9"
  },
  {
    "name": "tom",
    "type": "local",
    "address": "HBCa7p52Zr1ZVj52Ldc5uFpEMDP6PhzbtxrN",
    "pubkey": "hbcpub1addwnpepq0zu4dz4lrm5g5vy524j94qypeunlyf8u8zxedw3ku6whnskdnyjqe94dce"
  }
]

更新

bhcli keys update <key_name>

更新Alice存储密码:

$ bhcli keys update Alice
Enter the current passphrase:<输入当前密码>
Enter the new passphrase:<输入新密码>
Repeat the new passphrase:<重复新密码>
Password successfully updated!

导出

bhcli keys export <key_name>

导出Alice密钥信息:

bhcli keys export Alice
Enter passphrase to decrypt your key:<输入当前密码>
Enter passphrase to encrypt the exported key:<输入密码>
-----BEGIN TENDERMINT PRIVATE KEY-----
salt: A6528A0F9D47D2A8E949037D27A4BDD8
kdf: bcrypt

3DgFM6oCq7DWwxxjkzEvk3M53y3UnP5g3cAEFR7oYwvibG6+XBbdhncX1vKFeK/m
79ofswcWI/VRuzxg9s+NXwnRYUFU4tLYPYI58FA=
=JCP8
-----END TENDERMINT PRIVATE KEY-----

删除

bhcli keys delete <key_name>

删除Alice密钥信息:

$ bhcli keys delete alice
DANGER - enter password to permanently delete key:<输入密码>
Key deleted forever (uh oh!)

导入

bhcli keys import Alice --file <私钥文件路径>

把上面通过export导出的私钥存为alice.pri文件:

bhcli keys import alice ./alice.pri 
Enter passphrase to decrypt your key:<输入密码>

version

显示version信息

示例

成功返回

help

显示help信息

示例

bhcli help

成功返回

Command line interface for interacting with bhex chain

Usage:
  bhcli [command]

Available Commands:
  status      Query remote node for status
  config      Create or query an application CLI configuration file
  query       Querying subcommands
  tx          Transactions subcommands

  rest-server Start LCD (light-client daemon), a local REST server

  keys        Add or view local private keys

  version     Print the app version
  help        Help about any command

Flags:
      --chain-id string   Chain ID of tendermint node
  -e, --encoding string   Binary encoding (hex|b64|btc) (default "hex")
  -h, --help              help for bhcli
      --home string       directory for config and data (default "/Users/rogan/.bhcli")
  -o, --output string     Output format (text|json) (default "text")
      --trace             print out full stack trace on errors

Use "bhcli [command] --help" for more information about a command.