Skip to content

Installation and configuration

martiliones edited this page Feb 23, 2024 · 27 revisions

Pre-requirements

To use the ADAMANT Console, you must have:

Installation

To install the ADAMANT Console globally, you can use npm:

npm install -g adamant-console

You can now access the console by using the adm command. To verify the successful installation, try the following command:

adm client version

If you receive a JSON response with the console's version, the installation of ADAMANT Console was successful.

$ adm client version
{
  "success": true,
  "version": "2.3.0"
}

Configuration

Paths

Here's how the ADAMANT Console config file search and merging process works:

  1. Environment Variables or Default: First, the console looks for the config file using ADM_CONFIG_PATH and ADM_CONFIG_FILENAME. If not set, the default path ~/.adm/config.jsonc is used.

  2. Fallback to Current Directory: If not found, the search moves to the current directory for ./ADM_CONFIG_FILENAME or defaults to ./config.jsonc.

Example of setting environment variable for custom config path:

# `/usr/share/adamant/config.jsonc` will be used
$ ADM_CONFIG_PATH="/usr/share/adamant" adm get address U15531909278942872097

Default config

Absence of a custom config leads to the use of config.default.jsonc. Custom and default configs are merged, so you could only override what's necessary.

To copy the default config, use:

adm init

This copies the default config to ~/.adm/config.jsonc. To specify a different location, use the command with an argument, for example if you want to copy the config to the current directory:

adm init .

Editing config

Network

By default, network parameter set to testnet. If you want to work with mainnet, set the value to mainnet.

JSON RPC

If you prefer to use JSON RPC, you may set port for communication using rpc / port parameter. Default is 5080.

Account

You can choose default ADAMANT account (wallet) to interact with (i.e., to send tokens from) by setting passphrase parameter in config, or specify --passphrase command parameter. See Running commands in Adamant-console.

Testing

To test if you have successfully configured and installed the ADAMANT Console, try to run this command:

adm get address U15531909278942872097

Expected result:

{
  "success": true,
  "nodeTimestamp": 37656647,
  "account": {
    "address": "U15531909278942872097",
    "unconfirmedBalance": "29869323848614",
    "balance": "29869323848614",
    "publicKey": "fb736e72b4df38d973f0f8dfccbece763ab0d9603897dfa8f1167fa50018a8e0",
    "unconfirmedSignature": 0,
    "secondSignature": 0,
    "secondPublicKey": null,
    "multisignatures": [],
    "u_multisignatures": []
  }
}

If you get "error": "Error: connect ECONNREFUSED 127.0.0.1:36667" error, check if you configured Console correctly — it seems you want to interact with the mainnet, but testnet is set in the config file.