v3.0 Upgrade Guide - JSON-RPC

Warning

WARNING: Upgrading a complex software project always comes at the risk of breaking something, so make sure you have a backup.

Performing the Upgrade

1exchange-json-rpc update --force --restart

Reporting Problems

If you happen to experience any issues please open an issue with a detailed description of the problem, steps to reproduce it and info about your environment.

Related ARK Core API changes

POST /search endpoints removed

All POST /search endpoints have been removed, in favor of using the main index endpoint (for example GET /transactions) with url parameters. All the main index endpoints have been improved to allow searching (see below API improvements).

Standardized wallet response format

Now wallet endpoints return wallet object following this format :

1{
2 "address",
3 "publicKey",
4 "balance",
5 "nonce",
6 "attributes": {
7 "delegate": {
8 "username",
9 "resigned", // this attribute will only be set if delegate is resigned
10 // other delegate attributes
11 },
12 "vote",
13 "secondPublicKey",
14 "multiSignature",
15 }
16}

As a result, to get wallets based on a specific attribute, we have to use the full attribute path, for example :

GET /wallets?attributes.delegate.username=mydelegate

Note that isDelegate does not exist anymore in the wallet response : in order to check if the wallet is a delegate, you should check the existence of attributes.delegate and that attributes.delegate.resigned is either non-existent or false.

addresses parameter was removed

addresses was a parameter used to search for multiple addresses at the same time. Now with the improvements in api, this special parameter is not needed anymore as we can simply use the address parameter like this for example :

GET /transactions?address=AXGc1bvU3g3rHmx9WVkUUHLA6gbzh8La7V,AVLPrtx669XgvervE6A594poB613HG3mSM

API improvements

Filter by any field returned in the API response

Let’s take an example, say we GET /delegates and we get this entry in the response :

1{
2 "username": "protokol1",
3 "address": "ATKegnoyu9Fkej5FxiJ3biup8xv8zM34M3",
4 "publicKey": "033f6d89ad9f3e6dfb8cfb4f2d7fca7adeb6db15c282c113d0452238293bb50046",
5 "votes": "302776200010000",
6 "rank": 1,
7 "isResigned": false,
8 "blocks": {
9 "produced": 13886,
10 "last": {
11 "id": "9630922981846498992",
12 "height": 1150380,
13 "timestamp": {
14 "epoch": 112045656,
15 "unix": 1602146856,
16 "human": "2020-10-08T08:47:36.000Z"
17 }
18 }
19 },
20 "production": {
21 "approval": 2.42
22 },
23 "forged": {
24 "fees": "10000000",
25 "rewards": "2777200000000",
26 "total": "2777210000000"
27 }
28}

By just looking at the response we can create an API query that filters by any field, like :

GET /delegates?isResigned=true

GET /delegates?blocks.produced=13886

We can still combine (AND) different fields :

GET /delegates?isResigned=true&blocks.produced=0

Filter by a set of values for one field (OR)

Following the same example, we can also specify a set of values (OR) for one field using comma-separated values :

GET /delegates?username=protokol1,protokol2

And we can still combine with other fields (AND) :

GET /delegates?username=protokol1,protokol2&isResigned=false

Order by any field

Additionally, we can order by any field by using the orderBy parameter :

GET /delegates?orderBy=rank:desc

The format is field:asc|desc depending on whether you want to order ascending or descending.

We can combine this with the filters :

GET /delegates?isResigned=false&orderBy=rank:asc

Last updated 2 years ago
Edit Page
Share: