Skip to content

JSON Answer formats

martiliones edited this page May 26, 2024 · 21 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"
}

Account commands

new

Result of account new command.

It returns account field with address/publicKey/privateKey/passphrase parameters. Account is created locally, and passphrase/ privateKey created locally. It is safe.

Important: Do not share passphrase and privateKey with anyone. Also, you are responsible for saving and backup of this data. Is is necessary to have them to access account.

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

Client

version

Result of client version command. It returns version field with current client version.

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

Get commands

address

Result of get address command.

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

block

Result of get block command.

{
    "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

Result of get delegate command.

{
    "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
    }
}

transaction

Result of get transaction command.

{
    "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": {}
    }
}

message

Result of get message command. It has the same structure as get transaction, but additionally returns decoded field inside transaction with the decoded message when possible.

{
  "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"
  }
}

transactions

Result of get transactions command.

{
    "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

height

Result of node height command.

It returns height field with current node height value:

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

version

Result of node version command.

It returns version field with current node version value, and commit field with hash of current build GitHub commit. Commit data can be retrieved from GitHub via link github.com/Adamant-im/adamant/commit/[COMMIT_HASH].

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

Send commands

tokens

Result of send tokens command.

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

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

Delegate commands

new

Result of delegate new command.

It returns Transaction format object. Delegate's data is available in asset field.

{
    "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"
    }
}