Skip to content

Available Commands

martiliones edited this page May 26, 2024 · 68 revisions

For successful operations, ADAMANT Console returns a JSON object with the success field set to true. Additional fields depend on the executed command, for example:

{
  "success": true,
  "version": "1.4.0"
}

If there's an error, the response includes a success field set to false and an error field with a descriptive message of what went wrong:

{
  "success": false,
  "error": "Account is already a delegate"
}

Table of contents:

Mastering Adamant-console commands

These commands refer to CLI way of interaction. You can use an alternative way, JSON RPC.

To understand how commands work in general, see Running commands in Adamant-console.

Account

Interacting with ADAMANT accounts.

new

Description

Command can be executed as account new, it doesn't require any options. It creates new ADAMANT account and provide account data in JSON format.

Account is created locally, and passphrase/ privateKey created locally. It is safe.

Command Format

account new

No options or parameters are available.

Example

adm account new

Answer example:

{
  "success": true,
  "account": {
    "address": "U17503614588421099901",
    "passphrase": "shift credit run sea order flower tribe invest march govern blanket absorb",
    "publicKey": "d4934ceb46d7325c29df3723d3d7191387d417f43ecd3d235e7cda002161e98b",
    "privateKey": "414006a9af3cc4d97c3cb329c0abaabc70a6c234f6c1145b92f924987d2dbd17d4934ceb46d7325c29df3723d3d7191387d417f43ecd3d235e7cda002161e98b"
  }
}

Client

Client (ADAMANT-console) related commands.

version

Description

To get current client version, you can use client version command. Return data is in JSON format.

Command Format

client version

Example

adm client version

Answer example:

{
  "success": true,
  "version": "1.4.0"
}

Delegate

Delegates related commands.

new

Description

To register user account as delegate, you can use delegate new command. It registers new ADAMANT delegate, if user has enough tokens (the registration fee) on account. Return data is in JSON format.

Command Format

delegate new <name>

Name is delegate name you want to register with. It must be unique in ADAMANT blockchain. It should not be similar to ADAMANT address. Delegate name can only contain alphanumeric characters and symbols !@$&_.

Current fee for registering as delegate is 3000 ADM.

Example

adm delegate new "tkf"

Answer example:

{
  "success": true,
  "nodeTimestamp": 37489091,
  "transaction": {
    "type": 2,
    "amount": 0,
    "timestamp": 37489091,
    "asset": {
      "delegate": {
        "username": "tkf",
        "publicKey": "ae1cf99ade40ba4b94c8408ad440754e037b1837da256549d9b878629af23150"
      }
    },
    "senderPublicKey": "ae1cf99ade40ba4b94c8408ad440754e037b1837da256549d9b878629af23150",
    "senderId": "U2509016256839651561",
    "signature": "fe0b4747c698f9c01abd1680bb5087b8247719c20ec48522b16bc88ab54bf1f7871f2dc21cc5d8060fb10cc0ce520f43fa9e92bfc356449dbe9a9c7ca69ca604",
    "id": "6132068325824063462",
    "fee": 300000000000,
    "relays": 1,
    "receivedAt": "2018-11-10T14:38:11.224Z"
  }
}

Vote

for

Description

To vote for delegate in ADAMANT blockchain, you can use vote for command.

Command Format

Vote (or remove vote) for delegates:

vote for -- <ids...>

To vote (or remove vote) for delegate, you must provide their public keys or ADM addresses or delegate names separated by spaces, you can vote for 32 delegates in one command.

For upvote, add leading + to delegate's id. For downvote, add leading - to delegate's id.

Note: It would be more efficient to pass publicKey, otherwise the api will make additional queries.

Current fee for voting is .., it does not depend on parameters (delegates) count, and paid for running one command. Removing votes should be paid as well.

Examples

Vote for delegates:

vote for -- d2885bc8d4aa68f0f4c919077c1edcb9c9020a715f20cb6db7578cd6f68055bb lynx

Remove votes from delegates:

vote for -- -d2885bc8d4aa68f0f4c919077c1edcb9c9020a715f20cb6db7578cd6f68055bb -lynx

Get

Get command provides easy ability to fetch data from the network, they has following subcommands, that target the type of content to receive:

address

Description

This command returns information about ADAMANT network address (account), information returned consists of balance and publicKey. Return data is in JSON format.

Command Format

get address <address>

Address must be registered in network, it means it should have at least one income transaction.

Public key will be null if address has no outcome transactions, such accounts are not initialized. It is impossible to send messages to uninitialized accounts.

Example

adm get address U15531909278942872097

Answer example:

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

blocks

Description

Returns array of blocks in ADAMANT chain from newest to oldest. Each block contains information about forger (generatorId), timestamp, signatures, and other fields. See JSON format description.

Command Format

get blocks <query>

Query must be set of conditions and operators to choose transactions you need. They must follow rules.

Example

adm get blocks limit=3,offset=10

Answer example:

{
  "success": true,
  "nodeTimestamp": 140489254,
  "blocks": [
    {
      "id": "10228865240959251437",
      "version": 0,
      "timestamp": 140489200,
      "height": 26382316,
      "previousBlock": "1738436573277520995",
      "numberOfTransactions": 0,
      "totalAmount": 0,
      "totalFee": 0,
      "reward": 35000000,
      "payloadLength": 0,
      "payloadHash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
      "generatorPublicKey": "cc1ca549413b942029c4742a6e6ed69767c325f8d989f7e4b71ad82a164c2ada",
      "generatorId": "U1467838112172792705",
      "blockSignature": "e3e456632c9fe48702bb8208d028a4b06c5af4dc98bcf58df66530996979196b461bb6db0d137a17482a8e378ebea0fef0458fb76533fdf18bad753236db5705",
      "confirmations": 11,
      "totalForged": "35000000"
    },
    {
      "id": "1738436573277520995",
      "version": 0,
      "timestamp": 140489195,
      "height": 26382315,
      "previousBlock": "14150452377069444732",
      "numberOfTransactions": 0,
      "totalAmount": 0,
      "totalFee": 0,
      "reward": 35000000,
      "payloadLength": 0,
      "payloadHash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
      "generatorPublicKey": "14816769682ce2530824678f52beb276749c63d9f446b9394246ab6e000fc07c",
      "generatorId": "U6293997245789349224",
      "blockSignature": "88f7477d50382ef505bd5fe9f775c4ed2904e0f033edd98d5a23d0181bf37bca4bddc0cfe87fdef9c7b7ac2b17ddd9db4c8151baf4059357647f221f49252b02",
      "confirmations": 12,
      "totalForged": "35000000"
    },
    {
      "id": "14150452377069444732",
      "version": 0,
      "timestamp": 140489190,
      "height": 26382314,
      "previousBlock": "16331197076263690393",
      "numberOfTransactions": 0,
      "totalAmount": 0,
      "totalFee": 0,
      "reward": 35000000,
      "payloadLength": 0,
      "payloadHash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
      "generatorPublicKey": "6db519ac5ff7c62f91616bb742228450dd2d570be350b106c9b420f11df0894b",
      "generatorId": "U6088790812027214960",
      "blockSignature": "ad496ad00559e0b5bf6205cf0566e81bd0b17521f95a78d7ce416eebeaa3e98c3d968b46b5a03b70f328f0b0977472c0c51a6cf7881b901347321b22a13b4e0c",
      "confirmations": 13,
      "totalForged": "35000000"
    }
  ]
}

block

Description

Returns block information, which contains information about forger (generatorId), timestamp, signatures, and other fields. See JSON format description.

Command Format

get block <block Id>

Block id is block number in ADAMANT network.

Example

adm get block 7917597195203393333

Answer example:

{
  "success": true,
  "nodeTimestamp": 37657689,
  "block": {
    "id": "7917597195203393333",
    "version": 0,
    "timestamp": 37656350,
    "height": 6091604,
    "previousBlock": "10984697155127900754",
    "numberOfTransactions": 1,
    "totalAmount": 10000000,
    "totalFee": 50000000,
    "reward": 50000000,
    "payloadLength": 117,
    "payloadHash": "9d83644fb374c7b1b4b9ae9f8a6ad59ed9b86241052698719a7aea6438783acc",
    "generatorPublicKey": "d01cd1fe3e013fe669120ec0b00cac07e4c4b2fdb6153dbd56b38732b2e427fc",
    "generatorId": "U5142625607650218363",
    "blockSignature": "c227a41097d5d224e762299e26b88ca387d98dff73ebc3d0ef416958ef7edadccb472319d430fc1184d3a1b8c11a879763d07274ae3bedae9f8fd8beab6de008",
    "confirmations": 268,
    "totalForged": "100000000"
  }
}

delegate

Description

Returns information about delegate and it's productivity. Return data is in JSON format.

Command Format

get delegate <delegate name>

Where delegate name is registered delegate name in ADAMANT network.

Example

adm get delegate bash

Answer example:

{
  "success": true,
  "nodeTimestamp": 37657752,
  "delegate": {
    "username": "bash",
    "address": "U5142625607650218363",
    "publicKey": "d01cd1fe3e013fe669120ec0b00cac07e4c4b2fdb6153dbd56b38732b2e427fc",
    "vote": "20552540707898",
    "votesWeight": "2565213987104",
    "producedblocks": 10154,
    "missedblocks": 15,
    "rate": 68,
    "rank": 68,
    "approval": 0.03,
    "productivity": 99.85
  }
}

message

Description

Returns information about message and the message itself decoded. Return data is in JSON format. Works the same way as get transaction, bbut additionally returns decoded field inside transaction with the decoded message when possible.

asset can be Basic Encrypted Message, or may include Rich Text Asset.

Command Format

get message <transaction id>

Where transaction id is unique number, identifying transaction in ADAMANT network. Transaction should be of type 8.

To decode a message, provide passphrase. You can do it in two ways. If wrong passphrase used to decrypt a message, an error will occur.

Example

adm get message 16723092651258984040

Answer example:

{
  "success": true,
  "nodeTimestamp": 212366917,
  "transaction": {
    "id": "16723092651258984040",
    "height": 40589982,
    "blockId": "13954358562032326497",
    "type": 8,
    "block_timestamp": 212365615,
    "timestamp": 212365610,
    "senderPublicKey": "1ed651ec1c686c23249dadb2cb656edd5f8e7d35076815d8a81c395c3eed1a85",
    "senderId": "U3716604363012166999",
    "recipientId": "U15531909278942872097",
    "recipientPublicKey": "fb736e72b4df38d973f0f8dfccbece763ab0d9603897dfa8f1167fa50018a8e0",
    "amount": 1000000,
    "fee": 50000000,
    "signature": "7c42ef52a6d81dc210e85577a4b68367faaf0a1d7f24f772fbdf07ece5750d378359b8a64fd78726aa56fb2451ad8883e7a4fa31a72dda25e3bf2140b4d0f60f",
    "signatures": [],
    "confirmations": 260,
    "asset": {
      "chat": {
        "message": "785b2e406f94aa5e6331df085eb3a3f47f188a85957ab96484",
        "own_message": "65068b4005663674cbad071489bfb841f69e5bb75f51bd5c",
        "type": 1
      }
    },
    "decoded": "Hello-ADM"
  }
}

transaction

Description

Provides information about specific transaction. Return data is in JSON format.

Command Format


get transaction <transaction id>

```

Where `transaction id` is unique number, identifying transaction in ADAMANT network.

#### Example

```

adm get transaction 12810335978558620573

Answer example:

{
  "success": true,
  "nodeTimestamp": 37658456,
  "transaction": {
    "id": "12810335978558620573",
    "height": 6091604,
    "blockId": "7917597195203393333",
    "type": 0,
    "timestamp": 37656340,
    "senderPublicKey": "cdab95b082b9774bd975677c868261618c7ce7bea97d02e0f56d483e30c077b6",
    "senderId": "U15423595369615486571",
    "recipientId": "U18322695495053155871",
    "recipientPublicKey": "51a0ade2c0184d0049130c06911bbf30dc79de715ba29b7496ab443cf49ea5d7",
    "amount": 10000000,
    "fee": 50000000,
    "signature": "1f615528f133cfaeb865b50954b5dcaaaf66d6a2746c0945d506dedb4e9b7de01317c205f832002efe5b50a7e6d5503c5b83b0eb5279caa90aea4c0cd499a00f",
    "signatures": [],
    "confirmations": 422,
    "asset": {}
  }
}

transactions

Description

Gives you ability to perform complex queries to transactions store. Returns transaction array in JSON format.

Command Format

get transactions <query>

Query must be set of conditions and operators to choose transactions you need. They must follow rules.

Example

get transactions "inId=U3496974446819433410,and:type=0"

Answer example:

{
  "success": true,
  "nodeTimestamp": 37658691,
  "transactions": [
    {
      "id": "12211195993237103215",
      "height": 119100,
      "blockId": "9881997101713554805",
      "type": 0,
      "timestamp": 7418761,
      "senderPublicKey": "cdab95b082b9774bd975677c868261618c7ce7bea97d02e0f56d483e30c077b6",
      "senderId": "U15423595369615486571",
      "recipientId": "U3496974446819433410",
      "recipientPublicKey": "7927b50d730eceba0b3d9cd2e19497bd738ac4db7f93e1a154362750cb47bf86",
      "amount": 49000000,
      "fee": 50000000,
      "signature": "9744ba01933d068d5a6f6ff37694ee9a67a0d9ef8e047fa856c02e49ab5a4c69405138dfde0a86eb2f01d82f79c36aba2f89663af0cdccdc721494abf397dc02",
      "signatures": [],
      "confirmations": 5972972,
      "asset": {}
    }
  ],
  "count": "1"
}

Node

Commands to get Height and Version info from connected to Adamant-console node.

height

Description

Returns current node height. Data returned in JSON format.

Command Format

node height

Example

node height

Answer example:

{
  "success": true,
  "nodeTimestamp": 39727487,
  "height": 6502691
}

version

Description

Returns current node version. Data returned in JSON format.

Command Format

node version

Example

node version

Answer example:

{
  "success": true,
  "nodeTimestamp": 39727482,
  "build": "",
  "commit": "3b02193d470640ba841ea941f93a042095f6fc60",
  "version": "0.4.0"
}

RPC

JSON RPC is an alternative way to interact with ADAMANT blockchain. To use JSON-RPC, you need to start RPC daemon on Adamant-console.

server

Description

To run JSON RPC server, you can use rpc server command. It starts JSON-RPC server on port defined in configuration file.

When you start RPC server, machine will turn into listening mode and bash will be unavailable. To run JSON RPC commands from the same machine, you should use run new instance/ terminal window.

To stop RPC server, press Ctrl + C.

Command Format

rpc server

Example

adm rpc server

Answer example:

JSON-RPC server listening on port 5080

Send

message

Description

To send message from account, you can use send message command.

Command Format

send message <address> <text> [amount]

To set sender account, you can do it in two ways.

address must be an initialized address in ADAMANT network. It is a recipient of message. If address is not initialized, recipient's public key can't be fetched and node will return {"success":false, "error":"Unknown Address"}.

text text message to send. Text will be encrypted as specified in AIP-4: Basic Encrypted Messages. Node accepts maximum encrypted text length of 20480 hex symbols, so approximate maximum unencrypted text length is about 13000 UTF-8 symbols. Transaction fee depends on text length, and approximately 0.001 ADM per 255 unencrypted symbols.

amount is optional parameter, which allows to sending tokens with a text comment. amount can be written in two ways. If you add ADM to amount, it will transfer amount of ADM tokens (simple to understand). If you omit it, integer amount of 1/10^8 tokens will be transferred (1 ADM = 100000000).

Example

adm send message U15531909278942872097 " πŸ…ΌπŸ…°πŸ…ΊπŸ…΄ πŸ…° πŸ†‚πŸ…ΌπŸ…ΈπŸ…»πŸ…΄, πŸ†ˆπŸ…ΎπŸ†„'πŸ†πŸ…΄ πŸ…ΎπŸ…½ πŸ…²πŸ…°πŸ…½πŸ…³πŸ…ΈπŸ…³ πŸ…²πŸ…°πŸ…ΌπŸ…΄πŸ†πŸ…°! " --passphrase "shift credit run sea order flower tribe invest march govern blanket absorb"

Answer example:

{
  "success": true,
  "nodeTimestamp": 37486967,
  "transactionId": "18412470054836757895"
}

Then, with transactionId you can get transaction's details.

adm send message U15531909278942872097 "First line
Second line" --passphrase "shift credit run sea order flower tribe invest march govern blanket absorb"

The command above sends a message:

First line
Second line

Examples of sending ADM tokens with comment:

adm send message U16189664252187503076 "Any comment here" 1.2ADM
adm send message U16189664252187503076 "Any comment here" 120000000

rich or signal

Description

Additionally to send message, Console offers to send rich and signal messages.

To send rich message, use send rich command.

To send signal message, use send signal command.

Command Format

send rich <address> <json>
send signal <address> <json>

It works like send message, but instead of text you should pass json string, describing rich message. JSON will be encrypted before broadcasting transaction.

Example

adm send rich U16189664252187503076 "{ 'type': 'eth_transaction', 'text_fallback': 'Ether transactions are not supported by application yet', 'amount': '0.002', 'comments': 'I like to send it, send it', 'hash': '0xfa46d2b3c99878f1f9863fcbdb0bc27d220d7065c6528543cbb83ced84487deb'}"

Answer example:

{
  "success": true,
  "nodeTimestamp": 70840622,
  "transactionId": "11985354806437345831"
}

tokens

Description

To send tokens from account, you can use send tokens command.

Note: to send tokens with comment, use send message instead.

Command Format

send tokens <address> <amount>

To set sender account, you can do it in two ways.

address must be an address in ADAMANT network. It is a recipient of tokens.

amount can be written in two ways. If you add ADM to amount, it will transfer amount of ADM tokens (simple to understand). If you omit it, integer amount of 1/10^8 tokens will be transferred (1 ADM = 100000000).

Example

adm send tokens U15531909278942872097 1ADM --passphrase "shift credit run sea order flower tribe invest march govern blanket absorb"

Answer example:

{
  "success": true,
  "nodeTimestamp": 37486967,
  "transactionId": "18412470054836757895"
}

Then, with transactionId you can get transaction's details.