Skip to content

API Specification

yoxira edited this page Nov 10, 2024 · 123 revisions

Try out ADAMANT OpenAPI schema.

Endpoints intended to interact with ADAMANT accounts.

See also:


List of endpoints giving information of blocks in ADAMANT blockchain.


List of endpoints intended to work with chats and chatrooms in ADAMANT blockchain.

See also:


Endpoints useful in working with delegate system of ADAMANT blockchain.


List of endpoints useful in work with ADAMANT chain in general.


Endpoints intended to store data in ADAMANT Key-Value Storage (KVS).

See also:


Contains endpoints useful to interact with transactions of ADAMANT blockchain.

See also:


Account

Endpoints intended to interact with ADAMANT accounts.

Get Account Information from Address

Description

One of the ways to get actual account's information in ADAMANT blockchain. Send GET request to /api/accounts endpoint with ADAMANT's address as parameter.

Response includes:

  • address — ADAMANT address starting with U, string
  • balance — actual confirmed balance of ADAMANT account. Integer amount of 1/10^8 ADM tokens (1 ADM = 100000000)
  • unconfirmedBalance — balance of ADAMANT account, which includes unconfirmed transactions, integer
  • publicKey — 256 bit public key of ADAMANT address in hex format, string

Endpoint Format

GET /api/accounts?address={ADAMANT address}

Example

GET https://endless.adamant.im/api/accounts?address=U777355171330060015

Answer example

{
    "success": true,
    "nodeTimestamp": 58030181,
    "account": {
        "address": "U777355171330060015",
        "unconfirmedBalance": "4509718944753",
        "balance": "4509718944753",
        "publicKey": "a9407418dafb3c8aeee28f3263fd55bae0f528a5697a9df0e77e6568b19dfe34",
        "unconfirmedSignature": 0,
        "secondSignature": 0,
        "secondPublicKey": null,
        "multisignatures": [],
        "u_multisignatures": []
    }
}

Get Account Information by Public Key

Description

One of the ways to get actual account's information in ADAMANT blockchain. Send GET request to /api/accounts endpoint with publicKey of ADAMANT account as parameter.

Response is in the same format as Get Account Information from Address.

Endpoint Format

GET /api/accounts?publicKey={publicKey}

Example

GET https://endless.adamant.im/api/accounts?publicKey=a9407418dafb3c8aeee28f3263fd55bae0f528a5697a9df0e77e6568b19dfe34

Answer example

{
    "success": true,
    "nodeTimestamp": 58665858,
    "account": {
        "address": "U777355171330060015",
        "unconfirmedBalance": "4509718944753",
        "balance": "4509718944753",
        "publicKey": "a9407418dafb3c8aeee28f3263fd55bae0f528a5697a9df0e77e6568b19dfe34",
        "unconfirmedSignature": 0,
        "secondSignature": 0,
        "secondPublicKey": null,
        "multisignatures": [],
        "u_multisignatures": []
    }
}

Get Account Balance

Description

Request endpoint /api/accounts/getBalance with known ADAMANT's address to get balance and unconfirmedBalance of account.

Response includes:

  • balance — actual confirmed balance of ADAMANT account. Integer amount of 1/10^8 ADM tokens (1 ADM = 100000000)
  • unconfirmedBalance — balance of ADAMANT account, which includes unconfirmed transactions, integer

Endpoint Format

GET /api/accounts/getBalance?address={ADAMANT address}

Example

GET https://endless.adamant.im/api/accounts/getBalance?address=U777355171330060015

Answer example

{
    "success": true,
    "nodeTimestamp": 58043462,
    "balance": "4453802755711",
    "unconfirmedBalance": "4453802755711"
}

Get Account Public Key

Description

If you need publicKey of ADAMANT account, get it from endpoint /api/accounts/getPublicKey with known ADAMANT's address as parameter.

Response includes:

  • publicKey — 256 bit public key of ADAMANT address in hex format, string

Endpoint Format

GET /api/accounts/getPublicKey?address={ADAMANT address}

Example

GET https://endless.adamant.im/api/accounts/getPublicKey?address=U777355171330060015

Answer example

{
    "success": true,
    "nodeTimestamp": 58043820,
    "publicKey": "a9407418dafb3c8aeee28f3263fd55bae0f528a5697a9df0e77e6568b19dfe34"
}

Create New Account

Description

Note: To create an ADAMANT account, generate passPhrase and key pair locally in your application.

After that, you can send (it's optional) POST request to /api/accounts/new endpoint with payload of JSON object which includes:

  • publicKey — 256 bit public key of ADAMANT address in hex format, string

Response contains ADAMANT account info.

NOTE: Created account only known to the node where this account was presented. It means other apps cannot request this account information yet from the blockchain. To become available, account must have any transaction. Read more: Chats and uninitialized accounts in ADAMANT.

Endpoint Format

POST /api/accounts/new

Example

// POST https://clown.adamant.im/api/accounts/new

{"publicKey":"bee368cc0ce2974adcbcc97e649ac18a031492a579034abed5f77d667001d450"}

Curl command:

curl 'https://clown.adamant.im/api/accounts/new' -X POST \
  -d 'publicKey=bee368cc0ce2974adcbcc97e649ac18a031492a579034abed5f77d667001d450'

Answer example

{
    "success": true,
    "nodeTimestamp": 63205623,
    "account": {
        "address": "U4697606961271319613",
        "unconfirmedBalance": "0",
        "balance": "0",
        "publicKey": "bee368cc0ce2974adcbcc97e649ac18a031492a579034abed5f77d667001d450",
        "unconfirmedSignature": 0,
        "secondSignature": 0,
        "secondPublicKey": null,
        "multisignatures": null,
        "u_multisignatures": null
    }
}

Blocks

List of endpoints giving information of blocks in ADAMANT blockchain.

Get Block by Id

Description

Get full information about special block of ADAMANT chain using endpoint /api/blocks/. Pass block's id as a parameter.

Block info includes:

  • id — block's id: reversed first 8 bytes of SHA256 hash of signed block header
  • version — versioning for future upgrades of the ADAMANT protocol
  • timestamp — block's 32 bit integer epoch timestamp (in seconds starting from Sep 02 2017 17:00:00 GMT+0000)
  • height — block's height position in ADAMANT blockchain. The height of the networks represents the number of blocks, that have been forged on the network since Genesis Block.
  • previousBlockid of previous block in ADAMANT blockchain relative to current
  • numberOfTransactions — number of transactions of all types, included in block
  • totalAmount — integer amount of 1/10^8 ADM tokens (1 ADM = 100000000), transferred within all of transactions in block
  • totalFee — integer amount of 1/10^8 ADM tokens (1 ADM = 100000000), payed (by account holders of all of transactions in block) to delegates to forge this block
  • reward — integer amount of 1/10^8 ADM tokens (1 ADM = 100000000), created by delegates to forge this block
  • totalForged — sum of totalFee and reward
  • payloadLength — bytesize of the payload hash
  • payloadHash — hash of the payload of the block. The payload of a block is comprised of the transactions the block contains. For each type of transaction exists a different maximum size for the payload.
  • generatorPublicKey — delegate's public key of ADAMANT address who generated the block
  • generatorId — delegate's ADAMANT address who generated the block
  • blockSignature — derived from a SHA-256 hash of the block header, that is signed by the private key of the delegate who forged the block
  • confirmations — count of network confirmations — how much blocks generated after this block on current node's height

Endpoint Format

GET /api/blocks/get?id={block's id}

Example

GET https://endless.adamant.im/api/blocks/get?id=11114690216332606721

Answer example

{
    "success": true,
    "nodeTimestamp": 61747603,
    "block": {
        "id": "11114690216332606721",
        "version": 0,
        "timestamp": 61741820,
        "height": 10873829,
        "previousBlock": "11483763337863654141",
        "numberOfTransactions": 1,
        "totalAmount": 10000000,
        "totalFee": 50000000,
        "reward": 45000000,
        "payloadLength": 117,
        "payloadHash": "f7c0fa338a3a848119cad999d8035ab3fcb3d274a4555e141ebeb86205e41345",
        "generatorPublicKey": "134a5de88c7da1ec71e75b5250d24168c6c6e3965ff16bd71497bd015d40ea6a",
        "generatorId": "U3238410389688281135",
        "blockSignature": "18607b15417a6b0a56b4c74cacd713ad7a10df16ec3ab45a697fa72b6f811f9213d895b7e0fbca71cf74323d60148d0991668e5368386408f4d841496ed2280d",
        "confirmations": 1093,
        "totalForged": "95000000"
    }
}

Get Blocks

Description

Get list of blocks in ADAMANT chain using endpoint /api/blocks/. Returns array of blocks from newest to oldest.

Available parameters:

  • limit — how much blocks to get, integer. Default is 100.
  • offset — height offset value for results, integer. Default is 0.
  • generatorPublicKey — delegate's public key of ADAMANT address who generated the block
  • height — get block of specific node's height

Endpoint Format

GET /api/blocks

Example

GET https://endless.adamant.im/api/blocks?limit=3

Answer example

{
    "success": true,
    "nodeTimestamp": 58045353,
    "blocks": [
      {
        "id": "15416108601994762552",
        "version": 0,
        "timestamp": 58045350,
        "height": 10144920,
        "previousBlock": "16611488400968379374",
        "numberOfTransactions": 0,
        "totalAmount": 0,
        "totalFee": 0,
        "reward": 45000000,
        "payloadLength": 0,
        "payloadHash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
        "generatorPublicKey": "7f4697859d3ff3a0196d1092b525a6565f427361406182d6a1f7500f16371a60",
        "generatorId": "U11788972648641670458",
        "blockSignature": "586b57db36f05990d83b568da59a3abb8f2a3cf3401e4db66b8145fab4bdf4067b05a0d51197161640bd6c2091609eec5b0ec8f2ad6dfb450f5e433601089001",
        "confirmations": 1,
        "totalForged": "45000000"
      }, {
        "id": "16611488400968379374",
        "version": 0,
        "timestamp": 58045345,
        "height": 10144919,
        "previousBlock": "17869865393675106520",
        "numberOfTransactions": 0,
        "totalAmount": 0,
        "totalFee": 0,
        "reward": 45000000,
        "payloadLength": 0,
        "payloadHash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
        "generatorPublicKey": "6d8004c56928fa5f42ff739dc2b9bb3562b62c5f9a16f5abcfedbdd83481bb32",
        "generatorId": "U15874113746950200763",
        "blockSignature": "56439af79e087c07b558a919f1276aa8d637c55acc3b36267deca7e824bbe96161aec4c8edd8d9fa1a447cb08beb56fc13e8ae7cb5171b32161c6fa2a716680b",
        "confirmations": 2,
        "totalForged": "45000000"
      },
      // ...
    ]
}

Chats and Chatrooms

List of endpoints intended to work with chats and chatrooms in ADAMANT blockchain.

See also:

Get list of Chats

Description

To fetch a list of account's chats use /api/chatrooms endpoint and specify ADAMANT address. For filtering and options see Transactions Query Language. Make attention to withoutDirectTransfers param.

As a result you'll get a list of transactions of type = 8 (messages) and type = 0 (direct token transfers) with last message, stored in asset.chat fields. Structure of chat described in Chats and Messages Types section. Endpoint /api/chatrooms returns messages of type 1 (basic message) and type 2 (rich message) and doesn't return type 3 (signal messages).

As a success result in response you'll get array of account's chats:

  • participants — sender and recipient of message, represented by ADAMANT address and publicKey
  • lasttransaction — last chat transaction with asset.chat

Along with chats array, endpoint returns count of chats integer value.

Endpoint Format

GET /api/chatrooms/{ADAMANT_address}

Example

GET https://endless.adamant.im/api/chatrooms/U839357947177758191

Answer example

{
    "success": true,
    "nodeTimestamp": 63647775,
    "chats": [
        {
            "lastTransaction": {
                "id": "438452752317142988",
                "height": 10224582,
                "blockId": "5808058151912629759",
                "type": 8,
                "block_timestamp": 58449060,
                "timestamp": 58449055,
                "senderPublicKey": "12d6b3f80221a2b0b6d2ef07ae33fce28204c1906ec1bba1d15be693d3353ec4",
                "senderId": "U839357947177758191",
                "recipientId": "U18018989827016540480",
                "recipientPublicKey": "ec48de9b438ae9f12e271ba28d56eb0b3f3bba7b120df7685eddda97c9f79160",
                "amount": 0,
                "fee": 100000,
                "signatures": [],
                "confirmations": null,
                "asset": {
                    "chat": {
                        "message": "3e5314dfc9a1095eb874d76cd878ea5a8420ab2a",
                        "own_message": "e26b9454b0927c904863e44bca30aa4d05bf3ee3f9084976",
                        "type": 1
                    }
                }
            },
            "participants": [
                {
                    "address": "U839357947177758191",
                    "publicKey": "12d6b3f80221a2b0b6d2ef07ae33fce28204c1906ec1bba1d15be693d3353ec4"
                },
                {
                    "address": "U18018989827016540480",
                    "publicKey": "ec48de9b438ae9f12e271ba28d56eb0b3f3bba7b120df7685eddda97c9f79160"
                }
            ]
        },
        {
            "lastTransaction": {
                "id": "6066206090642273254",
                "height": 10224570,
                "blockId": "8748908063639223318",
                "type": 0,
                "block_timestamp": 58449000,
                "timestamp": 58448986,
                "senderPublicKey": "cdab95b082b9774bd975677c868261618c7ce7bea97d02e0f56d483e30c077b6",
                "senderId": "U15423595369615486571",
                "recipientId": "U839357947177758191",
                "recipientPublicKey": "12d6b3f80221a2b0b6d2ef07ae33fce28204c1906ec1bba1d15be693d3353ec4",
                "amount": 10000000,
                "fee": 50000000,
                "signatures": [],
                "confirmations": null,
                "asset": {}
            },
            "participants": [
                {
                    "address": "U15423595369615486571",
                    "publicKey": "cdab95b082b9774bd975677c868261618c7ce7bea97d02e0f56d483e30c077b6"
                },
                {
                    "address": "U839357947177758191",
                    "publicKey": "12d6b3f80221a2b0b6d2ef07ae33fce28204c1906ec1bba1d15be693d3353ec4"
                }
            ]
        }
    ],
    "count": "2"
}

Get Chat Messages

Description

To fetch messages between two accounts use /api/chatrooms endpoint and specify two ADAMANT addresses. For filtering and options see Transactions Query Language.

As a result you'll get a list of transactions of type = 8 (messages) and type = 0 (direct token transfers) between two accounts with asset.chat fields, and their address and publicKey values. Structure of chat described in Chats and Messages Types section. Endpoint /api/chatrooms returns messages of type 1 (basic message) and type 2 (rich message) and doesn't return type 3 (signal messages).

As a success result in response you'll get:

  • participants — sender and recipient of messages, represented by ADAMANT address and publicKey
  • messages — array of chat transactions with asset.chat

Endpoint also returns count of messages integer value.

Endpoint Format

GET /api/chatrooms/{ADAMANT_address}/{ADAMANT_address}

Example

GET https://endless.adamant.im/api/chatrooms/U8916295525136600565/U2707535059340134112?limit=2

Answer example

{
    "success": true,
    "nodeTimestamp": 63653142,
    "messages": [
        {
            "id": "8155501380173522589",
            "height": 10288884,
            "blockId": "4595637117757620800",
            "type": 0,
            "block_timestamp": 58773240,
            "timestamp": 58773230,
            "senderPublicKey": "2ac5eef60303003c90f662d89e60570d8661c8ba569e667296f5c7c97a0413ee",
            "requesterPublicKey": null,
            "senderId": "U8916295525136600565",
            "recipientId": "U2707535059340134112",
            "recipientPublicKey": "5a3c1da429ae925422892e69dc4f0ab6d7ac00cef229d2d992242dcfeca27b91",
            "amount": 1750000000,
            "fee": 50000000,
            "signature": "abf7966546cd99efaa81a...",
            "signSignature": null,
            "signatures": [],
            "confirmations": null,
            "asset": {}
        },
        {
            "id": "9175562912139726777",
            "height": 10288885,
            "blockId": "10475460465898092643",
            "type": 8,
            "block_timestamp": 58773245,
            "timestamp": 58773228,
            "senderPublicKey": "2ac5eef60303003c90f662d89e60570d8661c8ba569e667296f5c7c97a0413ee",
            "requesterPublicKey": null,
            "senderId": "U8916295525136600565",
            "recipientId": "U2707535059340134112",
            "recipientPublicKey": "5a3c1da429ae925422892e69dc4f0ab6d7ac00cef229d2d992242dcfeca27b91",
            "amount": 0,
            "fee": 100000,
            "signature": "287dc2554025d8074d...",
            "signSignature": null,
            "signatures": [],
            "confirmations": null,
            "asset": {
                "chat": {
                    "message": "9ae819297240f00b...",
                    "own_message": "6802a9e744aa3ba570d7e48fce5fe0f49184d0ce38ea40f7",
                    "type": 1
                }
            }
        }
    ],
    "participants": [
        {
            "address": "U8916295525136600565",
            "publicKey": "2ac5eef60303003c90f662d89e60570d8661c8ba569e667296f5c7c97a0413ee"
        },
        {
            "address": "U2707535059340134112",
            "publicKey": "5a3c1da429ae925422892e69dc4f0ab6d7ac00cef229d2d992242dcfeca27b91"
        }
    ],
    "count": "7"
}

Get Chat Transactions

Description

Use /api/chats/get endpoint to get messages from ADAMANT blockchain. For filtering and options see Transactions Query Language.

As a result you'll get a list of transactions of type = 8 (messages) with asset.chat fields. Structure of chat described in Chats and Message Types section. Endpoint /api/chats/get returns messages of all types (basic messages, rich messages, signal messages).

Endpoint also returns count of transactions integer value.

Endpoint Format

GET /api/chats/get

Example

GET https://endless.adamant.im/api/chats/get?senderId=U14236667426471084862&type=3&limit=2

Answer example

{
    "success": true,
    "nodeTimestamp": 63653208,
    "transactions": [
        {
            "id": "18398086748267364739",
            "height": 9108352,
            "blockId": "8710389658301166851",
            "type": 8,
            "block_timestamp": 52843040,
            "timestamp": 52842993,
            "senderPublicKey": "8cd9631f9f634a361ea3b85cbd0df882633e39e7d26d7bc615bbcf75e41524ef",
            "requesterPublicKey": null,
            "senderId": "U14236667426471084862",
            "recipientId": "U15243615587463307445",
            "recipientPublicKey": null,
            "amount": 0,
            "fee": 100000,
            "signature": "f559262305b34faa48...",
            "signSignature": null,
            "signatures": [],
            "confirmations": null,
            "asset": {
                "chat": {
                    "message": "61321be1e7...",
                    "own_message": "875836287f50328027f6bbddbec9c2c020692da371c70d04",
                    "type": 3
                }
            }
        },
        {
            "id": "15531885854852734176",
            "height": 10473512,
            "blockId": "16237611910269371025",
            "type": 8,
            "block_timestamp": 59706995,
            "timestamp": 59706978,
            "senderPublicKey": "8cd9631f9f634a361ea3b85cbd0df882633e39e7d26d7bc615bbcf75e41524ef",
            "requesterPublicKey": null,
            "senderId": "U14236667426471084862",
            "recipientId": "U15243615587463307445",
            "recipientPublicKey": null,
            "amount": 0,
            "fee": 100000,
            "signature": "ce19bfd3a00b97e6...",
            "signSignature": null,
            "signatures": [],
            "confirmations": null,
            "asset": {
                "chat": {
                    "message": "be0b5367c7c646fc7d3...",
                    "own_message": "5682385d31ec3814d6c45b7196a9407f38d6c235e87dec84",
                    "type": 3
                }
            }
        }
    ],
    "count": "12"
}

Register Chat Message Transaction

Description

Use endpoint /api/chats/process to broadcast transactions of type 8 — Chat/Message. It is used for messaging as well as in-Chat ADM token transfer with comment.

Make POST request to the endpoint, with payload of transaction object, where asset.chat includes encrypted message, nonce own_message and message type. Set positive amount value for in-Chat ADM token transfer with comment.

message contents depends on its type, must be encrypted, and then transaction must be formed and signed.

As a success result you'll get id of transaction registered in ADAMANT blockchain.

Endpoint Format

POST /api/chats/process

Example

// POST https://endless.adamant.im/api/chats/process

{
    "transaction": {
        "type": 8,
        "amount": 0,
        "senderId": "U13246415250845952364",
        "senderPublicKey": "a448d99d5da6907dd022c62723f30971f4c1b5b79441da7f5e67f39d545f755e",
        "asset": {
            "chat": {
                "message": "f96383619244c7e06f39f592b55cc551acc72710",
                "own_message": "d0801b9a647fd1469883f918ec616241c79d6f6f7914ddb0",
                "type": 1
            }
        },
        "recipientId": "U15677078342684640219",
        "timestamp": 63652706,
        "signature": "9d35f06fa5b80df650bc4bdfac25974fecacb53de67d25b485f674102f77205ac1e161b13ddad98f1dd7ae0016cceaa254f401c0ee359e45e982e32b1e4fcf0b"
    }
}

Answer example

{
    "success": true,
    "nodeTimestamp": 63652705,
    "transactionId": "2515012750420367858"
}

Delegates and Voting

Endpoints useful in working with delegate system of ADAMANT blockchain — Fair dPoS.

Get Delegates

Description

Endpoint /api/delegates retrieves list of registered ADAMANT delegates with totalCount value.

Available parameters:

  • limit — how much delegates to retrieve, integer. Default is 101 (active delegates).
  • offset — offset value for results, integer. Default is 0.

Each delegate is presented by:

  • username — unique delegate's nickname, string
  • rank — current position in list of delegates
  • rate — current position in list of delegates
  • approval — share of votes of all votes at system
  • address — delegate's ADAMANT address
  • publicKey — public key of delegate's ADAMANT account
  • vote — vote weight (obsolete, not used)
  • votesWeight — vote weight (Fair Delegate System)
  • producedblocks — count of produced blocks
  • missedblocks — count of missed blocks
  • productivity — productivity/uptime of delegate. Will be 0 if delegate is not active now.

Endpoint Format

GET /api/delegates

Example

GET https://endless.adamant.im/api/delegates?offset=101&limit=2

Answer example

{
    "success": true,
    "nodeTimestamp": 61762271,
    "delegates": [
        {
            "username": "donald_trump",
            "address": "U13367877040303579440",
            "publicKey": "8d844340f42ab68a95c385620b9cda64537297cb78fc899d051058e3b7fdacc1",
            "vote": "37577883802740",
            "votesWeight": "37496691795141",
            "producedblocks": 35722,
            "missedblocks": 73,
            "rate": 102,
            "rank": 102,
            "approval": 0.37,
            "productivity": 0
        },
        {
            "username": "bcboilermaker",
            "address": "U8782236344013228528",
            "publicKey": "f3fddc1ed168dff7d658bc93a13e8954b310367718d7c55d0635ffeb5e7b8636",
            "vote": "110714610315343",
            "votesWeight": "36198972216285",
            "producedblocks": 53828,
            "missedblocks": 741,
            "rate": 103,
            "rank": 103,
            "approval": 0.35,
            "productivity": 0
        }
    ],
    "totalCount": 254
}

Get Delegate

Description

Get delegate using endpoint /api/delegates/get with one of the parameteres:

  • username
  • publicKey
  • address

Delegate is returned.

Endpoint Format

GET /api/delegates/get

Example

GET https://endless.adamant.im/api/delegates/get?username=lynx

Answer example

{
    "success": true,
    "nodeTimestamp": 66346841,
    "delegate": {
        "username": "lynx",
        "address": "U11651572364276578835",
        "publicKey": "ef5e78a3d02e6d82f4ac0c5b8923c1b86185bd17c27c9ac027c20ec62db79a84",
        "vote": "192823791678106",
        "votesWeight": "49777782590711",
        "producedblocks": 40184,
        "missedblocks": 591,
        "rate": 52,
        "rank": 52,
        "approval": 0.48,
        "productivity": 98.55
    }
}

Search for Delegates

Description

Search delegates by username (or part of) using endpoint api/delegates/search with parameter q for nickname.

Result includes list of delegates with additional fields:

  • voters_cnt — count of accounts who vote for delegate
  • register_timestamp — epoch timestamp of when delegate registered

Value totalCount is not returned.

Endpoint Format

GET /api/delegates/search?q={searchCriteria}

Example

GET https://endless.adamant.im/api/delegates/search?q=ly

Answer example

{
    "success": true,
    "nodeTimestamp": 58048977,
    "delegates": [{
        "rank": 90,
        "username": "lynx",
        "address": "U11651572364276578835",
        "publicKey": "ef5e78a3d02e6d82f4ac0c5b8923c1b86185bd17c27c9ac027c20ec62db79a84",
        "vote": "165822120828934",
        "votesWeight": "37010830605858",
        "producedblocks": 24269,
        "missedblocks": 81,
        "approval": 1.63,
        "productivity": 99.67,
        "voters_cnt": 12,
        "register_timestamp": 45523238
    }, {
        "rank": 138,
        "username": "truly",
        "address": "U5341484442225629606",
        "publicKey": "8aad15185bd8a9bc6e690d11f9ca876bc9aa8223b21f198065124438e164e10d",
        "vote": "8712456793412",
        "votesWeight": "99328729204",
        "producedblocks": 61107,
        "missedblocks": 270,
        "approval": 0.09,
        "productivity": 99.56,
        "voters_cnt": 81,
        "register_timestamp": 0
    }]
}

Get Delegates Count

Description

Get total count of delegates in ADAMANT's delegate system with endpoint /api/delegates/count. The success response will contain count of registered delegates.

Endpoint Format

GET /api/delegates/count

Example

GET https://endless.adamant.im/api/delegates/count

Answer example

{
    "success": true,
    "nodeTimestamp": 58049193,
    "count": 254
}

Get Delegate Stats

Description

Forging activity of delegate can be retrieved using endpoint /api/delegates/forging/getForgedByAccount with parameter generatorPublicKey representing delegate's publicKey. In case of success you'll get information:

  • fees — total sum of fees forged by delegate
  • rewards — total sum of rewards made by delegate
  • forged — total sum of forged tokens

All values are of integer amount of 1/10^8 ADM tokens (1 ADM = 100000000).

Endpoint Format

GET /api/delegates/forging/getForgedByAccount?generatorPublicKey={generatorPublicKey}

Example

GET https://endless.adamant.im/api/delegates/forging/getForgedByAccount?generatorPublicKey=a9407418dafb3c8aeee28f3263fd55bae0f528a5697a9df0e77e6568b19dfe34

Answer example

{
    "success": true,
    "nodeTimestamp": 58051994,
    "fees": "586039475511",
    "rewards": "3943485000000",
    "forged": "4529524475511"
}

Get Next Forgers

Description

Endpoint /api/delegates/getNextForgers returns list of next forgers:

  • currentBlock — current blockchain height
  • currentBlockSlot — current block slot number
  • currentSlot — current slot number
  • delegates — array of next forgers' public keys

Available parameters:

  • limit — count to retrieve, integer

Endpoint Format

GET /api/delegates/getNextForgers

Example

GET https://endless.adamant.im/api/delegates/getNextForgers

Answer example

{
    "success": true,
    "nodeTimestamp": 58052115,
    "currentBlock": 10146268,
    "currentBlockSlot": 11610422,
    "currentSlot": 11610423,
    "delegates": ["677c6db63548c99674fed0571da522a6a9569d0c1da9669734a3625645519641", "150d638714f65845b50f1ff58f3da2c2baa3a1dc8bf59a9884c10da5a8e951c6", "134a5de88c7da1ec71e75b5250d24168c6c6e3965ff16bd71497bd015d40ea6a", "15855ee1244a12560af0159ccd3ee1461b13819030724fe80566466f3ea5f467", "464f7e220592c144a317345d31db10c51affb144a921f2f24b2525360203f44f", "54428cfd871bb75a37a9f81614039008bc4d0811b38f721a38c37fb535af407b", "6bd642386a561027e52d5339f78d5985539ab069ada280b96d81ed9591581439", "6db519ac5ff7c62f91616bb742228450dd2d570be350b106c9b420f11df0894b", "c0c580c3fb89409f32181fef58935f286f0c1bbf61bd727084ed915b3a4bc95b", "331d76a735ae7a2a671774fae4bf19a095d366a2a51da25020edd4007f99541c"]
}

Get Voters

Description

Get list of delegate's voters using endpoint /api/delegates/voters with parameter publicKey representing delegate's publicKey. Success response will contain:

  • address — voter's ADAMANT address
  • publicKey — voter's ADAMANT public key
  • username — voter's delegate username. null if address is not a delegate.
  • balance — ADM balance of voter's ADAMANT wallet. Integer amount of 1/10^8 ADM tokens (1 ADM = 100000000).

Endpoint Format

GET /api/delegates/voters?publicKey={publicKey}

Example

GET https://endless.adamant.im/api/delegates/voters?publicKey=a9407418dafb3c8aeee28f3263fd55bae0f528a5697a9df0e77e6568b19dfe34

Answer example

{
    "success": true,
    "nodeTimestamp": 58049363,
    "accounts": [{
        "username": "leg",
        "address": "U12609717384103730908",
        "publicKey": "559418798f67a81b7f893aa8eab1218b9838a6b0bcd2bc8968c6d490ae0d5d77",
        "balance": "506697"
    }, {
        "username": "thunder",
        "address": "U3247657843720097949",
        "publicKey": "fc7151dcc08bda712c075fbfc524e10828bbbaad56ac4001cd3f5a9b93b2ea27",
        "balance": "507872"
    }]
}

Get Vote Data for Account

Description

To get current votes of specific ADAMANT account use /api/accounts/delegates endpoint with ADAMANT address parameter. Returns a list of delegates account votes for.

Endpoint Format

GET /api/accounts/delegates?address={ADAMANT address}

Example

GET https://endless.adamant.im/api/accounts/delegates?address=U777355171330060015

Answer example

{
    "success": true,
    "nodeTimestamp": 58044952,
    "delegates": [{
        "username": "million",
        "address": "U777355171330060015",
        "publicKey": "a9407418dafb3c8aeee28f3263fd55bae0f528a5697a9df0e77e6568b19dfe34",
        "vote": "164286404703970",
        "votesWeight": "37611676759702",
        "producedblocks": 100493,
        "missedblocks": 297,
        "rate": 85,
        "rank": 85,
        "approval": 0.37,
        "productivity": 99.71
    }]
}

Register Delegate Transaction

Description

Use endpoint /api/delegates to broadcast transactions of type 2 — Delegate Registration. Make POST request to the endpoint, with payload of transaction object, where:

  • type is set to 2
  • recepientId = null
  • recipientPublicKey = null
  • asset sets new delegate's info

Transaction must be formed and signed.

As a success result you'll get transaction registered in ADAMANT blockchain.

Endpoint Format

POST /api/delegates

Example

Register new delegate with kpeo username:

// POST https://endless.adamant.im/api/delegates

{
  "type": 2,
  "timestamp": 166805250,
  "amount:" 0,
  "senderPublicKey": "a339974effc141f302bd3589c603bdc9468dd66bcc424b60025b36999eb69ca3",
  "senderId": "U3031563782805250428",
  "asset": {
    "delegate": {
      "username": "kpeo",
      "publicKey": "a339974effc141f302bd3589c603bdc9468dd66bcc424b60025b36999eb69ca3"
    }
  },
  "recipientId": null,
  "signature": "c2e4a3ef7f0d363611a2b22b96feff269f1a0cbb61741a2ce55756bb9324826092fd9bff6348145e3cc384c097f101a493b9136da5236292ecf8b1ed6657dd01"
}

Answer example

{
  "success": true,
  "nodeTimestamp": 166805153,
  "transaction": {
    "type": 2,
    "timestamp": 166805152,
    "amount": 0,
    "senderPublicKey": "a339974effc141f302bd3589c603bdc9468dd66bcc424b60025b36999eb69ca3",
    "senderId": "U3031563782805250428",
    "asset": {
      "delegate": {
        "username": "kpeo",
        "publicKey": "a339974effc141f302bd3589c603bdc9468dd66bcc424b60025b36999eb69ca3"
      }
    },
    "signature": "1833a86e24d57ad6dbd30c47924500a03096fd06076fafe5bca4f23ab4629268f3b1a58a1ce275356bc0b79f64a11b8abe9bec6c3d55202d6393327f9278910b",
    "id": "14674137414602658194",
    "fee": 300000000000,
    "relays": 1,
    "receivedAt": "2022-12-16T07:45:53.717Z"
  }
}

Register Vote for Delegate Transaction

Description

Use endpoint /api/accounts/delegates to broadcast transactions of type 3 — Vote for Delegate. Make POST request to the endpoint, with payload of transaction object, where:

  • type is set to 3
  • senderId = recepientId, ADAMANT address of account who votes
  • asset represents votes array with publicKeys. For upvote, add leading + to delegate's publicKey. For downvote, add leading - to delegate's publicKey.

Transaction must be formed and signed.

As a success result you'll get transaction registered in ADAMANT blockchain.

Endpoint Format

POST /api/accounts/delegates

Example

Vote for b3d0c0b99f64d0960324089eb678e90d8bcbb3dd8c73ee748e026f8b9a5b5468 delegate and downvote for 9ef1f6212ae871716cfa2d04e3dc5339e8fe75f89818be21ee1d75004983e2a8:

// POST https://endless.adamant.im/api/accounts/delegates

{
    "asset": {
        "votes": [
            "+b3d0c0b99f64d0960324089eb678e90d8bcbb3dd8c73ee748e026f8b9a5b5468",
            "-9ef1f6212ae871716cfa2d04e3dc5339e8fe75f89818be21ee1d75004983e2a8"
        ]
    },
    "recipientId": "U14236667426471084862",
    "amount": 0,
    "type": 3,
    "senderId": "U14236667426471084862",
    "senderPublicKey": "8cd9631f9f634a361ea3b85cbd0df882633e39e7d26d7bc615bbcf75e41524ef",
    "timestamp": 63394407,
    "signature": "7f4f5d240fc66da1cbdb3fe291d6fcec006848236355aebe346fcd1e3ba500caeac1ed0af6f3d7f912a889a1bbedc1d7bab17b6ebd36386b81df78189ddf7c07"
}

Answer example

{
    "success": true,
    "nodeTimestamp": 63394408,
    "transaction": {
        "asset": {
            "votes": [
                "+b3d0c0b99f64d0960324089eb678e90d8bcbb3dd8c73ee748e026f8b9a5b5468",
                "-9ef1f6212ae871716cfa2d04e3dc5339e8fe75f89818be21ee1d75004983e2a8"
            ]
        },
        "recipientId": "U14236667426471084862",
        "amount": 0,
        "type": 3,
        "senderId": "U14236667426471084862",
        "senderPublicKey": "8cd9631f9f634a361ea3b85cbd0df882633e39e7d26d7bc615bbcf75e41524ef",
        "timestamp": 63394407,
        "signature": "7f4f5d240fc66da1cbdb3fe291d6fcec006848236355aebe346fcd1e3ba500caeac1ed0af6f3d7f912a889a1bbedc1d7bab17b6ebd36386b81df78189ddf7c07",
        "id": "13616514419605573351",
        "fee": 5000000000,
        "relays": 1,
        "receivedAt": "2019-09-06T10:33:28.054Z"
    }
}

Nodes and Blockchain

List of endpoints useful in work with ADAMANT blockchain in general.

Get Peers List

Description

Get list of connected peer nodes using endpoint /api/peers.

Node's information includes:

  • ip — IPv4 address of node
  • port — port number of ADAMANT node. 36666 for mainnet or 36667 for testnet.
  • state — state of the peer. Available values: Connected (2), Disconnected, Banned
  • os — node's operation system
  • version — ADAMANT node software version
  • broadhash — broadhash on the peer node. Broadhash is established as an aggregated rolling hash of the past five blocks present in the database.
  • height — current node's blockchain height
  • updated — unix timestamp based in ms, when peer updated
  • nonce — unique Identifier for the peer. Random string.

Available parameters:

  • limit — how much nodes to retrieve, integer
  • offset — offset value for results, integer
  • you can use os, ip and other parameters for filtering results

Endpoint Format

GET /api/peers

Example

GET https://endless.adamant.im/api/peers

Answer example

{
    "success": true,
    "nodeTimestamp": 58052600,
    "peers": [
        {
            "ip": "194.32.79.175",
            "port": 36666,
            "state": 2,
            "os": "linux4.15.0-36-generic",
            "version": "0.4.0",
            "broadhash": "3dfdf6c7bbaf7537eac9c70432f7ba1cae835b9b15e4ecd97e147616dde67e62",
            "height": 10146365,
            "clock": null,
            "updated": 1562424199553,
            "nonce": "jxXV6g0sHJhmDubq"
        }, {
            "ip": "144.217.93.8",
            "port": 36666,
            "state": 2,
            "os": "linux4.4.0-141-generic",
            "version": "0.4.0",
            "broadhash": "febfb2ac6fbf0a456fdb6a22d08e37dbe514e547ec7772a1f46c2d2595c89baa",
            "height": 10146364,
            "clock": null,
            "updated": 1562424195742,
            "nonce": "YngSDjA5MeUNk2iZ"
        },
        // ...
    ]
}

Get Loading Status

Description

Endpoint /api/loader/status returns information on node's loading process.

Endpoint Format

GET /api/loader/status

Example

GET https://endless.adamant.im/api/loader/status

Answer example for node on actual blockchain height

{
    "success": true,
    "nodeTimestamp": 58052355,
    "loaded": true,
    "now": 10144343,
    "blocksCount": 0
}

Answer example for node in sync process

{
    "success": true,
    "nodeTimestamp": 66424794,
    "loaded": true,
    "now": 1,
    "blocksCount": 1
}

Get Synchronization Status

Description

Endpoint /api/loader/status/sync returns information on node's sync process with other peers:

  • syncingtrue if node is still in sync process
  • blocks — current blockchain height to achieve if in sync process; 0 if syncing done
  • height — node's blockchain height
  • broadhash — broadhash on the peer node. Broadhash is established as an aggregated rolling hash of the past five blocks present in the database.
  • consensus— consensus percentage with other nodes

Endpoint Format

GET /api/loader/status/sync

Example

GET https://endless.adamant.im/api/loader/status/sync

Answer example

{
    "success": true,
    "nodeTimestamp": 58052432,
    "syncing": false,
    "blocks": 0,
    "height": 10146332,
    "broadhash": "09f2f5614cf7209979dc1df2dd92d16aade904dae6c9b68bccaeb234647b3c18",
    "consensus": 94.32
}

Get Ping Status

Description

Ping /api/loader/status/ping to check if node is alive.

Endpoint Format

GET /api/loader/status/ping

Example

GET https://endless.adamant.im/api/loader/status/ping

Answer example

{
    "success": true
}

Get Node Version

Description

Endpoint /api/peers/version returns node's software information: version, build and commit.

Endpoint Format

GET /api/peers/version

Example

GET https://endless.adamant.im/api/peers/version

Answer example

{
    "success": true,
    "nodeTimestamp": 58052984,
    "build": "",
    "commit": "b07aaf9580dffb5cc95cc65f303f6f1e5fca7d9c",
    "version": "0.5.2"
}

Get Blockchain Broadhash

Description

Endpoint /api/blocks/getBroadhash returns broadhash on the node. Broadhash is established as an aggregated rolling hash of the past five blocks present in the database.

Endpoint Format

GET /api/blocks/getBroadhash

Example

GET https://endless.adamant.im/api/blocks/getBroadhash

Answer example

{
    "success": true,
    "nodeTimestamp": 58645139,
    "broadhash": "e1aedd2818679c174e3f6e31891c34f4069927f33f145e1b81fe5d978733e794"
}

Get Blockchain Epoch

Description

Endpoint /api/blocks/getEpoch returns time when blockchain epoch starts. Value 2017-09-02T17:00:00.000Z is for ADAMANT mainnet.

Endpoint Format

GET /api/blocks/getEpoch

Example

GET https://endless.adamant.im/api/blocks/getEpoch

Answer example

{
    "success": true,
    "nodeTimestamp": 58646306,
    "epoch": "2017-09-02T17:00:00.000Z"
}

Get Blockchain Height

Description

Endpoint /api/blocks/getHeight returns current node's blockchain height.

Endpoint Format

GET /api/blocks/getHeight

Example

GET https://endless.adamant.im/api/blocks/getHeight

Answer example

{
    "success": true,
    "nodeTimestamp": 58047354,
    "height": 10145318
}

Get Blockchain Fee

Description

Endpoint /api/blocks/getFee returns current fee value for type 0 (token transfer) transactions. Integer amount of 1/10^8 ADM tokens (1 ADM = 100000000).

Endpoint Format

GET /api/blocks/getFee

Example

GET https://endless.adamant.im/api/blocks/getFee

Answer example

{
    "success": true,
    "nodeTimestamp": 58046803,
    "fee": 50000000
}

Get Blockchain Fees

Description

Endpoint /api/blocks/getFees returns current fee values for different transaction types:

  • send — token transfer, type 0
  • vote — voting for delegate, type 3
  • delegate — registration of a new delegate, type 2
  • old_chat_message — sending a message (not used for now)
  • chat_message — sending a message, type 8
  • state_store — storing data in KVS, type 9
  • profile_update — not used for now
  • avatar_upload — not used for now

All values are integer amount of 1/10^8 ADM tokens (1 ADM = 100000000).

Endpoint Format

GET /api/blocks/getFees

Example

GET http://endless.adamant.im/api/blocks/getFees

Answer example

{
    "success": true,
    "nodeTimestamp": 58046908,
    "fees": {
        "send": 50000000,
        "vote": 5000000000,
        "delegate": 300000000000,
        "old_chat_message": 500000,
        "chat_message": 100000,
        "state_store": 100000,
        "profile_update": 5000000,
        "avatar_upload": 10000000
    }
}

Get Blockchain Nethash

Description

Endpoint /api/blocks/getNethash describes the network. The nethash describes e.g. the Mainnet or the Testnet, that the node is connecting to.

Endpoint Format

GET /api/blocks/getNethash

Example

GET https://endless.adamant.im/api/blocks/getNethash

Answer example

{
    "success": true,
    "nodeTimestamp": 58047702,
    "nethash": "bd330166898377fb28743ceef5e43a5d9d0a3efd9b3451fb7bc53530bb0a6d64"
}

Get Blockchain Milestone

Description

Endpoint /api/blocks/getMilestone returns milestone — current slot height, which determines reward a delegate will get for forging a block.

Endpoint Format

GET /api/blocks/getMilestone

Example

GET https://endless.adamant.im/api/blocks/getMilestone

Answer example

{
    "success": true,
    "nodeTimestamp": 58047777,
    "milestone": 1
}

Get Blockchain Reward

Description

Endpoint /api/blocks/getReward returns reward — the reward a delegate will get for forging a block. Integer amount of 1/10^8 ADM tokens (1 ADM = 100000000). Depends on the slot height.

Endpoint Format

GET /api/blocks/getReward

Example

GET https://endless.adamant.im/api/blocks/getReward

Answer example

{
    "success": true,
    "nodeTimestamp": 58047028,
    "reward": 45000000
}

Get Total Supply of ADAMANT Tokens

Description

Endpoint /api/blocks/getSupply returns total current supply of ADM tokens in network. Integer amount of 1/10^8 ADM tokens (1 ADM = 100000000). Total supply increases with every new forged block.

Endpoint Format

GET /api/blocks/getSupply

Example

GET https://endless.adamant.im/api/blocks/getSupply

Answer example

{
    "success": true,
    "nodeTimestamp": 58047218,
    "supply": 10198038140000000
}

Get ADAMANT Blockchain Network Info

Description

Integrative endpoint /api/blocks/getStatus returns ADAMANT blockchain network information with a single request:

Endpoint Format

GET /api/blocks/getStatus

Example

GET https://endless.adamant.im/api/blocks/getStatus

Answer example

{
    "success": true,
    "nodeTimestamp": 58047435,
    "broadhash": "4a28272c915f74d118120bb47db547a18a7512e1d48092c48be86939a6d45b89",
    "epoch": "2017-09-02T17:00:00.000Z",
    "height": 10145334,
    "fee": 50000000,
    "milestone": 1,
    "nethash": "bd330166898377fb28743ceef5e43a5d9d0a3efd9b3451fb7bc53530bb0a6d64",
    "reward": 45000000,
    "supply": 10198040075000000
}

Get Blockchain and Network Status

Description

Integrative endpoint /api/node/status returns both ADAMANT blockchain network information and Node information with a single request. Result includes network, version and wsClient info.

wsClient describes if node allows socket connections and port to connect.

Endpoint Format

GET /api/node/status

Example

GET https://endless.adamant.im/api/node/status

Answer example

{
    "success": true,
    "nodeTimestamp": 58640735,
    "network": {
        "broadhash": "56327efc1c370dd3b1188e88a881d560e4822b2195a04b302afb87ed0d261bac",
        "epoch": "2017-09-02T17:00:00.000Z",
        "height": 10262516,
        "fee": 50000000,
        "milestone": 1,
        "nethash": "bd330166898377fb28743ceef5e43a5d9d0a3efd9b3451fb7bc53530bb0a6d64",
        "reward": 45000000,
        "supply": 10203313265000000
    },
    "version": {
        "build": "",
        "commit": "b07aaf9580dffb5cc95cc65f303f6f1e5fca7d9c",
        "version": "0.5.2"
    },
    "wsClient": {
        "enabled": true,
        "port": 36668
    }
}

States: Key-Value Storage (KVS)

Endpoints intended to store data in ADAMANT Key-Value Storage (KVS).

See also:

Get States

Description

Use endpoint /api/states/get to fetch data from KVS. Available with GET or POST requests. Use POST when maximum URI lengths exceeded. For filtering and options see Transactions Query Language.

As a result you'll get a list of transactions of type = 9 with KVS data, stored in asset.state fields. Structure of state described in Storing Data in KVS section.

Endpoint Format

GET /api/states/get
POST /api/states/get

Example

GET https://endless.adamant.im/api/states/get?key=eth:address&senderId=U14236667426471084862&orderBy=timestamp:desc
GET https://ahead.adamant.im/api/states/get?keyIds=eth:address,doge:address,dash:address,btc:address&senderIds=U3461022864428928223,U17790659840463725618,U43512412354440829,U10666556853857590034,U15677078342684640219,U10879891600431315092,U15677078342684640219,U16189664252187503076,U15738334853882270577,U11051173936218114255,U5149447931090026688,U18064911620565010636,U11962817086029207137,U14236667426471084862,U3857204090751960756,U18290410688451164219,U15506276306084215695,U18009522315196199993,U17325711452096864732,U16634908687170714645,U9203183357885757380,U12382044996701379416,U3938345682225572184,U116971041436569303,U11163081294512846715,U5517006347330072401,U7972131227889954319,U7578227434840718692&orderBy=timestamp:desc
curl -XPOST -H "Content-type: application/json" -d '{"keyIds":["eth:address","doge:address","dash:address","btc:address"], "senderIds":["U3461022864428928223","U17790659840463725618","U43512412354440829","U10666556853857590034","U15677078342684640219","U10879891600431315092","U15677078342684640219","U16189664252187503076","U15738334853882270577","U11051173936218114255","U5149447931090026688","U18064911620565010636","U11962817086029207137","U14236667426471084862","U3857204090751960756","U18290410688451164219","U15506276306084215695","U18009522315196199993","U17325711452096864732","U16634908687170714645","U9203183357885757380","U12382044996701379416","U3938345682225572184","U116971041436569303","U11163081294512846715","U5517006347330072401","U7972131227889954319","U7578227434840718692"]}' 'https://ahead.adamant.im/api/states/get'

Answer example

{
    "success": true,
    "nodeTimestamp": 63647706,
    "transactions": [
        {
            "id": "13920471299012339255",
            "height": 6361977,
            "blockId": "14557933175886918347",
            "type": 9,
            "block_timestamp": 39015790,
            "timestamp": 39015780,
            "senderPublicKey": "8cd9631f9f634a361ea3b85cbd0df882633e39e7d26d7bc615bbcf75e41524ef",
            "requesterPublicKey": null,
            "senderId": "U14236667426471084862",
            "recipientId": null,
            "recipientPublicKey": null,
            "amount": 0,
            "fee": 100000,
            "signature": "56ac1fe17631e16197cd76398f300ab331a79469af18403d0b0f22156d03843bf2917f46e368d72dd91962eaacc91736e2f696d41738d6b573f92bdcaf335505",
            "signSignature": null,
            "signatures": [],
            "confirmations": null,
            "asset": {
                "state": {
                    "value": "0x84609a38fedbcd02b657233340e6a8cb09db61a8",
                    "key": "eth:address",
                    "type": 0
                }
            }
        }
    ],
    "count": "1"
}

Register Store in KVS Transaction

Description

Use endpoint /api/states/store to broadcast transactions of type 9 — Store in KVS. Make POST request to the endpoint, with payload of transaction object, where:

  • type is set to 9
  • asset is filled with key, value and type

If needed, asset can be encrypted. See Storing Data in KVS.

Transaction must be formed and signed.

As a success result you'll get id of transaction registered in ADAMANT blockchain.

Endpoint Format

POST /api/states/store

Example

// POST https://endless.adamant.im/api/states/store

{
    "transaction": {
        "type": 9,
        "amount": 0,
        "senderId": "U13670390070364760381",
        "senderPublicKey": "2640b667910a362a0fac4ca3b54b90052086b63e603c4df8758b6713e70e61a2",
        "asset": {
            "state": {
                "key": "eth:address",
                "value": "0x00777c36204bca77569ce5ed4233d91ea92a170b",
                "type": 0
            }
        },
        "timestamp": 63410860,
        "signature": "bce364378b145e79909c31bc3a77cd3b70dff8f0d410f8c791642b826bc193fa59c154e71639d82f5b8f6ef82dc92e8f7fcb9086bb03d0f78a3d50c46b268606"
    }
}

Answer example

{
    "success": true,
    "nodeTimestamp": 63410860,
    "transactionId": "3888802408802922744"
}

Transactions

Contains endpoints useful to interact with transactions of ADAMANT blockchain.

Every action in ADAMANT, a blockchain messenger, is a transaction — f. e., sending tokens, voting for delegate, storing contact list, or sending a message. See Transaction Types.

Transactions can by fetched with filtering and options using Transactions Query Language. To receive asset contents, set returnAsset to 1.

Get List of Transactions

Description

To get list of all transactions registered at ADAMANT blockchain use endpoint /api/transactions. Result includes list of transactions with structure:

  • id — id of transaction
  • height — block height where transaction forged
  • blockId — block id where transaction forged
  • type — type of transaction. See Transaction Types.
  • timestamp — transaction timestamp, 32 bit integer epoch timestamp (in seconds starting from Sep 02 2017 17:00:00 GMT+0000). Nodes do not accept transactions stamped in future.
  • block_timestamp — transaction's block timestamp. It is up to client how to interpret this field. It is recommended to take in account of both timestamp and block_timestamp fields when determine transaction timestamp.
  • senderPublicKey — public key of sender
  • senderIdADAMANT address of sender
  • recipientId — ADAMANT address of recipient
  • recipientPublicKey — public key of recipient
  • amount — amount to transfer in 64 bit integer, 8 decimal points (100000000 equals to 1 ADM). For non-transfer transactions must be 0
  • fee — fee for operation. Depends on type of transaction
  • signature — transaction signature
  • confirmations — count of network confirmations — how much blocks generated after this block on current node's height
  • asset — transaction data specific for different transaction/message types. See ADAMANT Message Types and Storing Data in KVS. Used also in signature calculation.

NOTE: Read more about transaction structure in AIP 10: General transaction structure for API calls

Endpoint Format

GET /api/transactions

Example

GET https://endless.adamant.im/api/transactions?minAmount=100000000000001&and:fromHeight=2190516&limit=2

Answer example

{
    "success": true,
    "nodeTimestamp": 63647315,
    "transactions": [
        {
            "id": "15161295239237781653",
            "height": 7585271,
            "blockId": "16391508373936326027",
            "type": 8,
            "block_timestamp": 45182260,
            "timestamp": 45182254,
            "senderPublicKey": "bd39cc708499ae91b937083463fce5e0668c2b37e78df28f69d132fce51d49ed",
            "senderId": "U16023712506749300952",
            "recipientId": "U17653312780572073341",
            "recipientPublicKey": "23d27f616e304ef2046a60b762683b8dabebe0d8fc26e5ecdb1d5f3d291dbe21",
            "amount": 204921300000000,
            "fee": 50000000,
            "signature": "3c8e551f60fedb81e52835c69e8b158eb1b8b3c89a04d3df5adc0d99017ffbcb06a7b16ad76d519f80df019c930960317a67e8d18ab1e85e575c9470000cf607",
            "signatures": [],
            "confirmations": 3660548,
            "asset": {}
        },
        {
            "id": "273812757049414072",
            "height": 5022045,
            "blockId": "3228763343382065625",
            "type": 0,
            "block_timestamp": 32283395,
            "timestamp": 32283382,
            "senderPublicKey": "1e214309cc659646ecf1d90fa37be23fe76854a76e3b4da9e4d6b65a718baf8b",
            "senderId": "U7047165086065693428",
            "recipientId": "U11420099101614271169",
            "recipientPublicKey": "b29420b8ee7a678b49c2f4b41e614e32a7149ac7f8b81cc174611daefe9636cf",
            "amount": 600000000000000,
            "fee": 50000000,
            "signature": "2a6b51058b4d4a6312f32d4a6c14f1cc77f8c581e1f02ad8c13aeaa77880edd7e66ce150ffaeef2f541ad8366849f32710f66a6b95b3d2c9291f6fcdf045a50e",
            "signatures": [],
            "confirmations": 6223774,
            "asset": {}
        }
    ],
    "count": "6"
}

Get Transaction by Id

Description

Get information about specific transaction using endpoint /api/transactions/get with transaction id as a parameter.

Endpoint Format

GET api/transactions/get?id={id}

Example

GET https://ahead.adamant.im/api/transactions/get?id=12154642911137703318&returnAsset=1

Answer example

{
    "success": true,
    "nodeTimestamp": 63652999,
    "transaction": {
        "id": "12154642911137703318",
        "height": 3245671,
        "blockId": "13885000778367150465",
        "type": 8,
        "block_timestamp": 23284520,
        "timestamp": 23284514,
        "senderPublicKey": "cdab95b082b9774bd975677c868261618c7ce7bea97d02e0f56d483e30c077b6",
        "senderId": "U15423595369615486571",
        "recipientId": "U12777528161244463452",
        "recipientPublicKey": "738a15db24bd055d65a449dee27508708a2c6b8457c3033fb5f389ac0e3b4c9e",
        "amount": 0,
        "fee": 100000,
        "signature": "8c846fbd41b84635283096bb5833745886760776a433bb050505aaf045efb0f97ce69cd9f108dc4e58392bb507848e1e75d6ea203e7c7904881c44d0f61e2901",
        "signatures": [],
        "confirmations": 8001268,
        "asset": {
            "chat": {
                "message": "6ef39d1034b368bd731c7bcbaa820f0e501bbfb1d1b15e2ffa4bd8421836fe87be10e32342e183d3",
                "own_message": "a23419efa40a9e340741325d0f5db508959c330af51e37fe",
                "type": 1
            }
        }
    }
}

Get Count of Transactions

Description

Get count of transactions with different states using endpoint /api/transactions/count. As a result you'll receive:

  • confirmed
  • unconfirmed
  • queued

NOTE: When a node receives a new transaction, it goes to transaction pool — queued transactions. Then a delegate takes queued transactions and includes them in a block. Until network confirms the block, transactions in it are unconfirmed.

NOTE: Endpoint /api/transactions/count can return misleading unconfirmed and queued values. To get unconfirmed and queued transactions and their count use /api/transactions/unconfirmed and /api/transactions/queued endpoints.

NOTE: Unconfirmed and queued transactions can vary between different nodes.

NOTE: Use unconfirmed and queued transactions wisely as they may never be included in blockchain. There are few use cases, when you need to get unconfirmed and queued transactions.

Endpoint Format

GET /api/transactions/count

Example

GET https://endless.adamant.im/api/transactions/count

Answer example

{
    "success": true,
    "nodeTimestamp": 59979539,
    "confirmed": 256953,
    "multisignature": 0,
    "unconfirmed": 44,
    "queued": 42
}

Get Queued Transactions

Description

Get transactions which are in node's queue with endpoint /api/transactions/queued. As such transactions not included in blockchain yet, they have no blockId and height fields, but have additional receivedAt filed.

Endpoint Format

GET /api/transactions/queued

Example

GET https://endless.adamant.im/api/transactions/queued

Answer example

{
    "success": true,
    "nodeTimestamp": 59979277,
    "transactions": [{
        "timestamp": 59979276,
        "senderId": "U17362714543155685887",
        "recipientId": "U17819800352812315500",
        "type": 0,
        "senderPublicKey": "632816f2c44a08f282e85532443d73286cadc6d9820d5d25c9d50d8e01c668e0",
        "signature": "1db7e9111eaca790b73d51c32572739c46fcba3962aff55ca47ecf9a8c9fcb82c323de39ed60bc87d81a1245d43b5351b9dd44ad70128d78536250168b64c408",
        "amount": 100000000,
        "id": "16682447412632442981",
        "fee": 50000000,
        "relays": 1,
        "receivedAt": "2019-07-28T21:54:36.543Z"
    }],
    "count": 1
}

Get Specific Queued Transaction

Description

Get specific transaction from node's queue by its id using endpoint /api/transactions/queued/get.

Endpoint Format

GET /api/transactions/queued/get?id={id}

Example

GET https://endless.adamant.im/api/transactions/queued/get?id=16682447412632442981

Answer example

{
    "success": true,
    "nodeTimestamp": 153712825,
    "transaction": {
        "id": "16682447412632442981",
        "height": 10527806,
        "blockId": "2635215585577611518",
        "type": 0,
        "block_timestamp": 59979295,
        "timestamp": 59979276,
        "senderPublicKey": "632816f2c44a08f282e85532443d73286cadc6d9820d5d25c9d50d8e01c668e0",
        "senderId": "U17362714543155685887",
        "recipientId": "U17819800352812315500",
        "recipientPublicKey": "28994b2cd075fd442e6ce78fa8c07966ed122932ff07411fed3c918e495586e2",
        "amount": 100000000,
        "fee": 50000000,
        "signature": "1db7e9111eaca790b73d51c32572739c46fcba3962aff55ca47ecf9a8c9fcb82c323de39ed60bc87d81a1245d43b5351b9dd44ad70128d78536250168b64c408",
        "signatures": [],
        "confirmations": 18431929,
        "asset": {}
    }
}

Get Unconfirmed Transactions

Description

Get transactions which unconfirmed yet with endpoint /api/transactions/unconfirmed. As such transactions not included in blockchain yet, they have no blockId and height fields, but have additional receivedAt filed.

Endpoint Format

GET /api/transactions/unconfirmed

Example

GET https://endless.adamant.im/api/transactions/unconfirmed

Answer example

{
    "success": true,
    "nodeTimestamp": 58880320,
    "transactions": [{
        "type": 8,
        "amount": 9000000,
        "senderId": "U11987698782411545765",
        "senderPublicKey": "b87f9fe005c3533152230fdcbd7bf87a0cea83592c591f7e71be5b7a48bb6e44",
        "asset": {
            "chat": {
                "message": "6e69d547ce31dbbe0a5aba78c516e91d71e3b2",
                "own_message": "e1c00c2c8b8f59f49e176aef30915c6deba554f87c45951e",
                "type": 1
            }
        },
        "recipientId": "U5885317311990438076",
        "timestamp": 58880317,
        "signature": "5ee972df476703492a667616eef428ed127e13fe5de8ba873b6579a806ddbd9fbd34147cf0321823d72e0d234466fc3dc89ebe7341e0b4a91a56b32d3bdb6a00",
        "id": "2521078418148431420",
        "fee": 50000000,
        "relays": 1,
        "receivedAt": "2019-07-16T04:38:38.492Z"
    }],
    "count": 1
}

Get Specific Unconfirmed Transaction

Description

Get specific unconfirmed transaction by its id using endpoint /api/transactions/unconfirmed/get.

Endpoint Format

GET /api/transactions/unconfirmed/get?id={id}

Example

GET https://endless.adamant.im/api/transactions/unconfirmed/get?id=8958126469643732641

Answer example

{
    "success": true,
    "nodeTimestamp": 63137669,
    "transaction": {
        "type": 8,
        "amount": 0,
        "senderId": "U15677078342684640219",
        "senderPublicKey": "e16e624fd0a5123294b448c21f30a07a0435533c693b146b14e66830e4e20404",
        "asset": {
            "chat": {
                "message": "75582d940f2c4093929c99a6c1911b4753",
                "own_message": "58dceaa227b3fb1dd1c7d3fbf3eb5db6aeb6a03cb7e2ec91",
                "type": 1
            }
        },
        "recipientId": "U16655734187932477074",
        "timestamp": 63137661,
        "signature": "e25f1aba994c7f07c03099edcbe0ada19df371ddf1a829dae8dee36ab809ce8a438111bf65056c813e9dc832a890a081ba1cd295d37e509f62f042149e62e30d",
        "id": "8958126469643732641",
        "fee": 100000,
        "relays": 1,
        "receivedAt": "2019-09-03T11:14:22.638Z"
    }
}

Register Token Transfer Transaction

Description

Use endpoint /api/transactions/process to broadcast transactions of type 0 — Token transfer, and type 8 — Chat/Message.

To make In-Chat ADM token transfer with comment, you also can use Register Chat Message Transaction or universal Register Transaction endpoints.

Make POST request to the endpoint, with payload of transaction object, where:

  • type is set to 0
  • asset is empty

Transaction must be formed and signed.

As a success result you'll get id of transaction registered in ADAMANT blockchain.

Endpoint Format

POST /api/transactions/process

Example

// POST https://endless.adamant.im/api/transactions/process

{
    "transaction": {
        "type": 0,
        "amount": 100000000,
        "senderId": "U14236667426471084862",
        "senderPublicKey": "8cd9631f9f634a361ea3b85cbd0df882633e39e7d26d7bc615bbcf75e41524ef",
        "recipientId": "U16655734187932477074",
        "timestamp": 63228852,
        "signature": "b3982d603be8f0246fa663e9f012bf28b198cd28f82473db1eb4a342d890f7a2a2c1845db8d256bb5bce1e64a9425822a91e10bf960a2e0b55e20b4841e4ae0b"
    }
}

Answer example

{
    "success": true,
    "nodeTimestamp": 63228852,
    "transactionId": "6146865104403680934"
}

Register Transaction

Description

Use universal endpoint /api/transactions to broadcast transactions of any type. This endpoint can be used instead of:

Make POST request to the endpoint, with payload of transaction object. Transaction must be formed and signed.

As a success result you'll get id of transaction registered in ADAMANT blockchain.

Endpoint Format

POST /api/transactions

Example

// POST https://endless.adamant.im/api/transactions

{
    "transaction": {
        "type": 0,
        "amount": 100000000,
        "senderId": "U14236667426471084862",
        "senderPublicKey": "8cd9631f9f634a361ea3b85cbd0df882633e39e7d26d7bc615bbcf75e41524ef",
        "recipientId": "U16655734187932477074",
        "timestamp": 63228852,
        "signature": "b3982d603be8f0246fa663e9f012bf28b198cd28f82473db1eb4a342d890f7a2a2c1845db8d256bb5bce1e64a9425822a91e10bf960a2e0b55e20b4841e4ae0b"
    }
}

Answer example

{
    "success": true,
    "nodeTimestamp": 63228852,
    "transactionId": "6146865104403680934"
}
Clone this wiki locally