# 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-%E2%84%B9-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**](https://docs.leo.app/aleo-rpc-api/endpoints/blocks/latest_height) - Get latest block height.
* [**latest/hash**](https://docs.leo.app/aleo-rpc-api/endpoints/blocks/latest_hash) - Get latest block hash.
* [**latest/block**](https://docs.leo.app/aleo-rpc-api/endpoints/blocks/latest_block) - Get latest block details.
* [**getStateRoot**](https://docs.leo.app/aleo-rpc-api/endpoints/blocks/getstateroot) - Get current state root.
* [**block**](https://docs.leo.app/aleo-rpc-api/endpoints/blocks/block) - Get a specific block details.
* [**blocks**](https://docs.leo.app/aleo-rpc-api/endpoints/blocks/blocks) - Get specific blocks details within a range of heights.
* [**getAleoBlocks**](https://docs.leo.app/aleo-rpc-api/endpoints/blocks/getaleoblocks) - Get specific blocks full content within a range of heights.

### 💸 Transactions

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

### 🔄 Transitions

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

### 📝 Records

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

### 📑 Programs

* [**program**](https://docs.leo.app/aleo-rpc-api/endpoints/programs/program) - Get program source code corresponding to a specific program ID.
* [**getProgramTypes**](https://docs.leo.app/aleo-rpc-api/endpoints/programs/getprogramtypes) - Get type of multiple programs from their IDs, ie: which standard they implement.
* [**transactionsForProgram**](https://docs.leo.app/aleo-rpc-api/endpoints/programs/transactionsforprogram) - Get all transactions involving a specific program ID and function name.
* [**transactionsForProgramCount**](https://docs.leo.app/aleo-rpc-api/endpoints/programs/transactionsforprogramcount) - 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**](https://docs.leo.app/aleo-rpc-api/endpoints/mappings/getmappingvalue) - Get value of a mapping at a specific key.

### 🎨 NFTs

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

### 🏦 Staking

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

### 📊 Status

* [**chainStatus**](https://docs.leo.app/aleo-rpc-api/endpoints/status/chainstatus) - 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.
