Availability Gateway
This is the StarkEx Services HTTP gateway for committee interactions.
approve_new_roots
Process committee signature for a batch.
Parameters
-
data
– Committee signature data in message body (CommitteeSignature
)
Returns
-
Acknowledgement.
Return type
-
str
Example
-
http
-
curl
-
wget
-
httpie
-
python-requests
-
response
POST /availability_gateway/approve_new_roots HTTP/1.1
Host: localhost:9414
Accept: application/json
{"batch_id": 5678, "signature": "0x1256a4d7d152a0aafa2b75eb06eddbd0abb5621572fd4292",
"member_key": "0xb2849CBc25853685bfc4815Ab51d28E810606A48",
"claim_hash": "0x476a9f237758279caadaa21ecadd0126fe7ae99eb5c41b7cfdf1f42fd63db577"}
curl -i -X POST https://localhost:9414/availability_gateway/approve_new_roots -H "Accept: application/json" --data-raw '{"batch_id": 5678, "signature": "0x1256a4d7d152a0aafa2b75eb06eddbd0abb5621572fd4292",
"member_key": "0xb2849CBc25853685bfc4815Ab51d28E810606A48",
"claim_hash": "0x476a9f237758279caadaa21ecadd0126fe7ae99eb5c41b7cfdf1f42fd63db577"}'
wget -S -O- https://localhost:9414/availability_gateway/approve_new_roots --header="Accept: application/json" --post-data='{"batch_id": 5678, "signature": "0x1256a4d7d152a0aafa2b75eb06eddbd0abb5621572fd4292",
"member_key": "0xb2849CBc25853685bfc4815Ab51d28E810606A48",
"claim_hash": "0x476a9f237758279caadaa21ecadd0126fe7ae99eb5c41b7cfdf1f42fd63db577"}'
echo '{"batch_id": 5678, "signature": "0x1256a4d7d152a0aafa2b75eb06eddbd0abb5621572fd4292",
"member_key": "0xb2849CBc25853685bfc4815Ab51d28E810606A48",
"claim_hash": "0x476a9f237758279caadaa21ecadd0126fe7ae99eb5c41b7cfdf1f42fd63db577"}' | http POST https://localhost:9414/availability_gateway/approve_new_roots Accept:application/json
requests.post('https://localhost:9414/availability_gateway/approve_new_roots', headers={'Accept': 'application/json'}, data='{"batch_id": 5678, "signature": "0x1256a4d7d152a0aafa2b75eb06eddbd0abb5621572fd4292",\r\n\n "member_key": "0xb2849CBc25853685bfc4815Ab51d28E810606A48",\r\n\n "claim_hash": "0x476a9f237758279caadaa21ecadd0126fe7ae99eb5c41b7cfdf1f42fd63db577"}')
HTTP/1.1 200 OK
Content-Type: application/str
signature accepted
get_batch_data
Get the data availability information for a specific batch.
The availability information includes the ID of the previous batch in chronological order and the list of tree leaves (Validium vaults tree and orders tree) that were modified in the requested batch.
If validate_rollup is set to True, the list of rollup vault tree leaves that were modified is also returned. prev_batch_id of -1 indicates that there is no previous state.
Note that prev_batch_id might differ from batch_id - 1. This happens when a previously submitted batch is rejected onchain.
Parameters
-
batch_id
(int) – Batch ID to query. -
validate_rollup
(bool) – Boolean string (either “True” or “False”) indicating whether or not to respond with rollup vault modification data.
Returns
-
Batch information (
StateUpdate
)
Example
-
http
-
curl
-
wget
-
httpie
-
python-requests
-
response
GET /availability_gateway/get_batch_data?batch_id=5678&validate_rollup=True HTTP/1.1
Host: localhost:9414
Accept: application/json
curl -i -X GET 'https://localhost:9414/availability_gateway/get_batch_data?batch_id=5678&validate_rollup=True' -H "Accept: application/json"
wget -S -O- 'https://localhost:9414/availability_gateway/get_batch_data?batch_id=5678&validate_rollup=True' --header="Accept: application/json"
http 'https://localhost:9414/availability_gateway/get_batch_data?batch_id=5678&validate_rollup=True' Accept:application/json
requests.get('https://localhost:9414/availability_gateway/get_batch_data?batch_id=5678&validate_rollup=True', headers={'Accept': 'application/json'})
HTTP/1.1 200 OK
Content-Type: application/json
{
"update": {
"order_root": "000AB5B4CE84EB13D24D4DC89BC96BA10756A91CF180BE92E015F7941D7E",
"orders": {
"54850": {
"fulfilled_amount": "845"
},
"54851": {
"fulfilled_amount": "1975"
}
},
"prev_batch_id": 5677,
"rollup_vault_root": "DEADBEEF",
"rollup_vaults": {
"9223372037023444327": {
"balance": "9",
"stark_key": "0x1234",
"token": "0x5678"
}
},
"vault_root": "037912467B7B3CC02DEEC7B56829E3AE494B8D96F4E79D6CA7CC766C64D1",
"vaults": {
"168668519": {
"balance": "300",
"stark_key": "0xc35327b2be68ae537e02f0d16dd81cf6baac5e02ba28d0342ec8e",
"token": "0x31e95e8dc9447dfb706f0dfa2d8243c832de7d8da4edd87aa8f3f0008"
},
"694774812": {
"balance": "1000",
"stark_key": "0x7c5a4b3c65e46bc7b7b1e5dce60b5b5c56d9429f27acf53ec45b9",
"token": "0x31e95e8dc9447dfb706f0dfa2d8243c832de7d8da4edd87aa8f3f0008"
}
}
}
}
-
More about Validium on StarkWare’s site.
get_blockchain_type
API to query on which blockchain the system is based on. Starknet or Ethereum.
Returns
-
Type of the blockchain.
CommitteeSignature
The information describing a committee signature.
Parameters
-
batch_id
(int) – ID of signed batch. -
signature
(Union[str_,_SignatureOverStarknet]) – Committee signature for the batch. -
member_key
(str) – Committee member address used for identification. -
claim_hash
(str) – Claim hash being signed used for validating the expected claim.
StateUpdateVersion2
The information describing a state update with volition. Includes both Validium and rollup updates and tree roots; Validium updates/root is still referred to as ‘vaults’/’vault_root’ for backwards compatability.
Parameters
-
rollup_vaults
(dict) – Dictionary mapping vault_id to vault state. -
rollup_vault_root
(str) – expected rollup vault root after update (hex str without prefix).
VaultState
Vault state.
Parameters
-
stark_key
(int) – Public key of the party as registered on the StarkEx contract. -
token
(int) – Unique token ID as registered on the StarkEx contract. -
balance
(int) – Vault balance.