控制台

标签:go-sdk Go SDK控制台


Go SDK 通过 console.go 实现了一个简单的控制台,支持区块链和节点信息查询。

使用

  • 拉取代码并编译

# 拉取代码
git clone https://github.com/FISCO-BCOS/go-sdk.git

# 若因为网络问题导致长时间无法执行上面的命令,请尝试以下命令:
git clone https://gitee.com/FISCO-BCOS/go-sdk.git

# 切换目录
cd go-sdk
# 编译 cmd/console.go
go build cmd/console.go
  • 请拷贝对应的 ca.crt、sdk.crt 和 sdk.key 证书至console可执行文件工作目录

getBlockByHash

根据区块哈希获取区块信息:

./console getBlockByHash [blockHash] [true/false]

参数包括:

  • blockHash:区块 hash 值;

  • true/false:true 会返回区块中所有交易的详细内容,false 只会返回区块中所有交易的 hash 值,默认为 true。

> ./console getBlockByHash 0xce28a18b54ee72450c403968f705253a59c87a22801a88cc642ae800bb8b4848 true

Block:
{
  "extraData": [],
  "gasLimit": "0x0",
  "gasUsed": "0x0",
  "hash": "0xce28a18b54ee72450c403968f705253a59c87a22801a88cc642ae800bb8b4848",
  "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
  "number": "0x3",
  "parentHash": "0x57016509418eb81c0353b1252a364383fcfc5c71035c8a01d24e785ac6e2ce4a",
  "receiptsRoot": "0x4e430ca6474d7013a819a7c602497b7bfdfa14a1197a1edc35444b756cf7e6fc",
  "sealer": "0x1",
  "sealerList": [
    "42ae2ae3950a2933b6f576dc946b90b242b7f9a2a8d45aae53c1a1664cd582bd759fa69e4b52f7a453dce702878b9ef11fd34fce1bd15c9bdcabcbbee43e1302",
    "8b5e90815966004e807803aba5f003bc271d0b0aa82805c85764b21187bd504f79ec46eaf1e60752956af174a927d7b16c072c0bca1601968b29342521639c14",
    "95381c1d22d10ad73171f0d34ec1f2e5809f47ee76264aeed4bb0daaf594bfb5da89f6a65ff4a056952f66a6a99fc927320d002191cecc7a48905edd61ad84b7",
    "955ab783c6adc7a5f817773a5fbe32ecd9310f9392406eb1f9fa3d2b21539577a70c933158c1bd3a0bf183d5498bf57202b88401e1cb20e8972aab43ba3354f0"
  ],
  "stateRoot": "0x2d23b1248fe53a1769db06af5c0e99261678643f405f058cfa89193592d13fa7",
  "timestamp": "0x172fe19b855",
  "transactions": [
    {
      "blockHash": "0xce28a18b54ee72450c403968f705253a59c87a22801a88cc642ae800bb8b4848",
      "blockNumber": "0x3",
      "from": "0x4ca29e9e8cb79c863c04f83827ab540315f25e67",
      "gas": "0x11e1a300",
      "gasPrice": "0x11e1a300",
      "hash": "0x5518df7c2063efeb6481c35c4c58f378fac5f476c023c2019b9b01d221478434",
      "input": "0x2800efc0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000803432616532616533393530613239333362366635373664633934366239306232343262376639613261386434356161653533633161313636346364353832626437353966613639653462353266376134353364636537303238373862396566313166643334666365316264313563396264636162636262656534336531333032",
      "nonce": "0x359fbc4677e4f4ca87a96a31372b1194f03ba200db94a18ad0b30f2e858ac32",
      "to": "0x0000000000000000000000000000000000001003",
      "transactionIndex": "0x0",
      "value": "0x0"
    }
  ],
  "transactionsRoot": "0xcf057dc481d7a97700e93a1ea65f331c3cfee2fee80e3bb80c30748e4988fe9d"
}

> ./console getBlockByHash 0xce28a18b54ee72450c403968f705253a59c87a22801a88cc642ae800bb8b4848 false

Block:
{
  "extraData": [],
  "gasLimit": "0x0",
  "gasUsed": "0x0",
  "hash": "0xce28a18b54ee72450c403968f705253a59c87a22801a88cc642ae800bb8b4848",
  "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
  "number": "0x3",
  "parentHash": "0x57016509418eb81c0353b1252a364383fcfc5c71035c8a01d24e785ac6e2ce4a",
  "receiptsRoot": "0x4e430ca6474d7013a819a7c602497b7bfdfa14a1197a1edc35444b756cf7e6fc",
  "sealer": "0x1",
  "sealerList": [
    "42ae2ae3950a2933b6f576dc946b90b242b7f9a2a8d45aae53c1a1664cd582bd759fa69e4b52f7a453dce702878b9ef11fd34fce1bd15c9bdcabcbbee43e1302",
    "8b5e90815966004e807803aba5f003bc271d0b0aa82805c85764b21187bd504f79ec46eaf1e60752956af174a927d7b16c072c0bca1601968b29342521639c14",
    "95381c1d22d10ad73171f0d34ec1f2e5809f47ee76264aeed4bb0daaf594bfb5da89f6a65ff4a056952f66a6a99fc927320d002191cecc7a48905edd61ad84b7",
    "955ab783c6adc7a5f817773a5fbe32ecd9310f9392406eb1f9fa3d2b21539577a70c933158c1bd3a0bf183d5498bf57202b88401e1cb20e8972aab43ba3354f0"
  ],
  "stateRoot": "0x2d23b1248fe53a1769db06af5c0e99261678643f405f058cfa89193592d13fa7",
  "timestamp": "0x172fe19b855",
  "transactions": [
    "0x5518df7c2063efeb6481c35c4c58f378fac5f476c023c2019b9b01d221478434"
  ],
  "transactionsRoot": "0xcf057dc481d7a97700e93a1ea65f331c3cfee2fee80e3bb80c30748e4988fe9d"
}

getBlockByNumber

根据区块高度获取区块信息:

./console getBlockByNumber [blockNumber] [true/false]

参数包括:

  • blockNumber:区块高度;

  • true/false:true 会返回区块中所有交易的详细内容,false 只会返回区块中所有交易的 hash 值,默认为 true。

> ./console getBlockByNumber 3 true

Block:
{
  "dbHash": "0x2d23b1248fe53a1769db06af5c0e99261678643f405f058cfa89193592d13fa7",
  "extraData": [],
  "gasLimit": "0x0",
  "gasUsed": "0x0",
  "hash": "0xce28a18b54ee72450c403968f705253a59c87a22801a88cc642ae800bb8b4848",
  "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
  "number": "0x3",
  "parentHash": "0x57016509418eb81c0353b1252a364383fcfc5c71035c8a01d24e785ac6e2ce4a",
  "receiptsRoot": "0x4e430ca6474d7013a819a7c602497b7bfdfa14a1197a1edc35444b756cf7e6fc",
  "sealer": "0x1",
  "sealerList": [
    "42ae2ae3950a2933b6f576dc946b90b242b7f9a2a8d45aae53c1a1664cd582bd759fa69e4b52f7a453dce702878b9ef11fd34fce1bd15c9bdcabcbbee43e1302",
    "8b5e90815966004e807803aba5f003bc271d0b0aa82805c85764b21187bd504f79ec46eaf1e60752956af174a927d7b16c072c0bca1601968b29342521639c14",
    "95381c1d22d10ad73171f0d34ec1f2e5809f47ee76264aeed4bb0daaf594bfb5da89f6a65ff4a056952f66a6a99fc927320d002191cecc7a48905edd61ad84b7",
    "955ab783c6adc7a5f817773a5fbe32ecd9310f9392406eb1f9fa3d2b21539577a70c933158c1bd3a0bf183d5498bf57202b88401e1cb20e8972aab43ba3354f0"
  ],
  "stateRoot": "0x2d23b1248fe53a1769db06af5c0e99261678643f405f058cfa89193592d13fa7",
  "timestamp": "0x172fe19b855",
  "transactions": [
    {
      "blockHash": "0xce28a18b54ee72450c403968f705253a59c87a22801a88cc642ae800bb8b4848",
      "blockNumber": "0x3",
      "from": "0x4ca29e9e8cb79c863c04f83827ab540315f25e67",
      "gas": "0x11e1a300",
      "gasPrice": "0x11e1a300",
      "hash": "0x5518df7c2063efeb6481c35c4c58f378fac5f476c023c2019b9b01d221478434",
      "input": "0x2800efc0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000803432616532616533393530613239333362366635373664633934366239306232343262376639613261386434356161653533633161313636346364353832626437353966613639653462353266376134353364636537303238373862396566313166643334666365316264313563396264636162636262656534336531333032",
      "nonce": "0x359fbc4677e4f4ca87a96a31372b1194f03ba200db94a18ad0b30f2e858ac32",
      "to": "0x0000000000000000000000000000000000001003",
      "transactionIndex": "0x0",
      "value": "0x0"
    }
  ],
  "transactionsRoot": "0xcf057dc481d7a97700e93a1ea65f331c3cfee2fee80e3bb80c30748e4988fe9d"
}

> ./console getBlockByNumber 3 false

Block:
{
  "dbHash": "0x2d23b1248fe53a1769db06af5c0e99261678643f405f058cfa89193592d13fa7",
  "extraData": [],
  "gasLimit": "0x0",
  "gasUsed": "0x0",
  "hash": "0xce28a18b54ee72450c403968f705253a59c87a22801a88cc642ae800bb8b4848",
  "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
  "number": "0x3",
  "parentHash": "0x57016509418eb81c0353b1252a364383fcfc5c71035c8a01d24e785ac6e2ce4a",
  "receiptsRoot": "0x4e430ca6474d7013a819a7c602497b7bfdfa14a1197a1edc35444b756cf7e6fc",
  "sealer": "0x1",
  "sealerList": [
    "42ae2ae3950a2933b6f576dc946b90b242b7f9a2a8d45aae53c1a1664cd582bd759fa69e4b52f7a453dce702878b9ef11fd34fce1bd15c9bdcabcbbee43e1302",
    "8b5e90815966004e807803aba5f003bc271d0b0aa82805c85764b21187bd504f79ec46eaf1e60752956af174a927d7b16c072c0bca1601968b29342521639c14",
    "95381c1d22d10ad73171f0d34ec1f2e5809f47ee76264aeed4bb0daaf594bfb5da89f6a65ff4a056952f66a6a99fc927320d002191cecc7a48905edd61ad84b7",
    "955ab783c6adc7a5f817773a5fbe32ecd9310f9392406eb1f9fa3d2b21539577a70c933158c1bd3a0bf183d5498bf57202b88401e1cb20e8972aab43ba3354f0"
  ],
  "stateRoot": "0x2d23b1248fe53a1769db06af5c0e99261678643f405f058cfa89193592d13fa7",
  "timestamp": "0x172fe19b855",
  "transactions": [
    "0x5518df7c2063efeb6481c35c4c58f378fac5f476c023c2019b9b01d221478434"
  ],
  "transactionsRoot": "0xcf057dc481d7a97700e93a1ea65f331c3cfee2fee80e3bb80c30748e4988fe9d"
}

getBlockHashByNumber

根据区块高度获取区块哈希:

./console getBlockHashByNumber [blockNumber]

参数包括:

  • blockNumber:区块高度。

> ./console getBlockHashByNumber 3

Block Hash:
"0xce28a18b54ee72450c403968f705253a59c87a22801a88cc642ae800bb8b4848"

getBlockNumber

获取最新块高:

> ./console getBlockNumber

blocknumber:
    hex: "0x3"
decimal:  3

getCode

根据合约地址查询合约数据:

./console getCode [contract address]

参数包括:

  • contract address:合约地址。

> ./console getCode 0x65474dbd4f08170bc2dc30f9ae32f8e2206b15a6

Contract Code:
"0x60806040526004361061004c576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680634ed3885e146100515780636d4ce63c146100ba575b600080fd5b34801561005d57600080fd5b506100b8600480360381019080803590602001908201803590602001908080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050919291929050505061014a565b005b3480156100c657600080fd5b506100cf610164565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561010f5780820151818401526020810190506100f4565b50505050905090810190601f16801561013c5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b8060009080519060200190610160929190610206565b5050565b606060008054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156101fc5780601f106101d1576101008083540402835291602001916101fc565b820191906000526020600020905b8154815290600101906020018083116101df57829003601f168201915b5050505050905090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061024757805160ff1916838001178555610275565b82800160010185558215610275579182015b82811115610274578251825591602001919060010190610259565b5b5090506102829190610286565b5090565b6102a891905b808211156102a457600081600090555060010161028c565b5090565b905600a165627a7a72305820d0c58adfbd1215902f16e710a4e52b14e5c9ad7f0f3363c86d2b3156894bd0610029"

getConsensusStatus

获取区块链节点共识状态

> ./console getConsensusStatus

Consensus Status:
[
  {
    "accountType": 1,
    "allowFutureBlocks": true,
    "cfgErr": false,
    "connectedNodes": 3,
    "consensusedBlockNumber": 4,
    "currentView": 80,
    "groupId": 1,
    "highestblockHash": "0xce28a18b54ee72450c403968f705253a59c87a22801a88cc642ae800bb8b4848",
    "highestblockNumber": 3,
    "leaderFailed": false,
    "max_faulty_leader": 0,
    "nodeId": "955ab783c6adc7a5f817773a5fbe32ecd9310f9392406eb1f9fa3d2b21539577a70c933158c1bd3a0bf183d5498bf57202b88401e1cb20e8972aab43ba3354f0",
    "nodeNum": 3,
    "node_index": 2,
    "omitEmptyBlock": true,
    "protocolId": 65544,
    "sealer.0": "8b5e90815966004e807803aba5f003bc271d0b0aa82805c85764b21187bd504f79ec46eaf1e60752956af174a927d7b16c072c0bca1601968b29342521639c14",
    "sealer.1": "95381c1d22d10ad73171f0d34ec1f2e5809f47ee76264aeed4bb0daaf594bfb5da89f6a65ff4a056952f66a6a99fc927320d002191cecc7a48905edd61ad84b7",
    "sealer.2": "955ab783c6adc7a5f817773a5fbe32ecd9310f9392406eb1f9fa3d2b21539577a70c933158c1bd3a0bf183d5498bf57202b88401e1cb20e8972aab43ba3354f0",
    "toView": 80
  },
  [
    {
      "nodeId": "8b5e90815966004e807803aba5f003bc271d0b0aa82805c85764b21187bd504f79ec46eaf1e60752956af174a927d7b16c072c0bca1601968b29342521639c14",
      "view": 78
    },
    {
      "nodeId": "95381c1d22d10ad73171f0d34ec1f2e5809f47ee76264aeed4bb0daaf594bfb5da89f6a65ff4a056952f66a6a99fc927320d002191cecc7a48905edd61ad84b7",
      "view": 79
    },
    {
      "nodeId": "955ab783c6adc7a5f817773a5fbe32ecd9310f9392406eb1f9fa3d2b21539577a70c933158c1bd3a0bf183d5498bf57202b88401e1cb20e8972aab43ba3354f0",
      "view": 80
    }
  ]
]

getGroupID

获取配置文件中指定的连接节点群组ID:

> ./console getGroupID

Group ID:
1

getGroupList

获取节点所属群组的群组ID列表:

> ./console getGroupList

Group ID List:
[
  1
]

getGroupPeers

获取指定群组的共识节点和观察节点列表:

> ./console getGroupPeers

Peers:
[
  "42ae2ae3950a2933b6f576dc946b90b242b7f9a2a8d45aae53c1a1664cd582bd759fa69e4b52f7a453dce702878b9ef11fd34fce1bd15c9bdcabcbbee43e1302",
  "8b5e90815966004e807803aba5f003bc271d0b0aa82805c85764b21187bd504f79ec46eaf1e60752956af174a927d7b16c072c0bca1601968b29342521639c14",
  "95381c1d22d10ad73171f0d34ec1f2e5809f47ee76264aeed4bb0daaf594bfb5da89f6a65ff4a056952f66a6a99fc927320d002191cecc7a48905edd61ad84b7",
  "955ab783c6adc7a5f817773a5fbe32ecd9310f9392406eb1f9fa3d2b21539577a70c933158c1bd3a0bf183d5498bf57202b88401e1cb20e8972aab43ba3354f0"
]

getNodeIDList

获取节点及其连接节点的列表:

> ./console getNodeIDList

Node ID list:
[
  "955ab783c6adc7a5f817773a5fbe32ecd9310f9392406eb1f9fa3d2b21539577a70c933158c1bd3a0bf183d5498bf57202b88401e1cb20e8972aab43ba3354f0",
  "8b5e90815966004e807803aba5f003bc271d0b0aa82805c85764b21187bd504f79ec46eaf1e60752956af174a927d7b16c072c0bca1601968b29342521639c14",
  "42ae2ae3950a2933b6f576dc946b90b242b7f9a2a8d45aae53c1a1664cd582bd759fa69e4b52f7a453dce702878b9ef11fd34fce1bd15c9bdcabcbbee43e1302",
  "95381c1d22d10ad73171f0d34ec1f2e5809f47ee76264aeed4bb0daaf594bfb5da89f6a65ff4a056952f66a6a99fc927320d002191cecc7a48905edd61ad84b7"
]

getObserverList

获取观察者节点列表:

> ./console getObserverList

Observer List:
[
  "42ae2ae3950a2933b6f576dc946b90b242b7f9a2a8d45aae53c1a1664cd582bd759fa69e4b52f7a453dce702878b9ef11fd34fce1bd15c9bdcabcbbee43e1302"
]

getPbftView

获取PBFT视图:

> ./console getPbftView

PBFT view:
"0x30"

getPeers

获取区块链节点的连接信息:

> ./console getPeers

Peers:
[
  {
    "Agency": "agency",
    "IPAndPort": "127.0.0.1:51808",
    "Node": "node3",
    "NodeID": "8b5e90815966004e807803aba5f003bc271d0b0aa82805c85764b21187bd504f79ec46eaf1e60752956af174a927d7b16c072c0bca1601968b29342521639c14",
    "Topic": []
  },
  {
    "Agency": "agency",
    "IPAndPort": "127.0.0.1:30302",
    "Node": "node2",
    "NodeID": "42ae2ae3950a2933b6f576dc946b90b242b7f9a2a8d45aae53c1a1664cd582bd759fa69e4b52f7a453dce702878b9ef11fd34fce1bd15c9bdcabcbbee43e1302",
    "Topic": []
  },
  {
    "Agency": "agency",
    "IPAndPort": "127.0.0.1:30301",
    "Node": "node1",
    "NodeID": "95381c1d22d10ad73171f0d34ec1f2e5809f47ee76264aeed4bb0daaf594bfb5da89f6a65ff4a056952f66a6a99fc927320d002191cecc7a48905edd61ad84b7",
    "Topic": []
  }
]

getPendingTxSize

获取交易池内未上链的交易数目:

> ./console getPendingTxSize

Pending Transactions Count:
    hex: "0x0"
decimal:  0

getSealerList

获取共识节点列表:

>  ./console getSealerList

Sealer List:
[
  "8b5e90815966004e807803aba5f003bc271d0b0aa82805c85764b21187bd504f79ec46eaf1e60752956af174a927d7b16c072c0bca1601968b29342521639c14",
  "95381c1d22d10ad73171f0d34ec1f2e5809f47ee76264aeed4bb0daaf594bfb5da89f6a65ff4a056952f66a6a99fc927320d002191cecc7a48905edd61ad84b7",
  "955ab783c6adc7a5f817773a5fbe32ecd9310f9392406eb1f9fa3d2b21539577a70c933158c1bd3a0bf183d5498bf57202b88401e1cb20e8972aab43ba3354f0"
]

getSyncStatus

获取区块链节点同步状态:

> ./console getSyncStatus

Synchronization Status:
{
  "blockNumber": 3,
  "genesisHash": "65e9c13da61b1f47564ccc6498260d739ce3dfd3366accc539a64412c1ef8e88",
  "isSyncing": false,
  "knownHighestNumber": 3,
  "knownLatestHash": "ce28a18b54ee72450c403968f705253a59c87a22801a88cc642ae800bb8b4848",
  "latestHash": "ce28a18b54ee72450c403968f705253a59c87a22801a88cc642ae800bb8b4848",
  "nodeId": "955ab783c6adc7a5f817773a5fbe32ecd9310f9392406eb1f9fa3d2b21539577a70c933158c1bd3a0bf183d5498bf57202b88401e1cb20e8972aab43ba3354f0",
  "peers": [
    {
      "blockNumber": 3,
      "genesisHash": "65e9c13da61b1f47564ccc6498260d739ce3dfd3366accc539a64412c1ef8e88",
      "latestHash": "ce28a18b54ee72450c403968f705253a59c87a22801a88cc642ae800bb8b4848",
      "nodeId": "42ae2ae3950a2933b6f576dc946b90b242b7f9a2a8d45aae53c1a1664cd582bd759fa69e4b52f7a453dce702878b9ef11fd34fce1bd15c9bdcabcbbee43e1302"
    },
    {
      "blockNumber": 3,
      "genesisHash": "65e9c13da61b1f47564ccc6498260d739ce3dfd3366accc539a64412c1ef8e88",
      "latestHash": "ce28a18b54ee72450c403968f705253a59c87a22801a88cc642ae800bb8b4848",
      "nodeId": "8b5e90815966004e807803aba5f003bc271d0b0aa82805c85764b21187bd504f79ec46eaf1e60752956af174a927d7b16c072c0bca1601968b29342521639c14"
    },
    {
      "blockNumber": 3,
      "genesisHash": "65e9c13da61b1f47564ccc6498260d739ce3dfd3366accc539a64412c1ef8e88",
      "latestHash": "ce28a18b54ee72450c403968f705253a59c87a22801a88cc642ae800bb8b4848",
      "nodeId": "95381c1d22d10ad73171f0d34ec1f2e5809f47ee76264aeed4bb0daaf594bfb5da89f6a65ff4a056952f66a6a99fc927320d002191cecc7a48905edd61ad84b7"
    }
  ],
  "protocolId": 65545,
  "txPoolSize": "0"
}

getSystemConfigByKey

根据关键字获取区块链系统配置:

./console getSystemConfigByKey [tx_count_limit/tx_gas_limit]

参数包括:

  • tx_count_limit/tx_gas_limit:单个区块中交易数量限制/单笔交易中可消耗的 gas 限制

> ./console getSystemConfigByKey tx_count_limit
Result:
"1000"

> ./console getSystemConfigByKey tx_gas_limit
Result:
"300000000"

getTotalTransactionCount

获取指定群组的上链交易数目:

> ./console getTotalTransactionCount

Latest Statistics on Transaction and Block Height:
{
  "blockNumber": "0x5",
  "failedTxSum": "0x0",
  "txSum": "0x5"
}

getTransactionByHash

根据交易哈希获取交易信息:

./console getTransactionByHash [transactionHash]

参数包括:

  • transactionHash:交易 hash 值。

> ./console getTransactionByHash 0x5518df7c2063efeb6481c35c4c58f378fac5f476c023c2019b9b01d221478434

Transaction:
{
  "blockHash": "0xce28a18b54ee72450c403968f705253a59c87a22801a88cc642ae800bb8b4848",
  "blockNumber": "0x3",
  "from": "0x4ca29e9e8cb79c863c04f83827ab540315f25e67",
  "gas": "0x11e1a300",
  "gasPrice": "0x11e1a300",
  "hash": "0x5518df7c2063efeb6481c35c4c58f378fac5f476c023c2019b9b01d221478434",
  "input": "0x2800efc0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000803432616532616533393530613239333362366635373664633934366239306232343262376639613261386434356161653533633161313636346364353832626437353966613639653462353266376134353364636537303238373862396566313166643334666365316264313563396264636162636262656534336531333032",
  "nonce": "0x359fbc4677e4f4ca87a96a31372b1194f03ba200db94a18ad0b30f2e858ac32",
  "to": "0x0000000000000000000000000000000000001003",
  "transactionIndex": "0x0",
  "value": "0x0"
}

getTransactionReceipt

根据交易哈希获取交易回执:

./console getTransactionReceipt [transactionHash]

参数包括:

  • transactionHash:交易 hash 值。

> ./console getTransactionReceipt 0x5518df7c2063efeb6481c35c4c58f378fac5f476c023c2019b9b01d221478434

Transaction Receipt:
{
        "transactionHash": "0x5518df7c2063efeb6481c35c4c58f378fac5f476c023c2019b9b01d221478434",
        "transactionIndex": "0x0",
        "blockHash": "0xce28a18b54ee72450c403968f705253a59c87a22801a88cc642ae800bb8b4848",
        "blockNumber": "0x3",
        "gasUsed": "0x765b",
        "contractAddress": "0x0000000000000000000000000000000000000000",
        "root": "0x2d23b1248fe53a1769db06af5c0e99261678643f405f058cfa89193592d13fa7",
        "status": "0x0",
        "from": "0x4ca29e9e8cb79c863c04f83827ab540315f25e67",
        "to": "0x0000000000000000000000000000000000001003",
        "input": "0x2800efc0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000803432616532616533393530613239333362366635373664633934366239306232343262376639613261386434356161653533633161313636346364353832626437353966613639653462353266376134353364636537303238373862396566313166643334666365316264313563396264636162636262656534336531333032",
        "output": "0x0000000000000000000000000000000000000000000000000000000000000001",
        "logs": [],
        "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
}

setSystemConfigByKey

根据关键字设置区块链系统配置:

./console setSystemConfigByKey [tx_count_limit/tx_gas_limit/rpbft_epoch_sealer_num/rpbft_epoch_block_num]

参数包括:

  • tx_count_limit/tx_gas_limit/rpbft_epoch_sealer_num/rpbft_epoch_block_num:单个区块中交易数量限制/单笔交易中可消耗的 gas 限制

> ./console setSystemConfigByKey tx_count_limit 999
success

> ./console setSystemConfigByKey tx_gas_limit 30000000
success

> ./console setSystemConfigByKey rpbft_epoch_sealer_num 20
success

> ./console setSystemConfigByKey rpbft_epoch_block_num 30
success

addObserver

根据节点NodeID设置对应节点为观察者节点

./console addObserver [Node ID]

参数包括:

  • Node ID:节点 ID。

> ./console addObserver 58108297d9b545dc6e9a7ee4fea539c7886ced0c4cfeb33acd16ad23158247901d7d45dfbacc2fe97e38afaf163a4608f2fc2338d3ca37245d44e983adbde202
success

addSealer

根据节点NodeID设置对应节点为共识节点

./console addSealer [Node ID]

参数包括:

  • Node ID:节点 ID。

> ./console addSealer 58108297d9b545dc6e9a7ee4fea539c7886ced0c4cfeb33acd16ad23158247901d7d45dfbacc2fe97e38afaf163a4608f2fc2338d3ca37245d44e983adbde202
success

removeNode

根据节点NodeID设置对应节点为游离节点

./console removeNode [Node ID]

参数包括:

  • Node ID:节点 ID。

> ./console removeNode 58108297d9b545dc6e9a7ee4fea539c7886ced0c4cfeb33acd16ad23158247901d7d45dfbacc2fe97e38afaf163a4608f2fc2338d3ca37245d44e983adbde202
success