-
-
Notifications
You must be signed in to change notification settings - Fork 10
Installation and configuration
- Ubuntu 18+ (didn't test other)
- NodeJS 14+
To install adamant-console globally:
npm install -g adamant-console
If NodeJS installed with nvm, you can run this command as non-sudo user. It will install Console to ~/.nvm/versions/node/$(node -v)/lib/node_modules/adamant-console/
and create symlink at ~/.nvm/versions/node/$(node -v)/bin/@adm
.
If NodeJS installed with a general package manager, you probably have to run this command with sudo permissions. This will install Console to /usr/lib/node_modules/adamant-console/
directory and create symlink /usr/bin/@adm
to /usr/lib/node_modules/adamant-console/bin/adamant.js
.
If NodeJS installed with Homebrew (macOS), it will install Console to /opt/homebrew/lib/node_modules/adamant-console/
and create symlink at /opt/homebrew/bin/@adm
.
For update, check currently installed adamant-console:
npm list -g adamant-console | grep adamant
Or using Console:
adm client version
Check latest available adamant-console in npm:
npm view adamant-console version
If newer version is available, update adamant-console:
npm update -g adamant-console
If you want to build it from source, clone the repository and install dependencies. You can do it as a non-sudo user.
git clone https://github.com/Adamant-im/adamant-console/ #fetching code from github
cd adamant-console
npm install #installing dependencies
npm link #creates a symlink `/usr/bin/@adm` to `./bin/adamant.js`. Sudo permissions needed.
Then you can use Adamant-console as adm
. Alternatively you can run commands without making executable:
node ./bin/adamant.js client version
Or run Console in interactive mode:
node ./bin/adamant.js
Config is in JSON format.
Adamant-console searches for custom config file in these locations (order priority): ~/.adm/config.json
, ./config.json
. If no config is found, config.default.json
taken. Console merges data in custom config with config.default.json
, so you don't need to define already defined values, if you don't want to override them.
Here is an example how to make custom config. Copy config.default.json
to ~/.adm
and edit this file (or edit config.default.json
directly).
If NodeJS installed with nvm:
mkdir ~/.adm && cp ~/.nvm/versions/node/$(node -v)/lib/node_modules/adamant-console/config.default.json ~/.adm/config.json && nano ~/.adm/config.json
If NodeJS installed with a general package manager:
mkdir ~/.adm && cp /usr/lib/node_modules/adamant-console/config.default.json ~/.adm/config.json && nano ~/.adm/config.json
If you've built Console from source:
mkdir ~/.adm && cp ~/adamant-console/config.default.json ~/.adm/config.json && nano ~/.adm/config.json
If NodeJS installed with Homebrew (macOS):
nano /opt/homebrew/lib/node_modules/adamant-console/config.default.json
Config file name (config.json) can be overwritten using ADM_CONFIG_FILENAME
environment variable. Default config file name location (~/.adm) can be overwritten using ADM_CONFIG_PATH
environment variable. Here is bash command example:
ADM_CONFIG_PATH="/home/adamant/console" adm get address U15531909278942872097
By default, network
parameter set to testnet
. If you want to work with mainnet, set the value to mainnet
.
Adamant-console connects to ADAMANT nodes on your choice, it can be any node, locally installed on your machine, or from other side of the Earth. As Console doesn’t transfer passphrases to nodes, it is safe to connect to any node. Node you connect should have API enabled.
So, you do not need ADAMANT node installed, while you still can do that to support decentralization.
If you prefer to use JSON RPC, you may set port for communication using rpc
/ port
parameter. Default is 5080.
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.
Try to run bash command:
adm client version
Expected:
{
"success": true,
"version": "2.0.0"
}
If the command doesn't work, make sure you installed Node.js and adamant-console correctly.
Then run bash 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.