跳到主要内容

1. 简介

BubiChain提供了命令行工具,用于与节点进行交互,包括基本的账户密钥、钱包、证书、合约等功能。

2. 环境准备

  • 在本地准备一个节点以供调用命令行工具。
  • 若需调用合约命令,则需要准备一个运行的节点。若尚未部署节点,请参考部署节点以了解详细的区块链节点部署方法。
  • 准备一个激活的账号。若您还没有账号,请参考激活账号了解账号创建和激活的详细步骤。

3. 使用方法示例

在终端执行以下格式的命令:

./bubi --command <param1> [param2] ...
参数描述
bubi节点的可执行文件
command执行的命令名称
param命令的参数

3.1 部署合约示例

  1. 部署节点地址为 192.168.16.131:19333

  2. 编辑 JavaScript 合约,路径为 /usr/local/buchain/contract.js,该合约无需 init 参数。

"use strict";
function init(bar){
return;
}
function main(input){
let para = JSON.parse(input);
if (para.do_foo){
let x = {
'hello' : 'world'
};
}
}
function query(input){
return input;
}
  1. 激活的账户地址为 adxSp1X4V7hXDDRBKHL6U21CpbPhki7YqjuUd
  • 调用命令行工具
./bubi --create-contract 192.168.16.131:19333 /usr/local/buchain/contract.js "" adxSp1X4V7hXDDRBKHL6U21CpbPhki7YqjuUd 1000 10000000000 10000000

输入账户的密钥:

Input private key or private key aes:
privbtBp152KnunKvCBgFQX96zuASSH6FBY9KVTX1bifPCLUWarq9EaN

输出交易哈希和合约账户地址:

Create contract OK! Hash: e4bfd6c5937f2f2ac5c6f850d4adc681ae42c8731511aca4c00625424e820092

Address:adxSTCDifFpwFQt8y7xENTnVD9fLQYqTHpGhf
  • 查询交易
curl 192.168.16.131:19333/getTransactionHistory?hash=e4bfd6c5937f2f2ac5c6f850d4adc681ae42c8731511aca4c00625424e820092

响应结果:

{
"error_code":0,
"result":{
"total_count":1,
"transactions":[
{
"actual_fee":1000649000,
"close_time":1710922418059060,
"error_code":0,
"error_desc":"[{\"contract_address\":\"adxSTCDifFpwFQt8y7xENTnVD9fLQYqTHpGhf\",\"contract_evm_address\":\"0x01b1faf39c81d513fcac12b8ba38b3b137582ff0\",\"operation_index\":0}]",
"hash":
"e4bfd6c5937f2f2ac5c6f850d4adc681ae42c8731511aca4c00625424e820092",
"ledger_seq":1041,
"signatures":[
{
"public_key": "b001ac76f97b0fda145c68e2edf6665c247a292260694b5dfcacac8acb658bd3746e7d8a3032",
"sign_data": "213b1bb632f8e8539418fbb5046e3788a4af0cb02768cc0f421ea337e0d6d4e35690c640abf57b20839a90971b503881e9089fab2654dd70311c415812c68d0d"
},{
"public_key": "b00132c3d1244e0be4d711fb12d5b3d24abeb60f11e8c61c5efe28ad20b793d7fb2402f819e9",
"sign_data": "0bfb72671be224fb4a981312c8dd71bb3dbfdbf63548da5f1d603e55034262734e2bd29cbbde5e1109e62f679acbb7e7eeaaacaab6626955007b55127a1fbd07"
}
],
"transaction":{
"fee_limit":10000000000,
"gas_price":1000,
"nonce":83,
"operations":[
{
"create_account":{
"contract":{
"owner":"adxSp1X4V7hXDDRBKHL6U21CpbPhki7YqjuUd",
"payload":"\"use strict\";\nfunction init(bar){\n return;\n}\nfunction main(input){\n let para = JSON.parse(input);\n if (para.do_foo){\n let x = {\n 'hello' : 'world'\n };\n }\n}\nfunction query(input){ \n return input;\n}\n\n"},
"init_balance":10000000,
"priv":{
"thresholds":{
"tx_threshold":1
}
}
},
"type":1
}
],
"source_address":"adxSp1X4V7hXDDRBKHL6U21CpbPhki7YqjuUd"
},
"tx_size":649
}
]
}
}
  • 查询合约账户信息
curl 192.168.16.131:19333/getAccount?address=adxSTCDifFpwFQt8y7xENTnVD9fLQYqTHpGhf

响应结果:

{
"error_code" : 0,
"result" : {
"address" : "adxSTCDifFpwFQt8y7xENTnVD9fLQYqTHpGhf",
"assets" : null,
"assets_hash" : "ad67d57ae19de8068dbcd47282146bd553fe9f684c57c8c114453863ee41abc3",
"balance" : 10000000,
"contract" : {
"owner" : "adxSp1X4V7hXDDRBKHL6U21CpbPhki7YqjuUd",
"payload" : "\"use strict\";\nfunction init(bar){\n return;\n}\nfunction main(input){\n let para = JSON.parse(input);\n if (para.do_foo){\n let x = {\n 'hello' : 'world'\n };\n }\n}\nfunction query(input){ \n return input;\n}\n\n"
},
"metadatas" : null,
"metadatas_hash" : "ad67d57ae19de8068dbcd47282146bd553fe9f684c57c8c114453863ee41abc3",
"priv" : {
"thresholds" : {
"tx_threshold" : 1
}
}
}
}

3.2 调用合约示例

  1. 合约地址:adxSTCDifFpwFQt8y7xENTnVD9fLQYqTHpGhf
  • 调用命令行工具
./bubi --paycoin 192.168.16.131:19333 adxSTCDifFpwFQt8y7xENTnVD9fLQYqTHpGhf '{"key":"value"}' 1000 10000000000 0

输入账户的密钥:

Input private key or private key aes:
privbtBp152KnunKvCBgFQX96zuASSH6FBY9KVTX1bifPCLUWarq9EaN

输出交易哈希和合约账户地址:

Submit OK! Tx hash: a7b04fae692de8baf45aab883d56158adcf566f9f16cd220e443542f0e37d295
  • 查询交易
curl 192.168.16.131:19333/getTransactionHistory?hash=a7b04fae692de8baf45aab883d56158adcf566f9f16cd220e443542f0e37d295

响应结果:

{
"error_code":0,
"result":{
"total_count":1,
"transactions":[
{
"actual_fee":408000,
"close_time":1710925619864339,
"error_code":0,
"error_desc":"",
"hash":
"a7b04fae692de8baf45aab883d56158adcf566f9f16cd220e443542f0e37d295",
"ledger_seq":1050,
"signatures":[
{
"public_key": "b001ac76f97b0fda145c68e2edf6665c247a292260694b5dfcacac8acb658bd3746e7d8a3032",
"sign_data": "37a0e4854185ce2aa4f21272bc09d9eaaca032e50985c92452bab18b78fe002726aeaab7f3c7ec6042a0cb2e4966dbcfafa8afb8d065a244881fdb6936070e00"
},{
"public_key": "b00132c3d1244e0be4d711fb12d5b3d24abeb60f11e8c61c5efe28ad20b793d7fb2402f819e9",
"sign_data": "389280d2d048286e7b22653144ab8556d690fa4cd3e9225c99f9dfb75de84ac345753a1134ad39951160ad88ca2ab39df31f1157ebc7ebca096493440b4cbd0e"
}
],
"transaction":{
"fee_limit":10000000000,
"gas_price":1000,
"nonce":85,
"operations":[
{
"pay_coin":{
"dest_address":
"adxSTCVPoFsW7NdXYfLfA5AxGn6YNJLMrrNmp",
"input":"{\"key\":\"value\"}"
},
"type":7
}
],
"source_address":"adxSp1X4V7hXDDRBKHL6U21CpbPhki7YqjuUd"
},
"tx_size":408
}
]
}
}

4. 账户命令

4.1 create-account

创建账号。

  • 调用方法

    --create-account [sign_type]
  • 请求参数

    参数类型描述
    sign_typeString选填。账号签名算法,支持ed25519与sm2,默认为ed25519。
  • 响应数据

    字段名称类型描述
    addressString账号地址。
    private_keyString账号明文私钥。
    private_key_aesString账号加密私钥。
    private_key_rawString账号原始私钥。
    public_keyString账号公钥。
    public_key_rawString账号原始公钥。
    sign_typeString账号签名类型。
  • 示例

    ./bubi --create-account sm2
    {
    "address" : "adxSy74PADh9xzrTwR7QS96f3zZgnv7dVkKFK",
    "private_key" : "privC4rfKd94Q4JkieWc5b4LarGVqH9JcVui8eZZZkQGZTck5ffLYar6",
    "private_key_aes" : "c65be3d4a9c0c4e5803bf18e0e2aac3546460cdcf4f06ceaa1952874c2191dea9feb6f4e211d90e80ad93c8246606050fbf9fba6105dad300085efb239dd9cf6",
    "private_key_raw" : "6bada445c7b256a29f95a7391a70e02c3cd43262513c8f082ea3d7f21d7ca71b",
    "public_key" : "b00204a0b11a41732514735f24b6683b917baf84b6d8e00dba6d928151b5ddae511cce12bef384c64906a9795575ce8fcbd00b068209ffc21bf79b9a713fd0bb2323999116c1aa",
    "public_key_raw" : "04a0b11a41732514735f24b6683b917baf84b6d8e00dba6d928151b5ddae511cce12bef384c64906a9795575ce8fcbd00b068209ffc21bf79b9a713fd0bb232399",
    "sign_type" : "sm2"
    }

4.2 get-address

根据账号私钥解析账号地址等信息。

  • 调用方法

    --get-address <private_key>
  • 请求参数

    参数类型描述
    private_keyString必填。账号私钥。
  • 响应数据

    字段名称类型描述
    addressString账号地址。
    private_keyString账号明文私钥。
    private_key_aesString账号加密私钥。
    private_key_rawString账号原始私钥。
    public_keyString账号公钥。
    public_key_rawString账号原始公钥。
    sign_typeString账号签名类型。
  • 示例

    ./bubi --get-address privC4rfKd94Q4JkieWc5b4LarGVqH9JcVui8eZZZkQGZTck5ffLYar6
    {
    "address" : "adxSy74PADh9xzrTwR7QS96f3zZgnv7dVkKFK",
    "private_key" : "privC4rfKd94Q4JkieWc5b4LarGVqH9JcVui8eZZZkQGZTck5ffLYar6",
    "private_key_aes" : "c65be3d4a9c0c4e5803bf18e0e2aac3546460cdcf4f06ceaa1952874c2191dea9feb6f4e211d90e80ad93c8246606050fbf9fba6105dad300085efb239dd9cf6",
    "private_key_raw" : "6bada445c7b256a29f95a7391a70e02c3cd43262513c8f082ea3d7f21d7ca71b",
    "public_key" : "b00204a0b11a41732514735f24b6683b917baf84b6d8e00dba6d928151b5ddae511cce12bef384c64906a9795575ce8fcbd00b068209ffc21bf79b9a713fd0bb2323999116c1aa",
    "public_key_raw" : "04a0b11a41732514735f24b6683b917baf84b6d8e00dba6d928151b5ddae511cce12bef384c64906a9795575ce8fcbd00b068209ffc21bf79b9a713fd0bb232399",
    "sign_type" : "sm2"
    }

4.3 get-address-from-pubkey

根据账号公钥解析账号地址等信息。

  • 调用方法

    --get-address-from-pubkey <public_key>
  • 请求参数

    参数类型描述
    public_keyString必填。账号公钥。
  • 响应数据

    字段名称类型描述
    addressString账号地址。
    private_keyString账号明文私钥。
    private_key_aesString账号加密私钥。
    private_key_rawString账号原始私钥。
    public_keyString账号公钥。
    public_key_rawString账号原始公钥。
    sign_typeString账号签名类型。
  • 示例

    ./bubi --get-address-from-pubkey b00204a0b11a41732514735f24b6683b917baf84b6d8e00dba6d928151b5ddae511cce12bef384c64906a9795575ce8fcbd00b068209ffc21bf79b9a713fd0bb2323999116c1aa
    {
    "address" : "adxSy74PADh9xzrTwR7QS96f3zZgnv7dVkKFK",
    "public_key" : "b00204a0b11a41732514735f24b6683b917baf84b6d8e00dba6d928151b5ddae511cce12bef384c64906a9795575ce8fcbd00b068209ffc21bf79b9a713fd0bb2323999116c1aa",
    "public_key_raw" : "04a0b11a41732514735f24b6683b917baf84b6d8e00dba6d928151b5ddae511cce12bef384c64906a9795575ce8fcbd00b068209ffc21bf79b9a713fd0bb232399",
    "sign_type" : "sm2"
    }

4.4 sign-data

对十六进制字符串签名。

  • 调用方法

    --sign-data <private_key> <data>
  • 请求参数

    参数类型描述
    private_keyString必填。账号私钥。
    dataString必填。原始数据,十六进制。
  • 响应数据

    字段名称类型描述
    dataString原始数据,十六进制。
    public_keyString账号公钥。
    sign_dataString签名数据,十六进制。
  • 示例

    ./bubi --sign-data privbwowov9J57v2R3rMZxSUXDhLqP9inzcd7wzBcTaFai9xSj5TtHjg c2dee1
    {
    "data" : "c2dee1",
    "public_key" : "b001dc8721c2596727a71ab2e0ae54311c2c87c9d0836b73b604f755c782e3758ca626859186",
    "sign_data" : "24acfeabd70644179d8e14acc46e83f634508dc516030a1e35971402a57f034f97e030bd68f58db3b3c41342e16ed22ede7cf001700818a5fabd7c8444c81c0b"
    }

4.5 check-signed-data

验证签名。

  • 调用方法

    --check-signed-data <data> <sign_data> <public_key> 
  • 请求参数

    参数类型描述
    dataString必填。原始数据,十六进制。
    sign_dataString必填。签名数据,十六进制。
    public_keyString必填。账号公钥。
  • 响应数据

    验证成功输出true,验证失败输出false。

  • 示例

    ./bubi --check-signed-data c2dee1 24acfeabd70644179d8e14acc46e83f634508dc516030a1e35971402a57f034f97e030bd68f58db3b3c41342e16ed22ede7cf001700818a5fabd7c8444c81c0b b001dc8721c2596727a71ab2e0ae54311c2c87c9d0836b73b604f755c782e3758ca626859186
    true

4.6 check-address

验证地址是否合法。

  • 调用方法

    --check-address <address>
  • 请求参数

    参数类型描述
    addressString必填。账号地址。
  • 响应数据

    字段名称类型描述
    String地址合法输出ok,地址不合法输出error。
  • 示例

    ./bubi --check-address adxSWDKY2JhbThKDoAiNmGnLzET35sTd6nuhy
    ok

4.7 sm3

计算数据的sm3哈希值。

  • 调用方法

    --sm3 <data>
  • 请求参数

    参数类型描述
    dataString必填。原始数据。
  • 响应数据

    字段名称类型描述
    String哈希值。
  • 示例

    ./bubi --sm3 hello
    becbbfaae6548b8bf0cfcad5a27183cd1be6093b1cceccc303d9c61d0a645268

4.8 sm3-hex

计算十六进制数据的sm3哈希值。

  • 调用方法

    --sm3-hex <data> 
  • 请求参数

    参数类型描述
    dataString必填。原始数据,十六进制。
  • 响应数据

    字段名称类型描述
    String哈希值。
  • 示例

    ./bubi --sm3-hex 68656c6c6f
    becbbfaae6548b8bf0cfcad5a27183cd1be6093b1cceccc303d9c61d0a645268

4.9 aes-crypto

对数据进行aes加密。

  • 调用方法

    --aes-crypto <data>
  • 请求参数

    参数类型描述
    dataString必填。原始数据。
  • 响应数据

    字段名称类型描述
    String加密结果。
  • 示例

    ./bubi --aes-crypto hello
    8b63e12294dc70b544ea7efa1ff4d415

5. 钱包命令

5.1 create-keystore

创建keystore。

  • 调用方法

    --create-keystore <password>
  • 请求参数

    参数类型描述
    passwordString必填。加密和解密keystore,当参数为空时会显式的要求输入密码。
  • 响应数据

    字段名称类型描述
    Stringkeystore内容。
  • 示例

    ./bubi --create-keystore 123
    {"address":"adxSTXcJ9fadRsaYr1yerD98xMjeG95VFVjwz","aesctr_iv":"fd82c8e9aa27475f9aafef8e8b190da5","cypher_text":"a167f81afbd4a4a8e1e66ec5825bf1520c0995ce3ac61b8112755686caa4f3bda7a6796faf904cc489153c6297f00b89c9406cd06f01206d","scrypt_params":{"n":16384,"p":1,"r":8,"salt":"3ea84f44bd356b1425a91a3d688e429bcbddf7972fc56936a454a702c40705ab"},"version":2}

5.2 create-keystore-list

在指定路径下创建多个keystore。

  • 调用方法

    --create-keystore-list <path> <number> <password> 
  • 请求参数

    参数类型描述
    pathString必填。存储keystore列表的路径。
    numberInt必填。生成keystore的数量。
    passwordString必填。加密和解密keystore,当参数为空时会显式的要求输入密码。
  • 示例

    ./bubi --create-keystore-list ./keystore 5 123

    在./keystore目录下生成了5个密码为"123"的keystore,和地址列表

    ls ./keystore/
    1-adxSc4bt55rTn9UXoXZhT3WfrakSjby94PnF3.wallet 3-adxSdkYinyhEvKjwznbmHpj5X3RbGnfFChNmK.wallet 5-adxScz3cc6yijtd1HHr1ohqpU7vq5Tt7gMbUr.wallet
    1-adxSuGoLbFiyGxfxKGE9tQKkYRALNupqcAyLa.wallet 3-adxSeY9zo8C8onWEzDGhTuNAPH7GqJ7dYBSFQ.wallet 5-adxSfNHh6DhoSrg8k6GLnw3sjfvj37Yqx6zK3.wallet
    2-adxSc8yNazdSMmzC8395KUHnqJT7jSRAsggeH.wallet 4-adxSZFfgEY5JehHa9LZX6rwDBYx2zCpnimQ7G.wallet address_list
    2-adxSehJhPG7ja15PYMkcYTtCYTHwWT4nCeeF2.wallet 4-adxSqqREEVAx5i2YNGRuyKBupp8EgFtYXNrVR.wallet

5.3 create-keystore-from-privatekey

根据指定的账号私钥创建keystore。

  • 调用方法

    --create-keystore-from-privatekey <private_key> <password> 
  • 请求参数

    参数类型描述
    private_keyString必填。账号私钥。
    passwordString必填。加密和解密keystore,当参数为空时会显式的要求输入密码。
  • 响应数据

    字段名称类型描述
    Stringkeystore内容。
  • 示例

    ./bubi --create-keystore-from-privatekey privbtBp152KnunKvCBgFQX96zuASSH6FBY9KVTX1bifPCLUWarq9EaN 123
    {"address":"adxSp1X4V7hXDDRBKHL6U21CpbPhki7YqjuUd","aesctr_iv":"f569180fd96e74c987746f8471d34936","cypher_text":"49f06237c7b6df24c9a644ccec9b1762511eb5d1c79a7c470899d0302e88ec78a8b79abc81ce8824d4a4deb209eb809df88390815550e7c0","scrypt_params":{"n":16384,"p":1,"r":8,"salt":"e409b3a3314fceea9e5c7f321a947bc2b79de8e8f301fbf525e2651a7abc4e79"},"version":2}

5.4 get-privatekey-from-keystore

从keystore解析账号私钥。

  • 调用方法

    --get-privatekey-from-keystore <keystore> <password> 
  • 请求参数

    参数类型描述
    keystoreString必填。加密私钥。
    passwordString必填。解密keystore。
  • 响应数据

    字段名称类型描述
    String解析成功输出ok,解析失败输出key is invalid error。
  • 示例

    ./bubi --get-privatekey-from-keystore '{"address":"adxSp1X4V7hXDDRBKHL6U21CpbPhki7YqjuUd","aesctr_iv":"4258d17a56d29b232b6b47b6a4ce5bc3","cypher_text":"8611e7d0cd6fa1323d82ea90097064f0109f6a51c274bbcd11c081227a9af3d61bae6ed4c5bc899211cd8299524080c56afbc8c6dbd9012f","scrypt_params":{"n":16384,"p":1,"r":8,"salt":"20a887f55ab876e479c1387fa9404e93e3ff574cc4ff93e101d205a5bb67103d"},"version":2}' 123
    privbtBp152KnunKvCBgFQX96zuASSH6FBY9KVTX1bifPCLUWarq9EaN

5.5 check-keystore

检查keystore和密码是否匹配。

  • 调用方法

    --check-keystore <keystore> <password> 
  • 请求参数

    参数类型描述
    keystoreString必填。加密私钥。
    passwordString必填。解密keystore。
  • 响应数据

    字段名称类型描述
    String验证成功输出ok,验证失败输出key is invalid error。
  • 示例

    ./bubi --check-keystore '{"address":"adxSp1X4V7hXDDRBKHL6U21CpbPhki7YqjuUd","aesctr_iv":"4258d17a56d29b232b6b47b6a4ce5bc3","cypher_text":"8611e7d0cd6fa1323d82ea90097064f0109f6a51c274bbcd11c081227a9af3d61bae6ed4c5bc899211cd8299524080c56afbc8c6dbd9012f","scrypt_params":{"n":16384,"p":1,"r":8,"salt":"20a887f55ab876e479c1387fa9404e93e3ff574cc4ff93e101d205a5bb67103d"},"version":2}' 123
    ok

5.6 sign-data-with-keystore

用keystore对数据签名。

  • 调用方法

    --sign-data-with-keystore <keystore> <password> <data>
  • 请求参数

    参数类型描述
    keystoreString必填。加密私钥。
    passwordString必填。解密keystore。
    dataString必填。原始数据,十六进制。
  • 响应数据

    字段名称类型描述
    dataString原始数据,十六进制。
    public_keyString账号公钥。
    sign_dataString签名数据,十六进制。
  • 示例

    ./bubi --sign-data-with-keystore '{"address":"adxSp1X4V7hXDDRBKHL6U21CpbPhki7YqjuUd","aesctr_iv":"4258d17a56d29b232b6b47b6a4ce5bc3","cypher_text":"8611e7d0cd6fa1323d82ea90097064f0109f6a51c274bbcd11c081227a9af3d61bae6ed4c5bc899211cd8299524080c56afbc8c6dbd9012f","scrypt_params":{"n":16384,"p":1,"r":8,"salt":"20a887f55ab876e479c1387fa9404e93e3ff574cc4ff93e101d205a5bb67103d"},"version":2}' 123 cd6fa1
    {"address":"adxSp1X4V7hXDDRBKHL6U21CpbPhki7YqjuUd","aesctr_iv":"4258d17a56d29b232b6b47b6a4ce5bc3","cypher_text":"8611e7d0cd6fa1323d82ea90097064f0109f6a51c274bbcd11c081227a9af3d61bae6ed4c5bc899211cd8299524080c56afbc8c6dbd9012f","scrypt_params":{"n":16384,"p":1,"r":8,"salt":"20a887f55ab876e479c1387fa9404e93e3ff574cc4ff93e101d205a5bb67103d"},"version":2}{
    "data" : "cd6fa1",
    "public_key" : "b001ac76f97b0fda145c68e2edf6665c247a292260694b5dfcacac8acb658bd3746e7d8a3032",
    "sign_data" : "48edabf540dbe10bd96818affe41a3ba4b4c055b7f0fbba02582bcd3e05a4b8f04b0a207e0347dfaaa623d1bc13536eda9f907718b0c73dbdfe4851a2b02280d"
    }

5.7 sign-data-with-keystore-list

用keystore列表对数据签名。

  • 调用方法

    --sign-data-with-keystore-list <data_path> <keystore_path> <index> <password>
  • 请求参数

    参数类型描述
    data_pathString必填。原始数据文件路径,数据为json格式。
    keystore_pathString必填。keystore列表路径:必填,通过create-keystore-list创建。
    indexInt必填。keystore索引,从索引开始逐个对数据进行签名。如果从索引开始的keystore数量小于数据的数量,某些数据没有密钥可用,将会执行失败。
    passwordString必填。keystore密码。
  • 响应数据

    字段名称类型描述
    transaction_blobString原始数据,十六进制。
    public_keyString账号公钥。
    sign_dataString签名数据,十六进制。
  • 示例

    原始数据./data.json示例:

    {
    "items":[
    {
    "transaction_blob": "0a25616478537031583456376858444452424b484c3655323143706250686b693759716a755564100222300807622c0a25616478536657687a365162716234375666724c59627372436a385a736f364a6b4c536369331080c2d72f2a080123456789abcdef308094ebdc0338e807"
    },
    {
    "transaction_blob": "0a25616478537031583456376858444452424b484c3655323143706250686b693759716a7555641001222d080762290a256164785356373334524a45656f7a784e523961374b4841505476547453426f31536a6f336710643080c8afa02538e807"
    }
    ]
    }

    执行命令:

    ./bubi --sign-data-with-keystore-list ./data.json ./keystore/ 3 123 

    从keystore列表中的第3个keystore开始,对两个transaction_blob数据签名。签名结果保存在原始数据路径下,文件名为data_1.json。内容如下:

    {
    "items":[
    {
    "signatures":[
    {
    "public_key": "b0017c05bf2d553c00f3ce890e7804e5d3b2e91ed0fe8d3e155286094d6f97c78b6cd8f654f3",
    "sign_data": "1f5d649063b3db7593966b1eadbb564d00725006c6b1554a95ef485495646d72e1c682492120b5032c23ee230bfffb30a5aca456835a13d867b277dd622a8c0f"
    }
    ],
    "transaction_blob ":"0a25616478537031583456376858444452424b484c3655323143706250686b693759716a755564100222300807622c0a25616478536657687a365162716234375666724c59627372436a385a736f364a6b4c536369331080c2d72f2a080123456789abcdef308094ebdc0338e807"
    },
    {
    "signatures":[
    {
    "public_key": "b001a238b90c8ca9e018ab569726f1db6ac136a012e5e07eaa165511bfba36dce6e3a7c40c97",
    "sign_data": "dbb9fb4529ee71c1b538d83e017d8b6ee71db951e4d4e7cf3aa9de3d40a8b8cab9f9b0e6564e2dcb8f6e7f07b40309b9a474e9bc26e8090c6f94a29370b2b907"
    }
    ],
    "transaction_blob": "0a25616478537031583456376858444452424b484c3655323143706250686b693759716a7555641001222d080762290a256164785356373334524a45656f7a784e523961374b4841505476547453426f31536a6f336710643080c8afa02538e807"
    }
    ]
    }

6. 证书命令

6.1 request-cert

在指定路径下生成证书。

  • 调用方法

    --request-cert <file_path> <common_name> <organization> <email> <priv_password> <hardware_address> [node_id] [sign_type] 
  • 请求参数

    参数类型描述
    file_pathString必填。节点的父目录下,证书的相对路径。
    common_nameString必填。通用名称。
    organizationString必填。组织名称。
    emailString必填。组织邮箱。
    priv_passwordString必填。密码。
    hardware_addressString必填。物理地址。
    node_idInt选填。节点id,默认为空。
    sign_typeString选填。签名算法,支持rsa和sm2,默认为rsa。
  • 示例

    sudo ./bubi --request-cert cert_path name bubi abc@bubi.cn 123 1ea0bb2e1a0113c265a5cd4610d64592

    request file :
    /usr/local/buchain/cert_path/name_bubi.csr
    private file :
    /usr/local/buchain/cert_path/name_bubi.pem



    the request certificate information:
    {
    "ca" : {
    "extensions" : {
    "hardware_address" : "1ea0bb2e1a0113c265a5cd4610d64592",
    "node_id" : "*"
    },
    "subject" : {
    "common_name" : "name",
    "country" : "CN",
    "email" : "abc@bubi.cn",
    "organization" : "bubi"
    }
    }
    }

6.2 show-request

打印节点证书内容。

  • 调用方法

    --show-request <path> 
  • 请求参数

    参数类型描述
    pathString必填。config文件下证书的相对路径。
  • 响应数据

    字段名称类型描述
    hardware_addressString物理地址。
    node_idString节点id。
    common_nameString通用名称。
    countryString国家。
    emailString组织邮箱。
    organizationString组织名称。
  • 示例

    ./bubi --show-request node_bubi.csr

    the request certificate information:
    {
    "ca" : {
    "extensions" : {
    "hardware_address" : "1ea0bb2e1a0113c265a5cd4610d64592",
    "node_id" : "*"
    },
    "subject" : {
    "common_name" : "name",
    "country" : "CN",
    "email" : "abc@bubi.cn",
    "organization" : "bubi"
    }
    }
    }

7. 合约命令

7.1 calculate-contract-hash

计算合约账号的地址。

  • 调用方法

    --calculate-contract-hash <address> <index> <nonce>
  • 请求参数

    参数类型描述
    addressString必填。发起创建合约账户交易的源地址。
    indexInt必填。operation的索引。
    nonceInt必填。创建账户交易的nonce值。
  • 响应数据

    字段名称类型描述
    String合约账户地址。
  • 示例

    ./bubi --calculate-contract-hash adxSp1X4V7hXDDRBKHL6U21CpbPhki7YqjuUd 11 0
    adxSV891Ad2y2u9R39gT7xiPmxoDafoiXMM9C

7.2 create-contract

创建合约账号。

  • 调用方法

    --create-contract <url> <path> <input> <owner> <gas> <fee_limit> [init_balance] 
  • 请求参数

    参数类型描述
    urlString必填。节点的ip地址和端口号
    pathString必填。合约代码路径。
    inputString必填。合约init函数的参数,若没有参数填空字符串""。
    ownerString必填。合约的拥有者。
    gasInt必填。gas价格,单位baseuint。
    fee_limitInt必填。最大手续费,单位baseuint。
    init_balanceInt选填。账户初始余额,单位baseuint,默认为0。

    显式的要求输入源账户的私钥。

  • 响应数据

    字段名称类型描述
    HashString交易哈希。
    AddressString合约账户地址。
    交易失败时输出错误信息。
  • 示例

    ./bubi --create-contract 192.168.16.131:19333 /usr/local/buchain/contract.js "" adxSp1X4V7hXDDRBKHL6U21CpbPhki7YqjuUd 1000 10000000000 10000000
    Input private key or private key aes:
    privbtBp152KnunKvCBgFQX96zuASSH6FBY9KVTX1bifPCLUWarq9EaN

    Create contract OK! Hash: 4c29b85bca1cfc3052616ebb3dfd04d27115a308833f014e65d588a80e7ccfff

    Address:adxSTAaaUnkJrndMkh11QizCWoBzDLqA6hEFu

    交易成功后可以通过查询交易API查询交易的内容,通过查询账号API查询合约账号的详细信息。

7.3 upgrade-contract

升级合约账户。

  • 调用方法

    --upgrade-contract <url> <address> <path> <owner> <gas> <fee_limit> 
  • 请求参数

    参数类型描述
    urlString必填。节点的地址。
    addressString必填。合约账号地址。
    pathString必填。更新的合约代码路径。
    ownerString必填。合约拥有者。
    gasInt必填。gas价格,单位baseuint。
    fee_limitInt必填。最大手续费,单位baseuint。

    显式的要求输入源账户的私钥。

  • 响应数据

    字段名称类型描述
    HashString交易哈希。
  • 示例

    ./bubi --upgrade-contract 192.168.16.131:19333 adxSTAaaUnkJrndMkh11QizCWoBzDLqA6hEFu /usr/local/buchain/contract_upgrade.js adxSp1X4V7hXDDRBKHL6U21CpbPhki7YqjuUd 1000 10000000000
    Input private key or private key aes:
    privbtBp152KnunKvCBgFQX96zuASSH6FBY9KVTX1bifPCLUWarq9EaN

    Upgrade OK! Hash: 061e66a42be60e43552e5acee812253788659dd0a251037048535f185d93c3f5

    交易成功后可以通过查询交易API查询交易的内容,通过查询账号API查询合约账号的详细信息。

7.4 paycoin

转移gas或调用合约。

  • 调用方法

    --paycoin <url> <address> [input] <gas> <fee_limit> <coin_amount> 
  • 请求参数

    参数类型描述
    urlString必填。节点的地址。
    addressString必填。目标账号地址。
    inputString选填。调用合约时的入参。
    gasInt必填。gas价格,单位baseuint。
    fee_limitInt必填。最大手续费,单位baseuint。
    coin_amountInt必填。转移gas数量,单位baseuint。

    显式的要求输入源账号私钥或经过aes加密的私钥。

  • 响应数据

    字段名称类型描述
    HashString交易哈希。
  • 示例

    ./bubi --paycoin 192.168.16.131:19333 adxSTAaaUnkJrndMkh11QizCWoBzDLqA6hEFu "{}" 1000 10000000000 1000
    Input private key or private key aes:
    privbtBp152KnunKvCBgFQX96zuASSH6FBY9KVTX1bifPCLUWarq9EaN

    Submit OK! Tx hash: f2d3e327bdd6d84b14953b557cdc84c3c68370c9254d32aad22b094928d2a3a9

8. 系统命令

8.1 help

打印所有的指令和功能描述。

  • 调用方法

    --help
  • 示例

    ./bubi --help
    Usage: buchain [OPTIONS]
    OPTIONS:
    --license-key the key written in license
    --dropdb clean up database
    --peer-address [node-priv-key] get peer address from crypted node private key
    --create-account [crypto] create account, support ed25519
    --create-account-v3 [crypto] create bubi v3 account, support ed25519
    --get-address [node-priv-key] get address from private key
    --get-address-v3 [node-priv-key] get address from private key
    --get-address-from-pubkey [public-key] get address from public key
    --get-address-from-pubkey-v3 [public-key] get address from public key
    --sign-data [node-priv-key] [blob data] sign blob data
    --check-signed-data [blob data] [signed data] [public key] check signed data
    --check-address [address] check address
    --hardware-address get local hardware address
    --clear-consensus-status delete consensus status
    --sm3 [arg] generate sm3 hash
    --sm3-hex [arg] generate sm3 hash from hex format
    --aes-crypto [value] crypto value
    --version display version information
    --create-hardfork create hard fork ledger
    --create-hardfork-for-v3 [hardfork seq] create hard fork v3 ledger
    --clear-peer-addresses clear peer list
    --create-keystore [password] create key store
    --create-keystore-list [path] [nums] [password] create a number of keystores into path with same password
    --create-keystore-from-privatekey [private key] [password] create key store from private key
    --sign-data-with-keystore [keystore] [password] [blob data] sign blob data with keystore
    --sign-data-with-keystore-list [data-file-path] [keystore-dir-path] [start-id] [password] sign blob data with keystore list
    --check-keystore [keystore] [password] check password match the keystore
    --get-privatekey-from-keystore [keystore] [password] check password match the keystore
    --request-cert request entity certificate
    --show-request show request certificate
    --force-ledger-seq make the ledge-seq equal
    --calculate-contract-hash [source address] [source address next nonce] [create operation index] calculate new contract address
    --calculate-contract-hash-v3 [source address] [source address next nonce] [create operation index] calculate new contract address
    --log-dest [dest] set log dest, LIKE FILE+STDOUT+STDERR
    --help display this help
    --create-contract [ip:port] [contract-file-path] [input] [owner] [gas-price] [fee-limit] [init-balance] create contract account
    --upgrade-contract [ip:port] [dest_address] [contract-file-path] [owner] [gas-price] [fee-limit] upgrade contract account
    --paycoin [ip:port] [dest-address] [input-params] [gas-price] [fee-limit] [coin_amount] paycoin tx

8.2 dbtool

查询数据库。

  • 调用方法

    --dbtool
  • 请求参数

    显示的要求输入数据库路径。

    输入1打印所有数据,输入2根据key查询数据。key和value都是十六进制字符串。

  • 示例

    ./bubi --dbtool
    input database path:
    /usr/local/buchain/data/ledger.db
    1:list all key and values
    2:query one key
    2

    input key(hex):6D61785F736571
    3234
    input key(hex):

8.3 dropdb

清空数据库。

  • 调用方法

    --dropdb
  • 示例

    ./bubi --dropdb
    [2024-03-07 17:20:55.893 - INF] <7FAF4B59A640> main.cpp(154):Initialized daemon successfully
    [2024-03-07 17:20:55.893 - INF] <7FAF4B59A640> main.cpp(155):Loaded configure successfully
    [2024-03-07 17:20:55.893 - INF] <7FAF4B59A640> main.cpp(156):Initialized logger successfully
    [2024-03-07 17:20:55.893 - INF] <7FAF4B59A640> main.cpp(160):Initialized fast sync client successfully
    [2024-03-07 17:20:55.893 - INF] <7FAF4B59A640> main.cpp(197):The path of the database is as follows: keyvalue(/usr/local/buchain/data/keyvalue.db),account(/usr/local/buchain/data/account.db),ledger(/usr/local/buchain/data/ledger.db)
    [2024-03-07 17:20:55.901 - INF] <7FAF4B59A640> storage.cpp(323):Drop db successful
    [2024-03-07 17:20:55.901 - INF] <7FAF4B59A640> main.cpp(207):Initialized database successfully
    [2024-03-07 17:20:55.901 - INF] <7FAF4B59A640> main.cpp(210):Droped database successfully

8.4 force-ledger-seq

在节点非正常退出的情况下导致数据库不完整,启动节点失败。设置账本数据库和账号数据库高度,保持高度一致,二者取低高度设置。

  • 调用方法

    --force-ledger-seq
  • 示例

    ./bubi --force-ledger-seq
    Input y to continue(ledger db seq(237), account db seq(236):y
    Set ledger seq to 236 successfully

8.5 license-key

打印许可证密钥。

  • 调用方法

    --license-key
  • 示例

    ./bubi --license-key
    license key: 0355f45532300e1966c2477858f305f7e6bb3c208f8f1d35d9152d47549cd2ee

8.6 peer-address

根据加密的私钥计算地址。

  • 调用方法

    --peer-address <private_key>
  • 请求参数

    参数类型描述
    private_keyString必填。加密的账号私钥。
  • 示例

    ./bubi --peer-address 1724aa163b4660729eab040c989acff071ccefa2ab0c372d9518e5dbde5d026a4b933d4f9b7828e4920effe5a9393b7fdacbf7285db840ed0050001e77916e4f
    local peer address (adxSggi9WECzaaJNGtN1m6BAVP3P64DdCLCjs)

8.7 hardware-address

打印物理地址。

  • 调用方法

    --hardware-address
  • 示例

    ./bubi --hardware-address
    local hardware address (1ea0bb2e1a0113c265a5cd4610d64592)

8.8 clear-consensus-status

清除共识状态。

  • 调用方法

    --clear-consensus-status
  • 示例

    ./bubi --clear-consensus-status
    [2024-03-28 06:40:16.892 - INF] [7FCCF7CCB0C0] main.cpp(154):Initialized daemon successfully
    [2024-03-28 06:40:16.892 - INF] [7FCCF7CCB0C0] main.cpp(155):Loaded configure successfully
    [2024-03-28 06:40:16.892 - INF] [7FCCF7CCB0C0] main.cpp(156):Initialized logger successfully
    [2024-03-28 06:40:16.892 - INF] [7FCCF7CCB0C0] main.cpp(160):Initialized fast sync client successfully
    [2024-03-28 06:40:16.892 - INF] [7FCCF7CCB0C0] main.cpp(197):The path of the database is as follows: keyvalue(/usr/local/buchain/data/keyvalue.db),account(/usr/local/buchain/data/account.db),ledger(/usr/local/buchain/data/ledger.db)
    [2024-03-28 06:40:16.904 - INF] [7FCCF7CCB0C0] main.cpp(207):Initialized database successfully
    [2024-03-28 06:40:16.907 - INF] [7FCCF7CCB0C0] main.cpp(216):Cleared consensus status successfully

8.9 version

显示节点版本信息。

  • 调用方法

    --version
  • 示例

    ./bubi --version
    4.0.24;4003;secure:17;git:

8.10 create-hardfork

创建硬分叉。

  • 调用方法

    --create-hardfork
  • 示例

    ./bubi --create-hardfork
    [2024-03-28 06:47:17.390 - INF] <7F43870030C0> main.cpp(154):Initialized daemon successfully
    [2024-03-28 06:47:17.390 - INF] <7F43870030C0> main.cpp(155):Loaded configure successfully
    [2024-03-28 06:47:17.390 - INF] <7F43870030C0> main.cpp(156):Initialized logger successfully
    [2024-03-28 06:47:17.390 - INF] <7F43870030C0> main.cpp(160):Initialized fast sync client successfully
    [2024-03-28 06:47:17.390 - INF] <7F43870030C0> main.cpp(197):The path of the database is as follows: keyvalue(/usr/local/buchain/data/keyvalue.db),account(/usr/local/buchain/data/account.db),ledger(/usr/local/buchain/data/ledger.db)
    [2024-03-28 06:47:17.401 - INF] <7F43870030C0> main.cpp(207):Initialized database successfully
    [2024-03-28 06:47:17.401 - INF] <7F43870030C0> ledger_manager.cpp(126):The maximum ledger sequence that is closed=23
    [2024-03-28 06:47:17.402 - INF] <7F43870030C0> ledger_manager.cpp(165):Gas price :1000 Base reserve:10000000 .
    [2024-03-28 06:47:17.402 - INF] <7F43870030C0> ledger_manager.cpp(484):Are you sure to create hardfork ledger? Press y to continue.
    y
    [2024-03-28 06:47:19.296 - INF] <7F43870030C0> ledger_manager.cpp(501):The maximum ledger sequence that is closed =23
    [2024-03-28 06:47:19.297 - INF] <7F43870030C0> ledgercontext_manager.cpp(67):LedgerContext constructor, ledger(0)
    [2024-03-28 06:47:19.297 - INF] <7F43870030C0> ledger_frm.cpp(301):Execute ledger, start to apply propose
    [2024-03-28 06:47:19.297 - INF] <7F43870030C0> ledger_frm.cpp(615):total reward(800000000) = total fee(0) + block reward(800000000) in ledger(24)
    [2024-03-28 06:47:19.297 - TRC] <7F43870030C0> ledger_frm.cpp(629):Failed to get dpos contract address(adxSrQivns8D9411RyFV5xDqeFQ5dmGwe8mJk), allocate reward to validators directly
    [2024-03-28 06:47:19.297 - TRC] <7F43870030C0> ledger_frm.cpp(666):Account(adxSBC9QWrTfZjxjnPjKEF5LHGHYCpZ9BDdDF) allocated reward(800000000), left reward(0) in ledger(24)
    [2024-03-28 06:47:19.297 - INF] <7F43870030C0> ledger_frm.cpp(634):Allocate reward completed
    [2024-03-28 06:47:19.297 - INF] <7F43870030C0> ledgercontext_manager.cpp(85):LedgerContext destructor, ledger(0)
    [2024-03-28 06:47:19.301 - INF] <7F43870030C0> ledger_manager.cpp(603):Created hard fork ledger successfully: sequence(24), consensus value hash(458f29bc954c1ae9053774738d9d42885e7672692c7e5732ed1a23191ddd012b)

    配置方法参考创建硬分叉。

8.11 clear-peer-addresses

清空连接节点。在数据库中清空节点的连接信息,这将清除所有的网络连接记录,迁移节点后由于可能会有IP变化,可以尝试清空信息,让节点重新发现并连接其他节点。

  • 调用方法

    --clear-peer-addresses
  • 示例

    ./bubi --clear-peer-addresses
    [2024-03-28 06:38:45.949 - INF] <7FC66829F0C0> main.cpp(154):Initialized daemon successfully
    [2024-03-28 06:38:45.949 - INF] <7FC66829F0C0> main.cpp(155):Loaded configure successfully
    [2024-03-28 06:38:45.949 - INF] <7FC66829F0C0> main.cpp(156):Initialized logger successfully
    [2024-03-28 06:38:45.949 - INF] <7FC66829F0C0> main.cpp(160):Initialized fast sync client successfully
    [2024-03-28 06:38:45.949 - INF] <7FC66829F0C0> main.cpp(197):The path of the database is as follows: keyvalue(/usr/local/buchain/data/keyvalue.db),account(/usr/local/buchain/data/account.db),ledger(/usr/local/buchain/data/ledger.db)
    [2024-03-28 06:38:45.964 - INF] <7FC66829F0C0> main.cpp(207):Initialized database successfully
    [2024-03-28 06:38:45.965 - INF] <7FC66829F0C0> main.cpp(223):Cleared peer addresss list successfully

9. 控制台

9.1 介绍

控制台提供了钱包操作和系统状态查询的命令,启动控制台后,会在本地后台启动一个节点,通过调用控制台命令与节点进行交互,不需要另部署节点。

9.2 进入控制台

  • 调用方法

    --console
  • 示例

    ./bubi --console
    ready

9.3 帮助文档

打印所有的控制台命令和功能描述

  • 调用方法

    help
  • 示例

    > help
    OPTIONS:
    createWallet [path] create wallet
    openWallet [path] open a wallet
    closeWallet close the current wallet
    payCoin [to-address] [bu coin] [fee(bu)] [gas price(baseuint)] [metatdata] [contract-input]
    pay coin or invoke a contract
    restoreWallet [private-key] create wallet by private key
    getBalance [account] get the balance of BU
    getBlockNumber get the lastest closed block number
    showKey show the private key of wallet
    getState get the current state of node
    exit exit

9.4 创建钱包

在指定路径创建钱包。

  • 调用方法

    createWallet <path>
  • 请求参数

    参数类型描述
    pathString必填。钱包路径,生成的keystore存储在该文件中。

    显式的要求输入密码。

  • 示例

    >  createWallet ./wallet
    input the password:

    input the password again:

    {"address":"adxSmj46J3aCtNHPt5MvVgEta3LzAK7baGmcf","aesctr_iv":"5e8c3866b4f92c962eed3a5308e7d9ef","cypher_text":"bc58f970a8f0b59c1902483791de756914836aef4729605789fcc55ef711b831efff5b6cb94db5686256ad951878cbf8da6230af2ff738df","scrypt_params":{"n":16384,"p":1,"r":8,"salt":"6a95eb9524b0268a16b228120e671a4267e583f0db39f057e7bde16d88f1ac19"},"version":2}

9.5 打开钱包

打开指定路径的钱包。

  • 调用方法

    openWallet <path>
  • 请求参数

    参数类型描述
    pathString必填。钱包路径。

    显式的要求输入密码。

  • 示例

    成功打开:

    > openWallet ./wallet
    input the password:

    ok

    路径错误:

    > openWallet ./wall
    open wallet error, path (./wall) not exist

    密码错误:

      openWallet ./wallet
    input the password:

    key is invalid
    open wallet error, load private key with password failed

9.6 查询钱包地址

打印钱包地址,必须先打开钱包。

  • 调用方法

    getAddress
  • 示例

    查询成功:

    > getAddress
    adxSVjREKh2MwFqYbQTg6AjTxht8m3DZCjdKE

    没有打开钱包:

      getAddress
    error, wallet not opened

9.7 查询钱包私钥

打印钱包私钥,必须先打开钱包。

  • 调用方法

    showKey
  • 请求参数

    显式的要求输入钱包密码。

  • 示例

    查询成功:

    > showKey
    input the password:

    privbswJxMfdWuABBFB2zHz4Mgzr6E6n6HwD23DhgdfHcHP1egrbeDAW

    密码错误:

      showKey
    input the password:

    key is invalid
    open wallet error, load private key with password failed

    没有打开钱包:

      showKey
    error, wallet not opened

9.8 转移gas

发起转移gas交易或调用合约,必须先打开钱包。

  • 调用方法

    payCoin <dest_address> <amount> <fee_limit> <gas> [metadata] [input]
  • 请求参数

    参数类型描述
    dest_addressString必填。接收转账的账户地址。
    amountString必填。转移gas数量单位bu。
    fee_limitInt必填。最大手续费,单位baseuint。
    gasInt必填。gas价格,单位baseuint。
    metadataString选填。交易备注。
    inputString选填。调用合约时的入参。

    显式的要求输入钱包密码。

  • 响应数据

    字段名称类型描述
    hashString交易哈希。
  • 示例

    > payCoin adxSmj46J3aCtNHPt5MvVgEta3LzAK7baGmcf 0.1 10 1000000
    input the password:

    ok, tx hash(8332d146d2adcc484fd6dbf87a2983940ca1a4945f917d382671d6417476be35)

9.9 查询余额

查询钱包账户余额。

  • 调用方法

    getBalance [address] 
  • 请求参数

    参数类型描述
    addressString选填。如果打开钱包,查询钱包账号的余额。如果没有打开钱包,输入账户地址,查询该账户的余额。
  • 示例

    查询成功:

    > getBalance adxSp1X4V7hXDDRBKHL6U21CpbPhki7YqjuUd
    999999769.77625 BU

9.10 关闭钱包

  • 调用方法

    closeWallet
  • 示例

    > closeWallet
    ok

9.11 恢复钱包

通过账号私钥创建钱包。

  • 调用方法

    restoreWallet <path> <private_key>
  • 请求参数

    参数类型描述
    pathString必填,生成的keystore存储在该文件中,必须是一个新的路径。
    private_keyString必填。账号私钥。

    显式的要求输入钱包密钥。

  • 示例

    创建成功:

    > restoreWallet ./wallet1 privbtBp152KnunKvCBgFQX96zuASSH6FBY9KVTX1bifPCLUWarq9EaN
    input the password:

    input the password again:

    {"address":"adxSp1X4V7hXDDRBKHL6U21CpbPhki7YqjuUd","aesctr_iv":"b3322fb28b5e744f73d166fc62f43c13","cypher_text":"37c59856c372ccfb4e33ad092c6fe29e9dabf1bc9a27f0b71b4677d08756d6952af44deeb85fdf385279e21d35a55007509cbfa527ef7c29","scrypt_params":{"n":16384,"p":1,"r":8,"salt":"538a75efbb0d6fb0469b26e87f6b37693c543686c44f31196bb5f88c36bf74f0"},"version":2}

    私钥无效:

      restoreWallet ./wallet1 privbtBp152KnunKvCBgFQX96zuASSH6FBY9KVTX1bifPCLUWarq9Ea
    error, private key not valid

    路径已存在:

      restoreWallet ./wallet1 privbtBp152KnunKvCBgFQX96zuASSH6FBY9KVTX1bifPCLUWarq9EaN
    create wallet error, path (./wallet1) exist

9.12 查询区块高度

  • 调用方法

    getBlockNumber
  • 示例

    > getBlockNumber
    24

9.13 查询节点状态

  • 调用方法

    getState
  • 示例

    > getState
    {
    "consensus manager" : {
    "consensus" : {
    "abnormal_records" : {
    "address" : "adxSBC9QWrTfZjxjnPjKEF5LHGHYCpZ9BDdDF",
    "count" : 3
    },
    "ckp_interval" : 10,
    "fault_number" : 0,
    "instances" : [
    {
    "commits" : null,
    "cons_value" : "value hash(e7546bde8193e3db042dc2d69caac56f765d1a3239aa55647f8805b025f33fab) | close time(1711610539996191) | lcl hash(71d5e932) | ledger seq(25) ",
    "end_time" : "1970-01-01 00:00:00.000000",
    "have_send_viewchange" : false,
    "last_propose_time" : "2024-03-28 07:22:27.998531",
    "phase" : "PHASE_PREPREPARE",
    "phase_item" : 0,
    "pre_prepare" : "type:Pre-Prepare | vn:53 seq:2 replica:0 | value: e7546bde8193e3db042dc2d69caac56f765d1a3239aa55647f8805b025f33fab ",
    "pre_prepare_round" : 2,
    "prepares" : null,
    "seq" : 2,
    "start_time" : "2024-03-28 07:22:20.006902",
    "vn" : 53
    }
    ],
    "is_leader" : true,
    "last_exe_seq" : 1,
    "leader" : "adxSBC9QWrTfZjxjnPjKEF5LHGHYCpZ9BDdDF",
    "quorum_size" : 0,
    "replica_id" : 0,
    "type" : "pbft",
    "validator_address" : "adxSBC9QWrTfZjxjnPjKEF5LHGHYCpZ9BDdDF",
    "validator_address_random" : false,
    "validators" : [ "adxSBC9QWrTfZjxjnPjKEF5LHGHYCpZ9BDdDF" ],
    "view_active" : true,
    "view_number" : 53,
    "viewchanges" : [
    {
    "end_time" : "2024-03-28 07:18:58.364110",
    "last_propose_time" : "2024-03-28 07:18:58.362640",
    "newview_init" : true,
    "prepared_pre_env" : "",
    "start_time" : "2024-03-28 07:18:58.362640",
    "view_number" : 48,
    "viewchange" : [ "type:ViewChange | vn:48 seq:1 replica:0 | value_digest:[]" ]
    },
    {
    "end_time" : "2024-03-28 07:19:28.407088",
    "last_propose_time" : "2024-03-28 07:19:28.405552",
    "newview_init" : true,
    "prepared_pre_env" : "",
    "start_time" : "2024-03-28 07:19:28.405552",
    "view_number" : 49,
    "viewchange" : [ "type:ViewChange | vn:49 seq:1 replica:0 | value_digest:[]" ]
    },
    {
    "end_time" : "2024-03-28 07:19:58.451515",
    "last_propose_time" : "2024-03-28 07:19:58.449954",
    "newview_init" : true,
    "prepared_pre_env" : "",
    "start_time" : "2024-03-28 07:19:58.449954",
    "view_number" : 50,
    "viewchange" : [ "type:ViewChange | vn:50 seq:1 replica:0 | value_digest:[]" ]
    },
    {
    "end_time" : "2024-03-28 07:21:19.904037",
    "last_propose_time" : "2024-03-28 07:21:19.902565",
    "newview_init" : true,
    "prepared_pre_env" : "",
    "start_time" : "2024-03-28 07:21:19.902565",
    "view_number" : 51,
    "viewchange" : [ "type:ViewChange | vn:51 seq:1 replica:0 | value_digest:[]" ]
    },
    {
    "end_time" : "2024-03-28 07:21:49.948709",
    "last_propose_time" : "2024-03-28 07:21:49.947139",
    "newview_init" : true,
    "prepared_pre_env" : "",
    "start_time" : "2024-03-28 07:21:49.947139",
    "view_number" : 52,
    "viewchange" : [ "type:ViewChange | vn:52 seq:1 replica:0 | value_digest:[]" ]
    },
    {
    "end_time" : "2024-03-28 07:22:19.992804",
    "last_propose_time" : "2024-03-28 07:22:19.991259",
    "newview_init" : true,
    "prepared_pre_env" : "",
    "start_time" : "2024-03-28 07:22:19.991259",
    "view_number" : 53,
    "viewchange" : [ "type:ViewChange | vn:53 seq:1 replica:0 | value_digest:[]" ]
    }
    ]
    },
    "time" : "0 ms"
    },
    "glue_manager" : {
    "del_tx_count" : 0,
    "ledger_upgrade" : {
    "current_states" : null,
    "local_state" : null
    },
    "new_tx_count" : 0,
    "system" : {
    "current_time" : "2024-03-28 07:22:33",
    "process_uptime" : "2024-03-28 07:20:48",
    "uptime" : "2024-03-26 12:01:33"
    },
    "time" : "0 ms",
    "transaction_pool" : {
    "account_nonce_size" : 0,
    "queue_by_address_and_nonce_size" : 0,
    "queue_size" : 0,
    "time_queue_size" : 0
    }
    },
    "ledger_manager" : {
    "account_count" : 4,
    "chain_max_ledger_seq" : 24,
    "hash_type" : "sha256",
    "lcl_header_space_used" : 512,
    "ledger_context" : {
    "completed_size" : 4,
    "running_size" : 0
    },
    "ledger_sequence" : 24,
    "sync" : {
    "peers" : null,
    "update_time" : 1711610539009038
    },
    "time" : "0 ms",
    "tx_count" : 6,
    "validation_address" : "adxSBC9QWrTfZjxjnPjKEF5LHGHYCpZ9BDdDF"
    },
    "peer_manager" : {
    "consensus_network" : {
    "broad_bigdata_queue_size" : 0,
    "broad_record_couple_size" : 27,
    "broad_record_size" : 27,
    "broad_sendbuffer_size" : 0,
    "node_rand" : "node-rand-1711610448824443-1053671824",
    "peer_active_size" : 0,
    "peer_cache_size" : 0,
    "peer_cache_space_used" : 56,
    "peer_list_size" : 0,
    "peer_listdel_size" : 0,
    "peers" : null,
    "recv_peerlist_size" : 0,
    "tx_task_size" : 0
    },
    "peer_node_address" : "adxSggi9WECzaaJNGtN1m6BAVP3P64DdCLCjs",
    "time" : "0 ms"
    },
    "web server" : {
    "context" : false,
    "end_request_count" : 0,
    "expire_request_count" : 0,
    "start_request_count" : 0,
    "thread_count" : 8,
    "time" : "0 ms"
    },
    "websocket_server" : {
    "clients" : [
    {
    "id" : 0,
    "in_bound" : true,
    "last_receive_time" : 1711610548476073,
    "peer_address" : "192.168.16.1:38887"
    },
    {
    "id" : 1,
    "in_bound" : true,
    "last_receive_time" : 1711610553361835,
    "peer_address" : "192.168.16.1:38908"
    }
    ],
    "listen_port" : 7053,
    "time" : "0 ms"
    }
    }

9.14 退出控制台

  • 调用方法

    exit
  • 示例

    > exit
    process exit

10. 客户端控制台

10.1. 介绍

本文档介绍了本地客户端控制台的功能,包括接口参数和返回内容的详细说明。客户端控制台具备本地账户签名算法和钱包管理等功能,能够与区块链节点进行交互,发送交易和查询数据。

10.2. 进入控制台

  • 调用方法

    --console-client <url> [key-path]
  • 请求参数

参数类型描述
urlString必填。节点的地址ip:port,port是websocket模块的端口。
key-pathString选填。指定keystore存储路径,默认存储在主目录.keystore文件下。当参数为相对路径时,是相对于当前所在路径。
  • 示例

    ./bubi --console-client 192.168.10.100:7053
    Welcome to the Bubichain console!

    instance: Bubichain/4.0.28;4002;secure:17;git:
    datadir: /root/keystore
    current time: 2024-07-12 07:30:43.009411

    Type "help" to get the help documentation
    >

    缺少参数url:

    ./bubi --console-client
    Missing parameter url.

    websocket连接超时:

    ./bubi --console-client 192.168.10.101:7053

    Error: Connection timedout. Please check the IP and port, or try again later.

    process exit

10.3. help

输出所有的控制台命令和功能描述

  • 调用方法

    help
  • 示例

    > help
    OPTIONS:
    createWallet [sign_type] Create wallet
    restoreWallet <private_key> Create wallet from private key
    listWallets List all wallet addresses
    openWallet <address> [time] Open a wallet that closes automatically after a timeout
    closeWallet Close the opened wallet
    getPrivatekey Show the private key of opened wallet
    deleteWallet Delete the opened wallet
    getBalance <ddress> Get the balance of the account in GAS
    getTransaction <hash1> [hash2] ... Query transactions with at least one hash
    payCoin <to_address> <amount(gas)> <fee_limit(gas)> <gas_price(base)> [input] [metadata]
    Pay coin or invoke a contract
    deployContract <contract-file-path> <owner> <amount(gas)> <fee_limit(gas)> <gas_price(ugas)> <type> <input> [metadata]
    Deploy contract
    callContract [contract_address] <input> [code] Query contract
    getState Get the status of the server
    exit Exit
    >

10.4. createWallet

创建钱包。

  • 调用方法

    createWallet [sign_type]
  • 请求参数

    参数类型描述
    sign_typeString选填。签名算法类型,支持“ed25519”、“sm2”。默认为ed25519。

    系统将提示输入 keystore 加密密码。连续输入两次相同的密码以进行确认。

  • 示例

    > createWallet
    Your new account is locked with a password. Please give a password. Do not forget this password.
    Password:
    Repeat password:

    Your new key was generated

    Address of the key: adxSqDdVX3hEycbPGTJvs1ynf3h6kCdoup37N
    Path of the secret key file: /root/keystore/adxSqDdVX3hEycbPGTJvs1ynf3h6kCdoup37N.wallet
    - You can share your address with anyone. Others need it to interact with you.
    - You must NEVER share the secret key with anyone! The key controls access to your funds!
    - You must BACKUP your key file! Without the key, it's impossible to access account funds!
    - You must REMEMBER your password! Without the password, it's impossible to decrypt the key!

    >

    参数无效:

    > createWallet ed255
    Error: Invalid signature type specified. Supported types are 'ed25519' and 'sm2'. Defaulting to 'ed25519'

    密码为空:

    > createWallet
    Your new account is locked with a password. Please give a password. Do not forget this password.
    Password:
    Error: Passwords can not be empty
    >

    密码不一致:

    > createWallet
    Your new account is locked with a password. Please give a password. Do not forget this password.
    Password:
    Repeat password:
    Error: Passwords do not match
    >

10.5. restoreWallet

通过私钥创建钱包。

  • 调用方法

    restoreWallet <private_key>
  • 请求参数

    参数类型描述
    private_keyString必填。账号私钥。

    系统将提示输入 keystore 加密密码。连续输入两次相同的密码以进行确认。

  • 示例

    > restoreWallet privbtBp152KnunKvCBgFQX96zuASSH6FBY9KVTX1bifPCLUWarq9EaN
    Your new account is locked with a password. Please give a password. Do not forget this password.
    Password:
    Repeat password:

    Your new key was generated

    Address of the key: adxSp1X4V7hXDDRBKHL6U21CpbPhki7YqjuUd
    Path of the secret key file: /root/keystore/adxSp1X4V7hXDDRBKHL6U21CpbPhki7YqjuUd.wallet
    - You can share your address with anyone. Others need it to interact with you.
    - You must NEVER share the secret key with anyone! The key controls access to your funds!
    - You must BACKUP your key file! Without the key, it's impossible to access account funds!
    - You must REMEMBER your password! Without the password, it's impossible to decrypt the key!

    >

    私钥无效:

    > restoreWallet privbtBp152KnunKvCBgFQX96zuASSH6FBY9KVTX1bifPCLUWarq
    Error: Invalid private key
    >

    缺少参数:

    > restoreWallet
    Error: Missing private key
    >

10.6. listWallets

列出所有钱包的账号地址。

  • 调用方法

    listWallets
  • 示例

    > listWallets

    Keystore path: /root/keystore

    ["adxSqDdVX3hEycbPGTJvs1ynf3h6kCdoup37N, "adxSp1X4V7hXDDRBKHL6U21CpbPhki7YqjuUd"]
    >

10.7. openWallet

打开一个钱包。

  • 调用方法

    openWallet <address> [time]
  • 请求参数

    参数类型描述
    addressString必填。账号地址。
    timeint64_t选填。超时时间,超时后自动关闭钱包,参数为0时,永久打开。单位为s,默认为300s。

    系统将提示输入 keystore 加密密码。

  • 示例

    > openWallet adxSqDdVX3hEycbPGTJvs1ynf3h6kCdoup37N
    Please enter the password for the wallet.
    Password:
    true
    >

    缺少参数:

    > openWallet
    Error: Missing address
    >

    keystore不存在:

    > openWallet adx
    Please enter the password for the wallet.
    Password:
    Error: Open failed, error desc(No such file or directory)
    >

10.8. closeWallet

关闭钱包。

  • 调用方法

    closeWallet
  • 示例

    > closeWallet
    true
    >

10.9. getPrivatekey

展示已打开钱包的私钥。

  • 调用方法

    getPrivatekey
  • 请求参数

    需要先打开钱包。系统将提示输入 keystore 加密密码。

  • 示例

    > getPrivatekey
    Please enter the password for the wallet.
    Password:
    privbxSFduyYKfU6Z2fyHGf91egn5cS1X2sfPn3XEn4puxvyAu971SPF
    >

    没有打开钱包:

    > getPrivatekey
    Error, No wallet is currently open
    >

10.10. deleteWallet

删除已打开的钱包。

  • 调用方法

    deleteWallet
  • 请求参数

    需要先打开钱包。系统将提示输入 keystore 加密密码。

  • 示例

    > deleteWallet
    Please enter the password for the wallet.
    Password:
    true
    >

    没有打开钱包:

    > deleteWallet
    Error, No wallet is currently open
    >

10.11. getBalance

查询账号余额,单位GAS。

  • 调用方法

    getBalance <address>
  • 请求参数

    参数类型描述
    addressstring必填。账号地址。
  • 示例

    > getBalance adxSp1X4V7hXDDRBKHL6U21CpbPhki7YqjuUd
    1000000000 GAS
    >

    账号不存在:

    > getBalance adxSqDdVX3hEycbPGTJvs1ynf3h6kCdoup37N
    Error: Account not exist
    >

    缺少参数:

    > getBalance
    Error: Missing address
    >

10.12. getTransaction

查询交易。

  • 调用方法

    getTransaction <hash1> [hash2]
  • 请求参数

    参数类型描述
    hash1string必填。交易哈希,可以同时查询多个交易,至少填写一个。
    hash2string选填。
  • 示例

    > getTransaction 6d787804008310e22bda1f141377f884e0868a548664a0c8f7027425397b9c71 21855a7fb9dde7bde00d617dc62ea32a46c27e8a586fc199842a9635142b4768 21855a7fb9dde7
    [
    {
    "result" : {
    "actual_fee" : 407000,
    "close_time" : 1720775619558152,
    "hash" : "36643738373830343030383331306532326264613166313431333737663838346530383638613534383636346130633866373032373432353339376239633731",
    "ledger_seq" : 53,
    "signatures" : [
    {
    "public_key" : "b001ac76f97b0fda145c68e2edf6665c247a292260694b5dfcacac8acb658bd3746e7d8a3032",
    "sign_data" : "26238ddc6381f257ffb4cd48cc0078baff0776ad4ba180e097163fdb7c46ddbcfedd0d13a3ef30376f7bc88694c4fa6ce3c66396b3ad56fd98c8992da75f280f"
    },
    {
    "public_key" : "b00132c3d1244e0be4d711fb12d5b3d24abeb60f11e8c61c5efe28ad20b793d7fb2402f819e9",
    "sign_data" : "4ebfbffdec408b87cc890c4963fb6f4590b03a2ef22d6b91941fe1c6cfdbe2917f1739d1ae681d0d4d7210e31f3df440ac19f590392bd1482c750457df3c470c"
    }
    ],
    "transaction" : {
    "fee_limit" : 100000000000,
    "gas_price" : 1000,
    "nonce" : 1,
    "operations" : [
    {
    "create_account" : {
    "contract" : null,
    "dest_address" : "adxSiMTDBBD3paasnw55MbKjYnyDdSRTGksaT",
    "init_balance" : 10000000,
    "priv" : {
    "master_weight" : 1,
    "thresholds" : {
    "tx_threshold" : 1
    }
    }
    },
    "type" : 1
    }
    ],
    "source_address" : "adxSp1X4V7hXDDRBKHL6U21CpbPhki7YqjuUd"
    },
    "tx_size" : 407
    }
    },
    {
    "result" : {
    "hash" : "32313835356137666239646465376264653030643631376463363265613332613436633237653861353836666331393938343261393633353134326234373638",
    "incoming_time" : 1720775640924849,
    "signatures" : [
    {
    "public_key" : "b001ac76f97b0fda145c68e2edf6665c247a292260694b5dfcacac8acb658bd3746e7d8a3032",
    "sign_data" : "ce45359253126ae91b6532f4cee5727a2fceb2b47b8fbff783f737edb6e065478e5f3c14f90a90d0e33028bf5718066c1995eff2b39843fbc81edf3a95b7b90a"
    },
    {
    "public_key" : "b00132c3d1244e0be4d711fb12d5b3d24abeb60f11e8c61c5efe28ad20b793d7fb2402f819e9",
    "sign_data" : "bf91bf19058c9efe0cf7549a7e50497072d73bba5604171f4236bad94edc16bffff6c364908e0fdaa51642f0ecfa25249e1e70f0ff84541cceb4872aaf21a40a"
    }
    ],
    "status" : "processing",
    "transaction" : {
    "fee_limit" : 100000000000,
    "gas_price" : 1000,
    "nonce" : 1001,
    "operations" : [
    {
    "create_account" : {
    "contract" : null,
    "dest_address" : "adxSiMTDBBD3paasnw55MbKjYnyDdSRTGksaT",
    "init_balance" : 10000000,
    "priv" : {
    "master_weight" : 1,
    "thresholds" : {
    "tx_threshold" : 1
    }
    }
    },
    "type" : 1
    }
    ],
    "source_address" : "adxSp1X4V7hXDDRBKHL6U21CpbPhki7YqjuUd"
    }
    }
    },
    {
    "result" : {
    "error_code" : 4,
    "error_desc" : "Query result not exist"
    }
    }
    ]
    >

10.13. payCoin

转移gas或调用合约main接口。

  • 调用方法

    payCoin <to-address> <amount> <fee_limit> <gas_price> [input] [metadata]
  • 请求参数

    参数类型描述
    to-addressstring必填。账号私钥。
    amountdouble必填。转移gas数量。单位GAS。
    fee_limitdouble必填。fee最大限制。单位GAS。
    gas_priceint64_t必填。gas价格。单位UGAS。
    inputstring选填。调用合约时的参数。
    metadatastring选填。交易备注。

    需要先打开钱包。系统将提示输入 keystore 加密密码。

  • 示例

    > payCoin adxSiMTDBBD3paasnw55MbKjYnyDdSRTGksaT 0.0001 100 1000 2
    Please enter the password for the wallet.
    Password:

    {
    "source_address" : "adxSp1X4V7hXDDRBKHL6U21CpbPhki7YqjuUd",
    "status" : 1,
    "timestamp" : 1720776094196774,
    "tx_hash" : "e874a83eee9df895514d67845c62d1a754e786547dcb41c66a00b39c9f531617"
    }

    >

    没有打开钱包:

    > payCoin adxSiMTDBBD3paasnw55MbKjYnyDdSRTGksaT 0.0001 100 1000 2
    Error, No wallet is currently open
    >

    缺少参数:

    > payCoin
    Error: Missing params
    >

10.14. deployContract

部署合约。

  • 调用方法

    deployContract <contract-file-path> <owner> <amount> <fee_limit> <gas_price>  <type> [input] [metadata]
  • 请求参数

    参数类型描述
    contract-file-pathstring必填。合约代码路径。
    ownerstring必填。合约拥有者。
    amountdouble必填。合约账号初始化金额。GAS
    fee_limitdouble必填。fee最大限制。GAS
    gas_priceint64_t必填。gas价格。UGAS
    typeint必填。合约类型。0是js合约,1是solidity合约,2是go合约,3是c++合约。
    inputstring选填。合约初始化参数。
    metadatastirng选填。交易备注。

    需要先打开钱包。系统将提示输入 keystore 加密密码。

  • 示例

    > deployContract /home/yu/contract.js adxSp1X4V7hXDDRBKHL6U21CpbPhki7YqjuUd 1 100 1000 5 0
    Please enter the password for the wallet.
    Password:

    {
    "source_address" : "adxSp1X4V7hXDDRBKHL6U21CpbPhki7YqjuUd",
    "status" : 1,
    "timestamp" : 1720776764121787,
    "tx_hash" : "f77401a4df70844c029192894c0c08efe842c90142ed7b08d0419186c58cebca"
    }

    >

10.15. callContact

查询合约。

  • 调用方法

    callContract [contract-address] <input> [contract-path]
  • 请求参数

    参数类型描述
    contract-addressstring选填。合约账号地址。如果为空contract-path必须填写。
    inputstring必填。查询合约参数。
    contract-pathstring选填。合约代码路径。

    需要先打开钱包。系统将提示输入 keystore 加密密码。

  • 示例

    > callContract adxSTb2TW6HMjHjFPQAjVTJmyKh7khvSk4BY1 100

    {
    "logs" : {
    "0-adxSTb2TW6HMjHjFPQAjVTJmyKh7khvSk4BY1" : null
    },
    "query_rets" : [
    {
    "result" : {
    "type" : "string",
    "value" : "100"
    }
    }
    ],
    "stat" : {
    "apply_time" : 6064,
    "memory_usage" : 1828160,
    "stack_usage" : 0,
    "step" : 5
    },
    "txs" : null
    }

    >

10.16. getStatus

查询服务端节点状态。

  • 调用方法

    getState
  • 示例

    > getState

    {
    "consensus manager" : {
    "consensus" : {
    "abnormal_records" : null,
    "ckp_interval" : 10,
    "fault_number" : 0,
    "instances" : [
    {
    "commits" : [
    "type:Commit | vn:655 seq:657 replica:0 | value:e6551bc1d9c47c360b0c0b327d544c94373133c4a74abf930dd0debf35ece31f"
    ],
    "cons_value" : "value hash(e6551bc1d9c47c360b0c0b327d544c94373133c4a74abf930dd0debf35ece31f) | close time(1720776391474335) | lcl hash(5bab3508) | ledger seq(657) ",
    "end_time" : "2024-07-12 09:26:31.487265",
    "have_send_viewchange" : false,
    "last_propose_time" : "2024-07-12 09:26:31.485085",
    "phase" : "PHASE_COMMITED",
    "phase_item" : 0,
    "pre_prepare" : "type:Pre-Prepare | vn:655 seq:657 replica:0 | value: e6551bc1d9c47c360b0c0b327d544c94373133c4a74abf930dd0debf35ece31f ",
    "pre_prepare_round" : 1,
    "prepares" : [
    "type:Prepare | vn:655 seq:657 replica:0 | value:e6551bc1d9c47c360b0c0b327d544c94373133c4a74abf930dd0debf35ece31f"
    ],
    "seq" : 657,
    "start_time" : "2024-07-12 09:26:31.485085",
    "vn" : 655
    },
    {
    "commits" : [
    "type:Commit | vn:656 seq:658 replica:0 | value:c75645078dda234031a23c4aeda503bf9634667c39b23502c68f9dfc34c99dda"
    ],
    "cons_value" : "value hash(c75645078dda234031a23c4aeda503bf9634667c39b23502c68f9dfc34c99dda) | close time(1720776429794247) | lcl hash(e373afb3) | ledger seq(658) ",
    "end_time" : "2024-07-12 09:27:09.829072",
    "have_send_viewchange" : false,
    "last_propose_time" : "2024-07-12 09:27:09.825807",
    "phase" : "PHASE_COMMITED",
    "phase_item" : 0,
    "pre_prepare" : "type:Pre-Prepare | vn:656 seq:658 replica:0 | value: c75645078dda234031a23c4aeda503bf9634667c39b23502c68f9dfc34c99dda ",
    "pre_prepare_round" : 1,
    "prepares" : [
    "type:Prepare | vn:656 seq:658 replica:0 | value:c75645078dda234031a23c4aeda503bf9634667c39b23502c68f9dfc34c99dda"
    ],
    "seq" : 658,
    "start_time" : "2024-07-12 09:27:09.825807",
    "vn" : 656
    },
    {
    "commits" : [
    "type:Commit | vn:657 seq:659 replica:0 | value:8ef5ededa06ea2a3550ace968e54a466715ddb8f15ae74a968f34a30c4c43a59"
    ],
    "cons_value" : "value hash(8ef5ededa06ea2a3550ace968e54a466715ddb8f15ae74a968f34a30c4c43a59) | close time(1720776489792419) | lcl hash(39cf6e22) | ledger seq(659) ",
    "end_time" : "2024-07-12 09:28:09.807027",
    "have_send_viewchange" : false,
    "last_propose_time" : "2024-07-12 09:28:09.803482",
    "phase" : "PHASE_COMMITED",
    "phase_item" : 0,
    "pre_prepare" : "type:Pre-Prepare | vn:657 seq:659 replica:0 | value: 8ef5ededa06ea2a3550ace968e54a466715ddb8f15ae74a968f34a30c4c43a59 ",
    "pre_prepare_round" : 1,
    "prepares" : [
    "type:Prepare | vn:657 seq:659 replica:0 | value:8ef5ededa06ea2a3550ace968e54a466715ddb8f15ae74a968f34a30c4c43a59"
    ],
    "seq" : 659,
    "start_time" : "2024-07-12 09:28:09.803482",
    "vn" : 657
    }
    ],
    "is_leader" : true,
    "last_exe_seq" : 659,
    "leader" : "adxSBC9QWrTfZjxjnPjKEF5LHGHYCpZ9BDdDF",
    "quorum_size" : 0,
    "replica_id" : 0,
    "type" : "pbft",
    "validator_address" : "adxSBC9QWrTfZjxjnPjKEF5LHGHYCpZ9BDdDF",
    "validator_address_random" : false,
    "validators" : [ "adxSBC9QWrTfZjxjnPjKEF5LHGHYCpZ9BDdDF" ],
    "view_active" : true,
    "view_number" : 658,
    "viewchanges" : null
    },
    "time" : "0 ms"
    },
    "glue_manager" : {
    "del_tx_count" : 2,
    "ledger_upgrade" : {
    "current_states" : null,
    "local_state" : null
    },
    "new_tx_count" : 3,
    "system" : {
    "current_time" : "2024-07-12 09:29:00",
    "process_uptime" : "2024-07-12 09:26:30",
    "uptime" : "2024-07-10 15:55:13"
    },
    "time" : "0 ms",
    "transaction_pool" : {
    "account_nonce_size" : 0,
    "queue_by_address_and_nonce_size" : 0,
    "queue_size" : 0,
    "time_queue_size" : 0
    }
    },
    "ledger_manager" : {
    "account_count" : 4,
    "chain_max_ledger_seq" : 659,
    "hash_type" : "sha256",
    "lcl_header_space_used" : 512,
    "ledger_context" : {
    "completed_size" : 0,
    "running_size" : 0
    },
    "ledger_sequence" : 659,
    "sync" : {
    "peers" : null,
    "update_time" : 1720776520183902
    },
    "time" : "0 ms",
    "tx_count" : 3,
    "validation_address" : "adxSBC9QWrTfZjxjnPjKEF5LHGHYCpZ9BDdDF"
    },
    "peer_manager" : {
    "consensus_network" : {
    "broad_bigdata_queue_size" : 0,
    "broad_record_couple_size" : 18,
    "broad_record_size" : 18,
    "broad_sendbuffer_size" : 0,
    "node_rand" : "node-rand-1720776390443110-1390806236",
    "peer_active_size" : 0,
    "peer_cache_size" : 0,
    "peer_cache_space_used" : 56,
    "peer_list_size" : 0,
    "peer_listdel_size" : 0,
    "peers" : null,
    "recv_peerlist_size" : 0,
    "tx_task_size" : 0
    },
    "peer_node_address" : "adxSggi9WECzaaJNGtN1m6BAVP3P64DdCLCjs",
    "time" : "0 ms"
    },
    "web server" : {
    "context" : false,
    "end_request_count" : 0,
    "expire_request_count" : 0,
    "start_request_count" : 0,
    "thread_count" : 8,
    "time" : "0 ms"
    },
    "websocket_server" : {
    "clients" : null,
    "listen_port" : 7053,
    "time" : "0 ms"
    }
    }

    >

10.17. exit

退出控制台。

  • 调用方法

    exit
  • 示例

    > exit
    process exit