### Get Explorer Status (HTTP Request) Source: https://testnet.aleoscan.io/api/docs/status This snippet shows an example HTTP GET request to retrieve the basic status of the AleoScan explorer. It requires no specific inputs beyond the endpoint itself. The response will be a JSON object containing server time and block indexing information. ```http GET /v2/status HTTP/1.1 Host: api.aleoscan.io ``` -------------------------------- ### Get Address Staking Info - API Response Source: https://testnet.aleoscan.io/api/docs/address Example JSON response for the Address Staking Info API endpoint. It details the block height, timestamp, bonded amount in microcredits, and the validator address. ```JSON HTTP/1.1 200 OK Content-Type: application/json { "height": 1230000, "timestamp": 1712200000, "amount": 10000000000, "validator": "aleo1n6c5ugxk6tp09vkrjegcpcprssdfcf7283agcdtt8gu9qex2c5xs9c28ay" } ``` -------------------------------- ### Get Address Delegated Credits - API Response Source: https://testnet.aleoscan.io/api/docs/address Example JSON response for the Address Delegated Credits API endpoint. It shows the block height, timestamp, and the total amount of delegated credits in microcredits. ```JSON HTTP/1.1 200 OK Content-Type: application/json { "height": 1230000, "timestamp": 1712200000, "amount": 10000000000000 } ``` -------------------------------- ### Get Address Program ID - API Response Source: https://testnet.aleoscan.io/api/docs/address Example JSON response for the Address Program ID API endpoint. It returns the program ID as a string if the address is a program address. ```JSON HTTP/1.1 200 OK Content-Type: application/json "vlink_quest_v1.aleo" ``` -------------------------------- ### Simulate Finalize Execution Response (JSON) Source: https://testnet.aleoscan.io/api/docs/execute This is an example JSON response for a successful simulation of finalize execution. It details the mapping updates, including key, value, and type of change. This response structure is typical for the AleoScan API's simulation endpoints. ```json HTTP/1.1 200 OK Content-Type: application/json { "mapping_updates": [ { "key": "aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px", "key_id": "3735849869114892265786124913473029534128875410754308268945151169665323186552field", "mapping": "account", "mapping_id": "2855157744830843716005407030207142101853521493742120919939436395872133863104field", "type": "UpdateKeyValue", "value": "9827614u64", "value_id": "3266615198292033282950115883302413454228283640771489693608225349725511562527field" }, { "key": "aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px", "key_id": "3735849869114892265786124913473029534128875410754308268945151169665323186552field", "mapping": "account", "mapping_id": "2855157744830843716005407030207142101853521493742120919939436395872133863104field", "type": "UpdateKeyValue", "value": "10827614u64", "value_id": "4267214900870705622674540766849083498253831452142619194451382331686398522842field" } ] } ``` -------------------------------- ### Get Mapping Value - AleoScan API Source: https://testnet.aleoscan.io/api/docs/mapping Retrieves the value associated with a specific key in a program's mapping. Returns 'null' if the key does not exist. Handles '200 OK' for success and '404 Not Found' if the program or mapping is not found. Requires program ID, mapping ID, and key as parameters. ```http GET /v1/mapping/get_value/credits.aleo/account/aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px HTTP/1.1 Host: api.aleoscan.io ``` -------------------------------- ### Get Explorer Status (HTTP Response) Source: https://testnet.aleoscan.io/api/docs/status This snippet illustrates a successful HTTP response from the AleoScan Status API. It returns a JSON object with key details about the explorer's operational state, including server time, the latest indexed block height and timestamp, and the heights of connected snarkOS and reference nodes. ```http HTTP/1.1 200 OK Content-Type: application/json { "server_time": 1712200000, "latest_block_height": 1230000, "latest_block_timestamp": 1712200000, "node_height": 1234000, "reference_height": 1234001 } ``` -------------------------------- ### Get Mapping Key Count Source: https://testnet.aleoscan.io/api/docs/mapping Retrieves the total number of keys present in a specified mapping within a program. ```APIDOC ## GET /v2/mapping/get_key_count/(_program_id_)/(_mapping_id_) ### Description Get the number of keys in a mapping. ### Method GET ### Endpoint `/v2/mapping/get_key_count/{program_id}/{mapping_id}` ### Parameters #### Path Parameters - **program_id** (string) - Required - The ID of the program. - **mapping_id** (string) - Required - The name of the mapping. ### Request Example ``` GET /v2/mapping/get_key_count/credits.aleo/account HTTP/1.1 Host: api.aleoscan.io ``` ### Response #### Success Response (200) - **count** (integer) - The total number of keys in the mapping. #### Response Example ```json 115448 ``` ### Status Codes - 200 OK – no error - 404 Not Found – program / mapping not found ``` -------------------------------- ### Get Address Delegated Credits - API Request Source: https://testnet.aleoscan.io/api/docs/address This API endpoint fetches the amount of tokens delegated to a specific Aleo address. Similar to staking info, it allows historical queries by block height or time. The response includes the delegated amount in microcredits. ```HTTP GET /v2/address/delegated/aleo1sdjqhlcm9qltpu74ek0vxewt52zsdmn6swmpjn6m0tp9xf57dvpq740r8j HTTP/1.1 Host: api.aleoscan.io ``` -------------------------------- ### Get Address Staking Info - API Request Source: https://testnet.aleoscan.io/api/docs/address This API endpoint retrieves the staking information for a given Aleo address. It supports querying data at a specific block height or time. The response includes details such as the bonded amount and the validator the address is bonded to. It returns null if the address is not bonded. ```HTTP GET /v2/address/staking_info/aleo1sdjqhlcm9qltpu74ek0vxewt52zsdmn6swmpjn6m0tp9xf57dvpq740r8j HTTP/1.1 Host: api.aleoscan.io ``` -------------------------------- ### Get Address Program ID - API Request Source: https://testnet.aleoscan.io/api/docs/address This API endpoint retrieves the program ID associated with a given Aleo address, if the address is identified as a program address. It returns null if the address is not a program address. ```HTTP GET /v2/address/program_id/aleo12x4rzm2j56e9uknpy0dcglt32vfk9ujx9e0pl8x7sy77jjyx4cps5sp8hm HTTP/1.1 Host: api.aleoscan.io ``` -------------------------------- ### Get Mapping Key Count - AleoScan API Source: https://testnet.aleoscan.io/api/docs/mapping Retrieves the total number of keys present in a specified mapping. Returns a JSON number representing the count upon success ('200 OK'). Returns '404 Not Found' if the program or mapping is not found. Requires program ID and mapping ID as parameters. ```http GET /v2/mapping/get_key_count/credits.aleo/account HTTP/1.1 Host: api.aleoscan.io ``` -------------------------------- ### Get Mapping Value Source: https://testnet.aleoscan.io/api/docs/mapping Retrieves the value associated with a specific key in a given mapping within a program. Returns null if the key does not exist. Note that endpoints will refuse to return data if the node is not in sync with the network, unless the `?outdated=1` parameter is added. ```APIDOC ## GET /v1/mapping/get_value/(_program_id_)/(_mapping_id_)/(_key_) ### Description Get the mapping value, given the program ID, mapping name and key. Returns `null` if the key doesn’t exist in the mapping. ### Method GET ### Endpoint `/v1/mapping/get_value/{program_id}/{mapping_id}/{key}` ### Parameters #### Path Parameters - **program_id** (string) - Required - The ID of the program. - **mapping_id** (string) - Required - The name of the mapping. - **key** (string) - Required - The key to look up in the mapping. #### Query Parameters - **outdated** (integer) - Optional - Set to 1 to retrieve data even if the node is not in sync. Use with caution. ### Request Example ``` GET /v1/mapping/get_value/credits.aleo/account/aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px HTTP/1.1 Host: api.aleoscan.io ``` ### Response #### Success Response (200) - **value** (string) - The value associated with the key, or null if not found. #### Response Example ```json "30000000u64" ``` #### Error Response (404) - **error** (string) - Description of the error, e.g., "Mapping not found". #### Error Response Example ```json { "error": "Mapping not found" } ``` ### Status Codes - 200 OK – no error - 400 Bad Request – invalid mapping / key name - 404 Not Found – program / mapping not found ``` -------------------------------- ### List Mappings in Program - AleoScan API Source: https://testnet.aleoscan.io/api/docs/mapping Lists all available mappings within a specified program. Returns a JSON array of mapping names upon successful retrieval ('200 OK'). Returns '404 Not Found' if the program does not exist. Requires the program name as a parameter. ```http GET /v1/mapping/list_program_mappings/credits.aleo HTTP/1.1 Host: api.aleoscan.io ``` -------------------------------- ### Execute API Source: https://testnet.aleoscan.io/api/docs/index Allows for simulating the execution of Aleo program finalizations. ```APIDOC ## POST /api/v1/execute/finalize ### Description Simulates the finalization execution of an Aleo program. This endpoint is useful for testing and debugging program logic. ### Method POST ### Endpoint https://api.aleoscan.io/api/v1/execute/finalize ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **program_id** (string) - Required - The ID of the program to execute. - **function_name** (string) - Required - The name of the finalization function to call. - **inputs** (array) - Optional - An array of input arguments for the function. - **fee** (string) - Optional - The fee to be paid for the execution. ### Request Example ```json { "program_id": "my_program.aleo", "function_name": "finalize_transfer", "inputs": ["recipient_address", "amount"], "fee": "1000" } ``` ### Response #### Success Response (200) - **result** (string) - The result of the simulated execution. #### Response Example ```json { "result": "success" } ``` ``` -------------------------------- ### Mapping API Source: https://testnet.aleoscan.io/api/docs/index Endpoints for interacting with Aleo program mappings, allowing retrieval of mapping values, listing mappings, and counting keys. ```APIDOC ## GET /api/v1/program/{program_id}/mapping/{mapping_id}/value ### Description Retrieves the value for a specific key within a mapping in an Aleo program. ### Method GET ### Endpoint https://api.aleoscan.io/api/v1/program/{program_id}/mapping/{mapping_id}/value ### Parameters #### Path Parameters - **program_id** (string) - Required - The ID of the Aleo program. - **mapping_id** (string) - Required - The ID of the mapping within the program. #### Query Parameters - **key** (string) - Required - The key to look up in the mapping. ### Request Example None ### Response #### Success Response (200) - **value** (string) - The value associated with the provided key. #### Response Example ```json { "value": "some_value" } ``` ``` ```APIDOC ## GET /api/v1/program/{program_id}/mappings ### Description Lists all available mappings within a specified Aleo program. ### Method GET ### Endpoint https://api.aleoscan.io/api/v1/program/{program_id}/mappings ### Parameters #### Path Parameters - **program_id** (string) - Required - The ID of the Aleo program. #### Query Parameters None ### Request Example None ### Response #### Success Response (200) - **mappings** (array) - An array of mapping ID strings. #### Response Example ```json { "mappings": ["mapping1", "mapping2"] } ``` ``` ```APIDOC ## GET /api/v1/program/{program_id}/mapping/{mapping_id}/values ### Description Lists all key-value pairs within a specific mapping in an Aleo program. ### Method GET ### Endpoint https://api.aleoscan.io/api/v1/program/{program_id}/mapping/{mapping_id}/values ### Parameters #### Path Parameters - **program_id** (string) - Required - The ID of the Aleo program. - **mapping_id** (string) - Required - The ID of the mapping within the program. #### Query Parameters None ### Request Example None ### Response #### Success Response (200) - **entries** (array) - An array of objects, each containing a "key" and "value". #### Response Example ```json { "entries": [ {"key": "key1", "value": "value1"}, {"key": "key2", "value": "value2"} ] } ``` ``` ```APIDOC ## GET /api/v1/program/{program_id}/mapping/{mapping_id}/count ### Description Retrieves the total number of key-value entries within a specific mapping in an Aleo program. ### Method GET ### Endpoint https://api.aleoscan.io/api/v1/program/{program_id}/mapping/{mapping_id}/count ### Parameters #### Path Parameters - **program_id** (string) - Required - The ID of the Aleo program. - **mapping_id** (string) - Required - The ID of the mapping within the program. #### Query Parameters None ### Request Example None ### Response #### Success Response (200) - **count** (integer) - The number of entries in the mapping. #### Response Example ```json { "count": 150 } ``` ``` -------------------------------- ### List Mappings in Program Source: https://testnet.aleoscan.io/api/docs/mapping Lists all available mappings within a specified program. This endpoint is useful for discovering the mappings associated with a particular program. ```APIDOC ## GET /v1/mapping/list_program_mappings/(_program_name_) ### Description List all mappings in a program. ### Method GET ### Endpoint `/v1/mapping/list_program_mappings/{program_name}` ### Parameters #### Path Parameters - **program_name** (string) - Required - The name of the program. ### Request Example ``` GET /v1/mapping/list_program_mappings/credits.aleo HTTP/1.1 Host: api.aleoscan.io ``` ### Response #### Success Response (200) - **mappings** (list of strings) - A list of mapping names within the program. #### Response Example ```json [ "committee", "bonded", "unbonding", "account" ] ``` ### Status Codes - 200 OK – no error - 404 Not Found – program not found ``` -------------------------------- ### API Quota Information Source: https://testnet.aleoscan.io/api/docs/quota Details about the API quota system, including maximum quota, recovery rate, and how usage is calculated. ```APIDOC ## API Quota ### Description The explorer API uses a custom quota system to limit the total running time of requests to the API per IP address. This is to prevent abuse of the API and to ensure that the API is available to all users. The running time is counted by actual _wall time_ used by requests, and doesn’t include network latencies. Using wall time means the used time will depend on the server load. ### Quota Details - **Maximum Quota**: 5 seconds of running time per IP address. - **Recovery Rate**: 0.1 seconds per second. The quota recovers at this rate and caps at the maximum value. ### Response Headers Every API response will include the following HTTP headers: - `quota-max`: The maximum quota (currently 5 seconds). - `quota-recover-rate`: The quota recover rate in seconds per second (currently 0.1). - `quota-remaining`: The remaining quota in seconds after the current request. - `quota-used`: The used quota in seconds for the current request. ### Error Handling If a request takes longer than the allowed time, it will be interrupted and a `HTTP 429 Too Many Requests` response will be returned. #### `HTTP 429 Too Many Requests` Response Headers - `retry-after`: A recommended wait time, currently calculated with `1 / quota-recover-rate` which equals 10 seconds. ### Concurrent Request Impact To prevent abuse, the actual available quota for each request will decrease by 0.5 second for each additional _concurrent_ request. This means a request could time out while the returned headers indicate that there is still quota left. The quota system is implemented in the `APIQuotaMiddleware` middleware class. ``` -------------------------------- ### List All Values in Mapping - AleoScan API Source: https://testnet.aleoscan.io/api/docs/mapping Retrieves all key-value pairs within a specified mapping, supporting cursor-based pagination and an optional count parameter. The response includes a cursor for subsequent requests and a list of results. Handles '200 OK' for success and '404 Not Found' for non-existent programs or mappings. Note that 'count' may not be exact for certain mappings like 'credits.aleo/bonded' due to direct Redis querying. ```http GET /v2/mapping/list_program_mapping_values/credits.aleo/account?count=5 HTTP/1.1 Host: api.aleoscan.io ``` -------------------------------- ### API Version History Source: https://testnet.aleoscan.io/api/docs/version This section details the version history of the AleoScan API, outlining changes made in each version. ```APIDOC ## API Version History This page lists the changes made to the API since its initial release. The API uses sequential integer version numbers. The current version is v2. Some endpoints will change in backwards-incompatible ways between versions. The old version will be deprecated for a period of time before being removed. However, depending on the change, the old version might be removed immediately. ### v2 * Changed List All Values in Mapping to support pagination and used a simpler response format. * Added Get Mapping Key Count endpoint. * Added Get Status endpoint. * Added Address Staking Info / History endpoint. * Added Address Delegated Credits / History endpoint. * Added Address Program ID endpoint. ### v1 * Initial release. ``` -------------------------------- ### Simulate Finalize Execution Request (HTTP) Source: https://testnet.aleoscan.io/api/docs/execute This code snippet demonstrates a sample HTTP POST request to simulate finalize execution. It includes the necessary headers and a JSON payload specifying inputs, program ID, and transition name. Note that all executions are simulated and do not affect the real blockchain state. ```http POST /v1/simulate_execution/finalize HTTP/1.1 Host: api.aleoscan.io Content-Type: application/json { "inputs": [ "aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px", "aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px", "1000000u64" ], "program_id": "credits.aleo", "transition_name": "transfer_public" } ``` -------------------------------- ### Address API Source: https://testnet.aleoscan.io/api/docs/index Endpoints for retrieving detailed information about Aleo addresses, including staking and delegation history. ```APIDOC ## GET /api/v1/address/{address}/staking ### Description Retrieves the staking information and history for a given Aleo address. ### Method GET ### Endpoint https://api.aleoscan.io/api/v1/address/{address}/staking ### Parameters #### Path Parameters - **address** (string) - Required - The Aleo address to query. #### Query Parameters None ### Request Example None ### Response #### Success Response (200) - **total_staked** (string) - The total amount staked by the address. - **history** (array) - An array of staking transaction objects. #### Response Example ```json { "total_staked": "1000000", "history": [ { "tx_id": "tx123", "amount": "1000000", "timestamp": "2023-10-27T10:00:00Z" } ] } ``` ``` ```APIDOC ## GET /api/v1/address/{address}/delegated ### Description Retrieves the delegated credits information and history for a given Aleo address. ### Method GET ### Endpoint https://api.aleoscan.io/api/v1/address/{address}/delegated ### Parameters #### Path Parameters - **address** (string) - Required - The Aleo address to query. #### Query Parameters None ### Request Example None ### Response #### Success Response (200) - **total_delegated** (string) - The total amount of credits delegated by the address. - **history** (array) - An array of delegation transaction objects. #### Response Example ```json { "total_delegated": "500000", "history": [ { "tx_id": "tx456", "amount": "500000", "timestamp": "2023-10-27T11:00:00Z" } ] } ``` ``` ```APIDOC ## GET /api/v1/address/{address}/program_id ### Description Retrieves the program ID associated with a given Aleo address, if applicable. ### Method GET ### Endpoint https://api.aleoscan.io/api/v1/address/{address}/program_id ### Parameters #### Path Parameters - **address** (string) - Required - The Aleo address to query. #### Query Parameters None ### Request Example None ### Response #### Success Response (200) - **program_id** (string) - The program ID associated with the address. #### Response Example ```json { "program_id": "my_program.aleo" } ``` ``` -------------------------------- ### Status API Source: https://testnet.aleoscan.io/api/docs/index Provides information about the current status of the Aleo network and the AleoScan API. ```APIDOC ## GET /api/v1/status ### Description Retrieves the current status of the AleoScan API and the underlying Aleo network. ### Method GET ### Endpoint https://api.aleoscan.io/api/v1/status ### Parameters None ### Request Example None ### Response #### Success Response (200) - **status** (string) - The current status indicator (e.g., "ok", "degraded"). - **network** (string) - Information about the connected Aleo network. #### Response Example ```json { "status": "ok", "network": "testnet-3" } ``` ``` -------------------------------- ### List All Values in Mapping Source: https://testnet.aleoscan.io/api/docs/mapping Retrieves all key-value pairs within a specified mapping. This endpoint supports cursor-based pagination for handling large datasets. The `count` parameter can suggest the number of items per page, but is not guaranteed for certain mappings like `credits.aleo/bonded` or `credits.aleo/committee` due to direct Redis querying. ```APIDOC ## GET /v2/mapping/list_program_mapping_values/(_program_id_)/(_mapping_id_) ### Description List all values in a mapping. This endpoint uses cursor-based pagination. ### Method GET ### Endpoint `/v2/mapping/list_program_mapping_values/{program_id}/{mapping_id}` ### Parameters #### Path Parameters - **program_id** (string) - Required - The ID of the program. - **mapping_id** (string) - Required - The name of the mapping. #### Query Parameters - **count** (integer) - Optional - Number of values to return (default: 50, max: 100). Note: This count is not guaranteed for specific mappings. - **cursor** (integer) - Optional - Cursor for pagination. If not provided, the first page is returned. ### Request Example ``` GET /v2/mapping/list_program_mapping_values/credits.aleo/account?count=5 HTTP/1.1 Host: api.aleoscan.io ``` ### Response #### Success Response (200) - **cursor** (integer) - Cursor for pagination. Use this value in the next request to get the subsequent page. - **result** (list of objects) - A list of key-value pairs. - **key** (string) - The key in the mapping. - **value** (string) - The value associated with the key. #### Response Example ```json { "cursor": 9373984, "result": [ { "key": "aleo1ldtk5svxnglkcd59j5uf5n4uj6mtaavg03tqtsvvhpd3mr889vyqvh8wnp", "value": "50000000u64" }, { "key": "aleo1qu6umh5uan0gflqn68vdhg7pstnge08ndza5p6fkqfva4vsjjqrq2avdhg", "value": "50000000u64" }, { "key": "aleo134d0lzxadftpkscc2slxaff36pwjd2fx46ayfkcn8jng658hvqxscrhgyz", "value": "50000000u64" }, { "key": "aleo1kex2vdc7565r6c8y4078ytyvcyq9gcl0lflp2kqqz4f2u3su9u9qvyyqhw", "value": "50000000u64" }, { "key": "aleo1fa7m2dac84nd5r86l9thsfl6sfwtayv32naav38n8yud2exuqc9su3c5py", "value": "50000000u64" } ] } ``` ### Status Codes - 200 OK – no error - 404 Not Found – program / mapping not found ``` -------------------------------- ### Status API Source: https://testnet.aleoscan.io/api/docs/status Retrieve the current status of the AleoScan explorer, including server time, block heights, and node synchronization information. ```APIDOC ## GET /v2/status ### Description Returns the status of the explorer, including server time, latest block height, and node synchronization status. ### Method GET ### Endpoint /v2/status ### Parameters #### Query Parameters None #### Request Body None ### Request Example ``` GET /v2/status HTTP/1.1 Host: api.aleoscan.io ``` ### Response #### Success Response (200) - **server_time** (integer) – server time in epoch. - **latest_block_height** (integer) – latest block height indexed. - **latest_block_timestamp** (integer) – timestamp of the latest block indexed. - **node_height** (integer) – height of the snarkOS node the explorer is connected to. - **reference_height** (integer) – height of the reference node configured by the explorer. #### Response Example ```json { "server_time": 1712200000, "latest_block_height": 1230000, "latest_block_timestamp": 1712200000, "node_height": 1234000, "reference_height": 1234001 } ``` ``` -------------------------------- ### Address Staking Info / History Source: https://testnet.aleoscan.io/api/docs/address Retrieves the staking information for a given Aleo address, optionally at a specific block height or time. Returns null if the address is not bonded. ```APIDOC ## GET /v2/address/staking_info/(_address_) ### Description Get the staking info of an address, now or at specific time in the past. Returns `null` if the address is not bonded. ### Method GET ### Endpoint /v2/address/staking_info/(_address_) ### Parameters #### Query Parameters - **height** (integer) - Optional - Retrieve data at a specific block height. Mutually exclusive with `time`. - **time** (integer or string) - Optional - Retrieve data at a specific time. Accepts a number as unix epoch, or a string in ISO 8601 format. Mutually exclusive with `height`. ### Response #### Success Response (200) - **height** (integer) - Block height of the data. - **timestamp** (integer) - Block timestamp. - **amount** (integer) - Bonded amount of the address in microcredits. - **validator** (string) - Validator the address is / was bonded to. #### Response Example ```json { "height": 1230000, "timestamp": 1712200000, "amount": 10000000000, "validator": "aleo1n6c5ugxk6tp09vkrjegcpcprssdfcf7283agcdtt8gu9qex2c5xs9c28ay" } ``` #### Status Codes - 200 OK – no error - 400 Bad Request – invalid parameter or combination - 404 Not Found – time or height is before the genesis block ``` -------------------------------- ### Address Delegated Credits / History Source: https://testnet.aleoscan.io/api/docs/address Retrieves the amount of tokens delegated to a given Aleo address, optionally at a specific block height or time. Returns null if no tokens are delegated. ```APIDOC ## GET /v2/address/delegated/(_address_) ### Description Get the amount of tokens delegated to the address, now or at specific time in the past. Returns `null` if no tokens are delegated to the address. ### Method GET ### Endpoint /v2/address/delegated/(_address_) ### Parameters #### Query Parameters - **height** (integer) - Optional - Retrieve data at a specific block height. Mutually exclusive with `time`. - **time** (integer or string) - Optional - Retrieve data at a specific time. Accepts a number as unix epoch, or a string in ISO 8601 format. Mutually exclusive with `height`. ### Response #### Success Response (200) - **height** (integer) - Block height of the data. - **timestamp** (integer) - Block timestamp. - **amount** (integer) - Delegated amount of the address in microcredits. #### Response Example ```json { "height": 1230000, "timestamp": 1712200000, "amount": 10000000000000 } ``` #### Status Codes - 200 OK – no error - 400 Bad Request – invalid parameter or combination - 404 Not Found – time or height is before the genesis block ``` -------------------------------- ### POST /v1/simulate_execution/finalize Source: https://testnet.aleoscan.io/api/docs/execute Simulates the finalization of an execution. Please note that these simulations are not real executions and may differ from on-chain results, especially for programs relying on on-chain state or random commands. The APIs are experimental and subject to change. ```APIDOC ## POST /v1/simulate_execution/finalize ### Description Simulates the finalization of an execution. ### Method POST ### Endpoint /v1/simulate_execution/finalize ### Parameters #### Request Body - **inputs** (array) - Required - An array of inputs for the execution. - **program_id** (string) - Required - The ID of the program to execute. - **transition_name** (string) - Required - The name of the transition to execute. ### Request Example ```json { "inputs": [ "aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px", "aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px", "1000000u64" ], "program_id": "credits.aleo", "transition_name": "transfer_public" } ``` ### Response #### Success Response (200) - **mapping_updates** (array) - An array of mapping updates resulting from the execution. - **key** (string) - The key in the mapping. - **key_id** (string) - The ID of the key. - **mapping** (string) - The name of the mapping. - **mapping_id** (string) - The ID of the mapping. - **type** (string) - The type of update. - **value** (string) - The updated value. - **value_id** (string) - The ID of the value. #### Response Example ```json { "mapping_updates": [ { "key": "aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px", "key_id": "3735849869114892265786124913473029534128875410754308268945151169665323186552field", "mapping": "account", "mapping_id": "2855157744830843716005407030207142101853521493742120919939436395872133863104field", "type": "UpdateKeyValue", "value": "9827614u64", "value_id": "3266615198292033282950115883302413454228283640771489693608225349725511562527field" }, { "key": "aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px", "key_id": "3735849869114892265786124913473029534128875410754308268945151169665323186552field", "mapping": "account", "mapping_id": "2855157744830843716005407030207142101853521493742120919939436395872133863104field", "type": "UpdateKeyValue", "value": "10827614u64", "value_id": "4267214900870705622674540766849083498253831452142619194451382331686398522842field" } ] } ``` ### Status Codes - 200 OK – no error - 400 Bad Request – wrong input parameter - 404 Not Found – program or transition not found - 500 Internal Server Error – internal server error ``` -------------------------------- ### Address Program ID Source: https://testnet.aleoscan.io/api/docs/address Retrieves the program ID of an address if it is a program address. Returns null if the address is not a program address. ```APIDOC ## GET /v2/address/program_id/(_address_) ### Description Get the program ID of an address, if it is a program address. Returns `null` if the address is not a program address. ### Method GET ### Endpoint /v2/address/program_id/(_address_) ### Response #### Success Response (200) - **response** (string) - The program ID of the address. #### Response Example ```json "vlink_quest_v1.aleo" ``` #### Status Codes - 200 OK – no error - 400 Bad Request – invalid parameter ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.