# Aleo RPC API

[![Website](https://img.shields.io/badge/docs-online-blue)](https://docs.leo.app/aleo-rpc-api) [![](https://img.shields.io/badge/status-ℹ-green)](https://status.leo.app/) [![](https://github.com/demox-labs/aleo-rpc/blob/testnetbeta/docs/https:/img.shields.io/badge/JSON%20RPC-2.0-orange)](https://www.jsonrpc.org/specification)

An RPC API made to enable more diverse use cases and support many DApps in the Aleo ecosystem. It is currently used to support the [Leo Wallet](https://leo.app) and follows the [JSON-RPC 2.0 specification.](https://www.jsonrpc.org/specification)

## Available methods

### 📚 Blocks

* [**latest/height**](/aleo-rpc-api/endpoints/blocks/latest_height.md) - Get latest block height.
* [**latest/hash**](/aleo-rpc-api/endpoints/blocks/latest_hash.md) - Get latest block hash.
* [**latest/block**](/aleo-rpc-api/endpoints/blocks/latest_block.md) - Get latest block details.
* [**getStateRoot**](/aleo-rpc-api/endpoints/blocks/getstateroot.md) - Get current state root.
* [**block**](/aleo-rpc-api/endpoints/blocks/block.md) - Get a specific block details.
* [**blocks**](/aleo-rpc-api/endpoints/blocks/blocks.md) - Get specific blocks details within a range of heights.
* [**getAleoBlocks**](/aleo-rpc-api/endpoints/blocks/getaleoblocks.md) - Get specific blocks full content within a range of heights.

### 💸 Transactions

* [**transaction**](/aleo-rpc-api/endpoints/transactions/transaction.md) - Get transaction details with a specific transaction ID.
* [**aleoTransaction**](/aleo-rpc-api/endpoints/transactions/aleotransaction.md) - Get transaction full content corresponding to a specific transaction ID.
* [**transactions**](/aleo-rpc-api/endpoints/transactions/transactions.md) - Get transactions details included in a specific block.
* [**getPublicTransactionsForAddress**](/aleo-rpc-api/endpoints/transactions/getpublictransactionsforaddress.md) - Get IDs of public transactions associated with a given address within a range of block heights.
* [**generateTransaction**](/aleo-rpc-api/endpoints/transactions/generatetransaction.md) - Delegate generation of a transaction proof by providing an authorization and transaction inputs.
* [**getGeneratedTransaction**](/aleo-rpc-api/endpoints/transactions/getgeneratedtransaction.md) - Get transaction generation job status, result, error message.

### 🔄 Transitions

* [**getTransactionId**](/aleo-rpc-api/endpoints/transitions/gettransactionid.md) - Get transaction ID from a transition ID.
* [**transitionsWithoutRecordInputs**](/aleo-rpc-api/endpoints/transitions/transitionswithoutrecordinputs.md) - Get details of transitions that do not have record inputs within a range of heights from Aleo blockchain.

### 📝 Records

* [**records/all**](/aleo-rpc-api/endpoints/records/records_all.md) - Get all records generated within a range of blocks from the server.
* [**records/isOwner**](/aleo-rpc-api/endpoints/records/records_isowner.md) - Get minimal information needed to verify ownership for records within a given block range on the Aleo blockchain.
* [**records/byTransitionAndIndex**](/aleo-rpc-api/endpoints/records/records_bytransitionandindex.md) - Get a specific record from id of transition where it got generarated and output index of it in this transition.
* [**serialNumbers**](/aleo-rpc-api/endpoints/records/serialnumbers.md) - Get information for a list of serial numbers.
* [**getStatePath**](/aleo-rpc-api/endpoints/records/getstatepath.md) - Get state path for a specific commitment.

### 📑 Programs

* [**program**](/aleo-rpc-api/endpoints/programs/program.md) - Get program source code corresponding to a specific program ID.
* [**getProgramTypes**](/aleo-rpc-api/endpoints/programs/getprogramtypes.md) - Get type of multiple programs from their IDs, ie: which standard they implement.
* [**transactionsForProgram**](/aleo-rpc-api/endpoints/programs/transactionsforprogram.md) - Get all transactions involving a specific program ID and function name.
* [**transactionsForProgramCount**](/aleo-rpc-api/endpoints/programs/transactionsforprogramcount.md) - Get the amount of transactions involving a specific program ID and function name.
* [**generateDeployment**](https://github.com/demox-labs/aleo-rpc/blob/testnetbeta/docs/endpoints/deploymentGeneration/generateDeployment.md) - Delegate proof generation of a program deployment.
* [**getGeneratedDeployment**](https://github.com/demox-labs/aleo-rpc/blob/testnetbeta/docs/endpoints/deploymentGeneration/getGeneratedDeployment.md) - Get deployment job status, result, error message.

### 🗺️ Mappings

* [**getMappingValue**](/aleo-rpc-api/endpoints/mappings/getmappingvalue.md) - Get value of a mapping at a specific key.

### 🎨 NFTs

* [**getPublicNFTsForAddress**](/aleo-rpc-api/endpoints/nfts/getpublicnftsforaddress.md) - Get public NFTs associated with a given address from Aleo blockchain.
* [**getPublicTokenProgramsForAddress**](/aleo-rpc-api/endpoints/nfts/getpublictokenprogramsforaddress.md) - Get all the IDs of token programs that an address interracted with publicly.

### 🏦 Staking

* [**getStakedBalanceForAddress**](/aleo-rpc-api/endpoints/staking/getstakedbalanceforaddress.md) - Get the amount of Aleo credits a specific address has staked.

### 📊 Status

* [**chainStatus**](/aleo-rpc-api/endpoints/status/chainstatus.md) - Get blockchain status details.

## Usage

### Call a method

Any method above can be called by submitting a `POST` HTTP request to the unique endpoint corresponding to desired network, as described in [JSON-RPC 2.0 specification.](https://www.jsonrpc.org/specification)

This request should include a body with the following structure:

```json
{ 
  "jsonrpc": "2.0", 
  "id": 1, 
  "method": "...",
  (optional) "params": [...]
}
```

#### Example

Here is an example of such a request using `curl` command line program:

```bash
curl \
  --request POST \
  --location 'https://testnet3.aleorpc.com' \
  --header 'Content-Type: application/json' \
  --data-raw '{ 
    "jsonrpc": "2.0", 
    "id": 1, 
    "method": "getHeight",
  }'
```

Which corresponding response is:

```bash
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": 1470801
}
```

## Networks

Networks supported by the API:

| Network      | RPC Endpoint URL                  |
| ------------ | --------------------------------- |
| Testnet 3    | `https://testnet3.aleorpc.com`    |
| Testnet Beta | `https://testnetbeta.aleorpc.com` |

Status of these endpoints is available on the [Official Leo Status Page.](https://status.leo.app)

## Disclaimer

This API is free to use but **rate limiting may be introduced** to prevent spamming at any point.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.leo.app/aleo-rpc-api/readme.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
