Skip to content

Chain33 System Interface

linj edited this page Nov 23, 2022 · 1 revision

1 Chain33 System Interface

[TOC]

1.1 Get the Remote Node List GetPeerInfo

Request message:

{
    "jsonrpc":"2.0",
    "id":int32,
    "method":"Chain33.GetPeerInfo",
    "params":[] 
}

Response message:

{
    "id":int32,
    "result":
    {
        "peers":
        [
            {
                "addr": "string",
                "port": int32,
                "name": "string",
                "mempoolSize": int32,
                "self":bool,
                "header":
                {
                    "version": int64,
                    "parentHash": "string",
                    "txHash": "string",
                    "stateHash": "string",
                    "height": int64,
                    "blockTime": int64,
                    "txCount" : int64,
                    "hash":"string",
                    "difficulty":int64,
                }
            }
        ]
    }
}

Parameter description:

Parameter Type Description
peers array all node information of the current node connection
addr string IP outside the node network
port int32 The node P2P port may be mapped through the port
name string node name
mempoolSize int32 The number of transactions in the memory pool cached in the node
self bool whether it is the current node (the node that executes the query command)
header - latest block header information of node

1.2 Query Node Status GetNetInfo

Request message:

{
    "jsonrpc":"2.0",
    "id":int32,
    "method":"Chain33.GetNetInfo",
    "params":[] 
}

Response message:

{
    "externaladdr": "string",
    "localaddr": "192.168.1.108:13802",
    "service": bool,
    "outbounds":int32,
    "inbounds":int32
}
Parameter Type Description
externaladdr string represent its own external network address information
localaddr string represents the local address information on which the node is listening
service bool when true, it means that other nodes can connect to itself; false means that its node is invisible to other nodes, and other nodes cannot connect to itself
outbounds int32 outbounds, represents the number of outgoing nodes
inbounds int32 inbounds, represent the number of external nodes connect to this node

1.3 Query Time Status GetTimeStatus

Request message:

{
    "jsonrpc":"2.0",
    "id":int32,
    "method":"Chain33.GetTimeStatus",
    "params":[] 
}

Response message:

{
    "ntpTime": "string",
    "localTime": "string",
    "diff": int64
}

Parameter description:

Parameter Type Description
ntpTime string network standard time
localTime string node local time
diff int64 Time difference between local event and standard time, in seconds, integer if local time is fast, negative if not

1.4 Query Synchronization Status IsSync

Request message:

{
    "jsonrpc":"2.0",
    "id":int32,
    "method":"Chain33.IsSync",
    "params":[] 
}

Response message:

{
    "id":int32,
    "result":bool
    "error":null
}

Parameter description:

Parameter Type Description
result bool if return true, then synchronization successful
Clone this wiki locally