API

Front-end service

Globally, the API is built around 4 methods:
    1.
    Sending transactions.
    2.
    Reading account status.
    3.
    Reading transaction history.
    4.
    Obtaining more information.
The service is now in alpha version so the API will change.

Sending transaction

Allows sending transactions for confirmation on the peer.
Answer codes:
    201 - transaction sent sucessfully.
    400 - sending error (there will be an error message in the error field in the reply).
    500 - internal error (usually related to data parsing).
1
POST http://127.0.0.1:8180/v1/backlog
2
3
{"commands":[{"data":{"alg":"ed25519","id":"EON-27Z6X-N77SJ-B8GEM","key":"9zUema0KRJFkx2mC4HjEZZ0xCH0MMAdGH34rXfz2p4o="},"deadline":300,"id":"CMD-GC3KG-HB3LK-2ETBN","network":"core.dev.Ti2YGY","publisher":"EON-HRAEQ-8NZL7-C9LHJ","timestamp":1592296782,"type":"core.auth.pk.new","version":1}],"confirmations":{"EON-HRAEQ-8NZL7-C9LHJ":"HyZIa5n3fKxlUY6lnJVjYhAICGnIPi2czQnW7T+h/CDJORR5gJPfmYaIP22/yHCHWhfCkWV4aLZkc2k6XcePAg=="},"deadline":300,"fee":1000,"id":"TX-GC3KG-HFN93-GHF6R","publisher":"EON-HRAEQ-8NZL7-C9LHJ","timestamp":1592296782,"version":1}
Copied!
1
{"code":0}
Copied!

Reading account status

Reading the key/verifying the account's existence
Allows to get a public key by EON-ACC-ID. If the account does not exist, it will return as 404.
1
GET http://{PROXY}/v1/accounts/{EON-ACC-ID}/state
Copied!
Example:
1
GET http://127.0.0.1:8180/v1/accounts/EON-HRAEQ-8NZL7-C9LHJ/state
Copied!
1
{
2
"id": "EON-HRAEQ-8NZL7-C9LHJ",
3
"public_key": {
4
"algorithm": "ed25519",
5
"value": "s6X2I0RzdMIu60CR4B4bJD6gXy2541I+++BjLwpfPGE="
6
}
7
}
Copied!
Reading the entire status
Request:
1
GET http://127.0.0.1:8180/v1/raw/EON-HRAEQ-8NZL7-C9LHJ/
Copied!
Reply:
1
{
2
"core.auth.pk.alg": "ed25519",
3
"core.auth.pk.value": "s6X2I0RzdMIu60CR4B4bJD6gXy2541I+++BjLwpfPGE=",
4
"core.balance": 1000000000000000,
5
"core.charge.timestamp": 0,
6
"core.charge.value": 0,
7
"core.created": 0,
8
"core.deposit": 1000000000000000,
9
"core.version": 1
10
}
Copied!
If the account does not exist it will return as empty JSON object: {}.
Reading part of the status
Request:
1
GET http://127.0.0.1:8180/v1/raw/EON-HRAEQ-8NZL7-C9LHJ/core.auth.pk
Copied!
Reply:
1
{
2
"alg": "ed25519",
3
"value": "s6X2I0RzdMIu60CR4B4bJD6gXy2541I+++BjLwpfPGE="
4
}
Copied!
If the account does not exist or the requested data set does not exist it will return as empty JSON object: {}.
If you fully specify the data key, the data in the response will be located by the key ", for example core.auth.pk.alg: {"":"ed25519"}.

Reading the transaction history

Receiving recent transactions
1
GET http://127.0.0.1:8180/v1/accounts/EON-HRAEQ-8NZL7-C9LHJ/transactions
2
GET http://127.0.0.1:8180/v1/accounts/EON-HRAEQ-8NZL7-C9LHJ/transactions?page=1&limit=30
Copied!
1
[
2
{
3
"commands": [
4
{
5
"data": {
6
"alg": "ed25519",
7
"id": "EON-27Z6X-N77SJ-B8GEM",
8
"key": "9zUema0KRJFkx2mC4HjEZZ0xCH0MMAdGH34rXfz2p4o="
9
},
10
"deadline": 300,
11
"id": "CMD-GC3KG-HB3LK-2ETBN",
12
"network": "core.dev.Ti2YGY",
13
"publisher": "EON-HRAEQ-8NZL7-C9LHJ",
14
"timestamp": 1592296782,
15
"type": "core.auth.pk.new",
16
"version": 1
17
}
18
],
19
"confirmations": {
20
"EON-HRAEQ-8NZL7-C9LHJ": "HyZIa5n3fKxlUY6lnJVjYhAICGnIPi2czQnW7T+h/CDJORR5gJPfmYaIP22/yHCHWhfCkWV4aLZkc2k6XcePAg=="
21
},
22
"deadline": 300,
23
"fee": 1000,
24
"id": "TX-GC3KG-HFN93-GHF6R",
25
"publisher": "EON-HRAEQ-8NZL7-C9LHJ",
26
"timestamp": 1592296782,
27
"version": 1
28
}
29
]
Copied!

Receiving a specific transaction

1
GET http://127.0.0.1:8180/v1/transactions/TX-GC3KG-HFN93-GHF6R
Copied!
1
{
2
"block": "block-123",
3
"commands": [
4
{
5
"data": {
6
"alg": "ed25519",
7
"id": "EON-27Z6X-N77SJ-B8GEM",
8
"key": "9zUema0KRJFkx2mC4HjEZZ0xCH0MMAdGH34rXfz2p4o="
9
},
10
"deadline": 300,
11
"id": "CMD-GC3KG-HB3LK-2ETBN",
12
"network": "core.dev.Ti2YGY",
13
"publisher": "EON-HRAEQ-8NZL7-C9LHJ",
14
"timestamp": 1592296782,
15
"type": "core.auth.pk.new",
16
"version": 1
17
}
18
],
19
"confirmations": {
20
"EON-HRAEQ-8NZL7-C9LHJ": "HyZIa5n3fKxlUY6lnJVjYhAICGnIPi2czQnW7T+h/CDJORR5gJPfmYaIP22/yHCHWhfCkWV4aLZkc2k6XcePAg=="
21
},
22
"deadline": 300,
23
"fee": 1000,
24
"id": "TX-GC3KG-HFN93-GHF6R",
25
"publisher": "EON-HRAEQ-8NZL7-C9LHJ",
26
"timestamp": 1592296782,
27
"version": 1
28
}
Copied!

Reading block history

Block heading structure
    id : String - block identifier (just a string, different synchronization algorithms may use a different identifier formats).
    prev : String - previous block identifier (just a string).
    height : long - height.
    timestamp : long - creation time.
Example:
1
{
2
"id": "block-900",
3
"prev": "block-899",
4
"height": 900,
5
"timestamp": 1582095023
6
}
Copied!
Receiving the header of the last block
1
http://127.0.0.1:8180/v1/blocks/last
Copied!
Receiving a block header by identifier
1
http://127.0.0.1:8180/v1/blocks/id/block-5
Copied!
Receiving a block header by height
1
http://127.0.0.1:8180/v1/blocks/height/900
Copied!
Receiving block transactions
1
http://127.0.0.1:8180/v1/blocks/id/block-5/transactions
Copied!

Reading additional information

Receiving the network identifier
1
GET http://127.0.0.1:8180/v1/info/network
Copied!
1
{
2
"network": "core.dev.Ti2YGY"
3
}
Copied!
Receiving the current commission
1
GET http://127.0.0.1:8180/v1/info/fee
Copied!
Returns 2 parameters - the size and commission for a transaction of this size. This solution should increase the accuracy of commission calculation. To get the commission per byte of a transaction it is necessary to calculate fee / size.
1
{
2
"fee": 1000,
3
"size": 1000
4
}
Copied!
Receiving the network time
1
GET http://127.0.0.1:8180/v1/info/timestamp
Copied!
1
{
2
"timestamp": 1588838916
3
}
Copied!

Account registration service (internal use only)

To access the service, you must specify the access token in the request header: Authorization: Bearer <token>.

Check account status

1
GET http://127.0.0.1:8180/v1/accounts/EON-HRAEQ-8NZL7-C9LHJ
Copied!
Reply:
1
{
2
"id": "EON-HRAEQ-8NZL7-C9LHJ",
3
"public_key": {
4
"algorithm": "ed25519",
5
"value": "s6X2I0RzdMIu60CR4B4bJD6gXy2541I+++BjLwpfPGE="
6
}
7
}
Copied!

Register an account

1
POST http://127.0.0.1:8180/v1/accounts/
2
3
{
4
"id": "EON-HRAEQ-8NZL7-C9LHJ",
5
"public_key": {
6
"algorithm": "ed25519",
7
"value": "s6X2I0RzdMIu60CR4B4bJD6gXy2541I+++BjLwpfPGE="
8
}
9
}
Copied!
Possible reply statuses:
    201 Created - account successfully created.
    400 Bad Request - account creation error. Reply example: {"code":1,"error":"Public key already exists"}.
    500 Internal Server Error - internal server error.
Last modified 6mo ago