Feeder Gateway

This is the StarkEx Services HTTP gateway for feeder interactions.

The Feeder is a gateway to the StarkEx system for retrieving transaction batch information by external parties. Access to information is based on batch IDs only. The intention is to allow more detailed slicing and dicing to be performed on an external DB rather than via this API.

get_batch_enclosing_ids

Get first and last transaction IDs for the input batch_id.

Parameters

  • batch_id(int) – Batch ID to query.

Returns

  • List of first and last batch IDs (JSON).

Return type

  • str

Example

  • http

  • curl

  • wget

  • httpie

  • python-requests

  • response

GET feeder_gateway/v2/get_batch_enclosing_ids?batch_id=5678 HTTP/1.1
Host: localhost:9413
Accept: application/json
curl -i -X GET 'https://localhost:9413feeder_gateway/v2/get_batch_enclosing_ids?batch_id=5678' -H "Accept: application/json"
wget -S -O- 'https://localhost:9413feeder_gateway/v2/get_batch_enclosing_ids?batch_id=5678' --header="Accept: application/json"
http 'https://localhost:9413feeder_gateway/v2/get_batch_enclosing_ids?batch_id=5678' Accept:application/json
requests.get('https://localhost:9413feeder_gateway/v2/get_batch_enclosing_ids?batch_id=5678', headers={'Accept': 'application/json'})
HTTP/1.1 200 OK
Content-Type: application/json

[10000, 12345]

get_batch_ids

This function is deprecated and will be deleted in the next version.

Get a list of batch IDs matching the input vaults root, orders root and sequence number.

Parameters

  • vault_root(int) – Vaults root to query.

  • order_root(int) – Orders root to query.

  • sequence_number(int) – Sequence number to query.

Returns

  • List of batch IDs (JSON).

Return type

  • str

Example

  • http

  • curl

  • wget

  • httpie

  • python-requests

  • response

GET /feeder_gateway/get_batch_ids?vault_root=0x46bc9d7b7716bc33b1db5b7509c0a076ab9424ba5e16dd26de8097a62f1ef1d1&order_root=0x84695d9d13ec0eeafc07b7d0c5da3f30e42e468bc69413c2b77e62cd8cdeb9a8&sequence_number=5678 HTTP/1.1
Host: localhost:9413
Accept: application/json
curl -i -X GET 'https://localhost:9413/feeder_gateway/get_batch_ids?vault_root=0x46bc9d7b7716bc33b1db5b7509c0a076ab9424ba5e16dd26de8097a62f1ef1d1&order_root=0x84695d9d13ec0eeafc07b7d0c5da3f30e42e468bc69413c2b77e62cd8cdeb9a8&sequence_number=5678' -H "Accept: application/json"
wget -S -O- 'https://localhost:9413/feeder_gateway/get_batch_ids?vault_root=0x46bc9d7b7716bc33b1db5b7509c0a076ab9424ba5e16dd26de8097a62f1ef1d1&order_root=0x84695d9d13ec0eeafc07b7d0c5da3f30e42e468bc69413c2b77e62cd8cdeb9a8&sequence_number=5678' --header="Accept: application/json"
http 'https://localhost:9413/feeder_gateway/get_batch_ids?vault_root=0x46bc9d7b7716bc33b1db5b7509c0a076ab9424ba5e16dd26de8097a62f1ef1d1&order_root=0x84695d9d13ec0eeafc07b7d0c5da3f30e42e468bc69413c2b77e62cd8cdeb9a8&sequence_number=5678' Accept:application/json
requests.get('https://localhost:9413/feeder_gateway/get_batch_ids?vault_root=0x46bc9d7b7716bc33b1db5b7509c0a076ab9424ba5e16dd26de8097a62f1ef1d1&order_root=0x84695d9d13ec0eeafc07b7d0c5da3f30e42e468bc69413c2b77e62cd8cdeb9a8&sequence_number=5678', headers={'Accept': 'application/json'})
HTTP/1.1 200 OK
Content-Type: application/json

[123, 456]

get_batch_info

This function is deprecated and will be deleted in the next version. Instead, use get_batch_info_version2

Get detailed batch information.

Please note that the returned order roots (prev_order_root and order_root) can be either roots of a Merkle tree or roots of a Patricia tree. If the batch was created prior the upgrade to V4.5 the roots will be of a Merkle tree, otherwise the roots will be of a Patrica tree. See the response example for returned keys and values.

Parameters

  • batch_id(int) – Batch ID to query.

Returns

  • Batch information (JSON).

Return type

  • str

Example

  • http

  • curl

  • wget

  • httpie

  • python-requests

  • response

GET /feeder_gateway/get_batch_info?batch_id=5678 HTTP/1.1
Host: localhost:9413
Accept: application/json
curl -i -X GET 'https://localhost:9413/feeder_gateway/get_batch_info?batch_id=5678' -H "Accept: application/json"
wget -S -O- 'https://localhost:9413/feeder_gateway/get_batch_info?batch_id=5678' --header="Accept: application/json"
http 'https://localhost:9413/feeder_gateway/get_batch_info?batch_id=5678' Accept:application/json
requests.get('https://localhost:9413/feeder_gateway/get_batch_info?batch_id=5678', headers={'Accept': 'application/json'})
HTTP/1.1 200 OK
Content-Type: application/json

    {
        "order_root": {
            "height": 31,
            "root": "04695d9d13ec0eeafc07b7d0c5da3f30e42e468bc69413c2b77e62cd8cdeb9a8"
        },
        "prev_batch_id": 5677,
        "prev_order_root": {
            "height": 31,
            "root": "04695d9d13ec0eeafc07b7d0c5da3f30e42e468bc69413c2b77e62cd8cdeb9a8"
        },
        "prev_vault_root": {
            "height": 31,
            "root": "0075364111a7a336756626d19fc8ec8df6328a5e63681c68ffaa312f6bf98c5c"
        },
        "sequence_number": 1234,
        "time_created": 1614665098,
        "txs_info": [
            {
                "alt_txs": [],
                "original_tx": {
                    "amount": "1000",
                    "stark_key": "0x51ddea3f6955ab96cdbb24e2b88c7ce6e7d1afea354e41be88d9dca5c7f0651",
                    "token_id": "0x2dc6cb834b9f656f3366c0c263e75458a814074b165bc1661b7460e7c972759",
                    "type": "DepositRequest",
                    "vault_id": 931081472
                },
                "tx_id": 123456,
                "was_replaced": false
            }
        ],
        "vault_root": {
            "height": 31,
            "root": "00bc9d7b7716bc33b1db5b7509c0a076ab9424ba5e16dd26de8097a62f1ef1d1"
        }
    }

get_batch_info_version2

Get detailed batch information. See the response example for returned keys and values.

Parameters

  • batch_id(int) – Batch ID to query.

Returns

  • Batch information (JSON).

Return type

  • str

Example

  • http

  • curl

  • wget

  • httpie

  • python-requests

  • response

GET feeder_gateway/v2/get_batch_info?batch_id=5678 HTTP/1.1
Host: localhost:9413
Accept: application/json
curl -i -X GET 'https://localhost:9413feeder_gateway/v2/get_batch_info?batch_id=5678' -H "Accept: application/json"
wget -S -O- 'https://localhost:9413feeder_gateway/v2/get_batch_info?batch_id=5678' --header="Accept: application/json"
http 'https://localhost:9413feeder_gateway/v2/get_batch_info?batch_id=5678' Accept:application/json
requests.get('https://localhost:9413feeder_gateway/v2/get_batch_info?batch_id=5678', headers={'Accept': 'application/json'})
HTTP/1.1 200 OK
Content-Type: application/json

    {
        "prev_batch_id": 5677,
        "sequence_number": 1234,
        "time_created": 1614665098,
        "txs_info": [
            {
                "alt_txs": [],
                "original_tx": {
                    "amount": "1000",
                    "stark_key": "0x51ddea3f6955ab96cdbb24e2b88c7ce6e7d1afea354e41be88d9dca5c7f0651",
                    "token_id": "0x2dc6cb834b9f656f3366c0c263e75458a814074b165bc1661b7460e7c972759",
                    "type": "DepositRequest",
                    "vault_id": 931081472
                },
                "tx_id": 123456,
                "was_replaced": false
            }
        ]
    }

get_l1_blockchain_id

Returns the blockchain ID used by the system.

get_last_batch_id

Gets the last batch ID used by Starkex.

Returns

  • Last batch ID.

Return type

  • int

Example

  • http

  • curl

  • wget

  • httpie

  • python-requests

  • response

GET /feeder_gateway/v2/get_last_batch_id HTTP/1.1
Host: localhost:9413
Accept: application/json
curl -i -X GET https://localhost:9413/feeder_gateway/v2/get_last_batch_id -H "Accept: application/json"
wget -S -O- https://localhost:9413/feeder_gateway/v2/get_last_batch_id --header="Accept: application/json"
http https://localhost:9413/feeder_gateway/v2/get_last_batch_id Accept:application/json
requests.get('https://localhost:9413/feeder_gateway/v2/get_last_batch_id', headers={'Accept': 'application/json'})
HTTP/1.1 200 OK
Content-Type: application/json

5678

get_prev_batch_id

Get the previous batch ID for the input batch_id.

Parameters

  • batch_id(int) – Batch ID to query.

Returns

  • The previous batch ID.

Return type

  • int

Example

  • http

  • curl

  • wget

  • httpie

  • python-requests

  • response

GET /feeder_gateway/v2/get_prev_batch_id?batch_id=5678 HTTP/1.1
Host: localhost:9413
Accept: application/json
curl -i -X GET 'https://localhost:9413/feeder_gateway/v2/get_prev_batch_id?batch_id=5678' -H "Accept: application/json"
wget -S -O- 'https://localhost:9413/feeder_gateway/v2/get_prev_batch_id?batch_id=5678' --header="Accept: application/json"
http 'https://localhost:9413/feeder_gateway/v2/get_prev_batch_id?batch_id=5678' Accept:application/json
requests.get('https://localhost:9413/feeder_gateway/v2/get_prev_batch_id?batch_id=5678', headers={'Accept': 'application/json'})
HTTP/1.1 200 OK
Content-Type: application/json

5676

is_alive

is_ready