3 import com.google.gson.annotations.SerializedName;
4 import io.bytom.common.Utils;
5 import io.bytom.exception.BytomException;
6 import io.bytom.http.Client;
7 import org.apache.log4j.Logger;
12 * listening, whether the node is listening.
14 public boolean listening;
17 * syncing, whether the node is syncing.
19 public boolean syncing;
22 * mining, whether the node is mining.
24 public boolean mining;
27 * peer_count, current count of connected peers.
29 @SerializedName("peer_count")
33 * current_block, current block height in the node's blockchain.
35 @SerializedName("current_block")
36 public long currentBlock;
39 * highest_block, current highest block of the connected peers.
41 @SerializedName("highest_block")
42 public long highestBlock;
45 * network_id, network id.
47 @SerializedName("network_id")
48 public String networkID;
51 * version, bytom version.
53 @SerializedName("version")
54 public String version;
56 private static Logger logger = Logger.getLogger(NetInfo.class);
58 public String toJson() {
59 return Utils.serializer.toJson(this);
67 * @throws BytomException
69 public static NetInfo getNetInfo(Client client) throws BytomException {
70 NetInfo netInfo = client.request("net-info", null, NetInfo.class);
72 logger.info("net-info:");
73 logger.info(netInfo.toJson());