Skip to content

Node API

Node provides REST API to access the current blockchain status.

Get the events generated by program

You can get the generated events by name and the address of the program where they were generated.

Request

GET api/public/events

Parameters

Parameter Optional Type
program Yes hex
name Yes string
transactionId Yes hex
offset Yes integer
count Yes integer

Response

The list of events' offsets, transactionIds, addresses, names and datas:

[
    {
        "offset": 0,
        "transactionId": "0123456789abcdef",
        "timestamp": <unix-timestamp (long) like 1565618724247>,
        "address" : "<address of the program emited event>",
        "name": "event-name",
        "data": "<some data from the first event>"                
    },    
    {
        "offset": 1,       
        "transactionId": "fedcba9876543210",
        "timestamp": <unix-timestamp (long) like 1565618724247>,
        "address" : "<address of the program emited event>",
        "name": "another-name"
        "data": "<some data from the second event>"               
    }
    ...
]

Examples

curl <api url>/api/public/events?program=e1941077e00b3cf81a8275788334292d9b2e2f0002bd622444cb37fa5e4d08a0

will return all events for given program's address in chronological order

curl <api url>/api/public/events?program=e1941077e00b3cf81a8275788334292d9b2e2f0002bd622444cb37fa5e4d08a0&name=myevent

will return all events for given program's address and name

curl <api url>/api/public/events?program=e1941077e00b3cf81a8275788334292d9b2e2f0002bd622444cb37fa5e4d08a0&name=myevent&offset=10

will return all events starting from offset 10

curl <api url>/api/public/events?program=e1941077e00b3cf81a8275788334292d9b2e2f0002bd622444cb37fa5e4d08a0&name=myevent&offset=10&count=20

will return only first 20 events from offset 10

curl <api url>/api/public/events?transactionId=07c3271089cc86b21058d50cb72b82bf45c548b2

will return all events for given transactionId

curl <api url>/api/public/events?transactionId=07c3271089cc86b21058d50cb72b82bf45c548b2

will return all events for given transactionId

Filtering by name

When name is specified the result is formed in the same manner as getting events without name and then filtering these events by name in memory. It means offsets can be inconsistent, some offsets may be skipped, for example we can get 1, 2, 5, 10, 100 series of offsets for some request.