Control#

class defichain.node.Control(node)#
getmemoryinfo(mode: str = 'stats') {}#

Returns an object containing information about memory usage.

Parameters:

mode (str) –

(optional) determines what kind of information is returned.

  1. ”stats” returns general statistics about memory usage in the daemon.

  2. ”mallocinfo” returns an XML string describing low-level heap state (only available if compiled with glibc 2.10+).

Returns:

{…} (json) if mode == “stats” | malloc if mode == “mallocinfo”

Result (mode “stats”):

{
    "locked": {               (json object) Information about locked memory manager
    "used": xxxxx,          (numeric) Number of bytes used
    "free": xxxxx,          (numeric) Number of bytes available in current arenas
    "total": xxxxxxx,       (numeric) Total number of bytes managed
    "locked": xxxxxx,       (numeric) Amount of bytes that succeeded locking. If this number is smaller than total, locking pages failed at some point and key data could be swapped to disk.
    "chunks_used": xxxxx,   (numeric) Number allocated chunks
    "chunks_free": xxxxx,   (numeric) Number unused chunks
    }
}

Result (mode “mallocinfo”):

”<malloc version=”1”>…”

Example:
>>> node.control.getmemoryinfo()
getrpcinfo() {}#

Returns details of the RPC server.

Returns:

{…} (json) – returns rpc info

{
    "active_commands" (array) All active commands
    [
        {               (object) Information about an active command
        "method"       (string)  The name of the RPC command
        "duration"     (numeric)  The running time in microseconds
        },...
    ],
    "logpath": "xxx" (string) The complete file path to the debug log
}

Example:
>>> node.control.getrpcinfo()
help(command: str | None = None) str#

List all commands, or get help for a specified command.

Parameters:

command (str) – (optinal) The command to get help on

Returns:

“text” (string) The help text

Example:
>>> node.control.help()
>>> node.control.help("getblockcount")
logging(include: [] = [], exclude: [] = []) {}#

Gets and sets the logging configuration. When called without an argument, returns the list of categories with status that are currently being debug logged or not. When called with arguments, adds or removes categories from debug logging and return the lists above. The arguments are evaluated in order “include”, “exclude”. If an item is both included and excluded, it will thus end up being excluded. The valid logging categories are: accountchange, addrman, anchoring, bench, cmpctblock, coindb, db, estimatefee, futureswap, http, leveldb, libevent, loan, mempool, mempoolrej, net, oracle, proxy, prune, rand, reindex, rpc, rpccache, selectcoins, spv, staking, tokensplit, tor, zmq In addition, the following are available as category names with special meanings:

  • “all”, “1” : represent all logging categories.

  • “none”, “0” : even if other logging categories are specified, ignore all of them.

Parameters:
  • include ([]) –

    (optinal) A json array of categories to add debug logging

    [
        "include_category",    (string) the valid logging category
        ...
    ]
    

  • exclude ([]) –

    (optinal) A json array of categories to remove debug logging

    [
        "exclude_category",    (string) the valid logging category
        ...
    ]
    

Returns:

{…} (json) – object where keys are the logging categories, and values indicates its status

{
    "category": true|false,  (bool) if being debug logged or not. false:inactive, true:active
    ...
}

Example:
>>> node.control.logging(["all"], ["http"])
stop() None#

Stop Defi server.

Returns:

None

Example:
>>> node.control.stop()
uptime() int#

Returns the total uptime of the server.

Returns:

ttt (numeric) – The number of seconds that the server has been running

Example:
>>> node.control.uptime()