# Welcome

Welcome to the official documentation for [FireAcademy.io](https://fireacademy.io/)!

We're a company that currently provides Chia full node RPC access. Our infrastructure is open-source and can be found on [GitHub](https://github.com/fireacademy).

If you still have questions after reading this resource, do not hesitate to [contact us](/contact-us).


# Grants

The FireAcademy.io Grant Program

We understand how hard it is to build the Chia ecosystem. One time, we [shut down everything for a month](https://twitter.com/fireacademyio/status/1583590565803065344) to save some money. We've applied to the Chia Cultivation Grant Program (can you see us [here](https://www.chia.net/grants/)? exactly.). We're trying to 'make it' in the Chia ecosystem right now.

With this in mind, we created the FireAcademy.io Grant Program to support fellow teams or individual developers that want to build something in the Chia ecosystem.

## What is being offered?

Free credits for our service. Recipients will receive one or more gift codes that they can redeem for free credits. This way, they will be able to use our service for free, without even entering their credit card details. Recipients might ask for more free credits as needed.

## What is being asked for in return?

Cooperation. Alpha. We're growing with the ecosystem - when you win, we win. We want to hear about your project, and even your ambitions and aspirations if you are willing to share them. Feedback regarding our platform is always more than welcome.&#x20;

## Who can apply?

Anyone building or running a project on the Chia blockchain on a budget. Our requirements are very flexible - as a rule of thumb, if your project is about to be launched or you ran out of free credits, you can just contact us. Projects that have already been launched are also highly encouraged to apply if they want to integrate with our service.

## How to apply?

Decided to apply? That's great! This 'company' is currently ran by one person, so there's no need to be formal or present a 100-page proposal. Just drop [yakuh1t0](https://twitter.com/yakuh1t0) a message explaining what you're building. If you prefer another communication channel, see the [Contact Us ](/contact-us)page.

An estimate of your weekly or monthly requests would be greatly appreciated, but is not needed.


# Basic Concepts

## Chia

The best blockchain in existence. Find out more: <https://www.chia.net/>

## RPC

[Remote Procedure Call](https://en.wikipedia.org/wiki/Remote_procedure_call)

The official Chia node exposes some RPCs that can be used to query information about the blockchain. [FireAcademy.io](https://fireacademy.io) offers access to full node RPCs, which provide a way of getting information about blocks, coins, mempool transactions, and much more.

Find out more: <https://docs.chia.net/rpc/>

## API Keys

API keys are our way of identifying users and tracking how much credits they use. You are free to use API keys as you see fit, but we recommend having one API key per app domain.

## Credits

Each request to Leaflet consumes a preset amount of credits (420) from the API key owner's account. Credits are billed each week at a known rate ($1 = 4,200,000 credits).

One could think of our credit system as an abstraction layer. Instead of billing for the number of requests made to Leaflet, we chose to go this route to make future product integrations easier.

Something very important to mention is that credits can also be obtained via gift codes, which can be given at the discretion of the almighty admin (also see: [grants](/grants)).

Fun fact: Credits were formerly known as 'traffic' on our old platform, which generated a lot of confusion.


# Pricing

Please take a seat - it's time to talk about money.

<figure><img src="https://3451684478-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYGfRvkWH46FPzusrEuli%2Fuploads%2FVrAv0KYtsAySVSPhGJ7a%2Fimage.png?alt=media&amp;token=a66f2155-290c-43e3-b23a-b9e6bd74c1b6" alt=""><figcaption><p>Current price, as reflected by our landing page</p></figcaption></figure>

We're constantly striving to offer the greatest possible value to the Chia community. With that in mind, we created 3 tiers for different types of customers:

* **Free:** This plan is intended for projects that are just starting out or require a low number of interactions with our services. This category also includes the 'No Card' plan - it has the same specifications as the Free plan, except that extra credits cannot be purchased. It is also a great way to test our services without making any commitments.
* **Developer:** For teams of all sizes that require some interactions with our service. Maybe they're developing a dApp that got really popular. Or maybe they are indexing the Chia blockchain. Whatever it is, we've got them covered.
* **Enterprise:** For teams that require a lot of interactions with the services that we offer. At this scale, we are more than surely going to increase the number of stand-by nodes in our cluster. Creating and managing an organization-specific cluster is also an option.

## Current Prices

We want to make pricing as predictable and transparent as possible. With that in mind, please find the current price table [here](https://github.com/fireacademy/prices). It is important to keep in mind that it might change as we optimize our infrastructure or discover bottlenecks.


# FAQ

## How do I sign up for an Enterprise plan?

We're dedicated in meeting all of our clients' needs. The Enterprise plan is perfect for customers with specific needs - whether you need a limit of 100,000 API keys, a lot of traffic each month, or lower prices for extra credits, we can create a plan that is taylored to your needs. Please [contact us ](/contact-us)directly to sign up or ask any questions about our offering.

## I'm having trouble with the dashboard.

Take a look at the ['dashboard' section](/dashboard/creating-an-api-key) of this site and, if it doesn't help, just [contact us](/contact-us).

## I'm having trouble using one of your APIs.

Take a look at the ['developers' section](/developers/using-api-keys) of this site and, if it doesn't help, just [contact us](/contact-us).

## Why should I trust you with my credit card details?

You shouldn't. FireAcademy.io uses Stripe for billing - we don't handle the data and risk being banned if we do something fishy. Also, you can find out where I leave pretty easily.

## Don't you care about decentralization?

We do - that's why we chose the Chia blockchain in the first place! We do think, however, that an Infura-like provider will exist anyway for a variety of reasons. But we are committed to doing it the 'right way': everything that powers our service is open-source and we can help you configure your own cluster any time.&#x20;

## Open-source?

Yes! You can find our repositories on [GitHub](https://github.com/fireacademy).


# Creating an API Key

API keys can be created by pressing the 'Generate' button of the 'API Keys' section in the [FireAcademy.io Dashboard](https://dashboard.fireacademy.io). When creating an API key, you will be asked for 3 things:

## Name

The name is something that is only visible to you. It is intended to help you distinguish between different API keys. To avoid confusion, it is highly recommended that you use a suggestive name.

## Origin

This is a [CORS](https://en.wikipedia.org/wiki/Cross-origin_resource_sharing)-related parameter. Default is `*`.

## Monthly Credit Limit

Through this parameter, you can control how many credits an API key is allowed to use each billing cycle (month). API keys whose usage reached this limit will be considered invalid until the next week. Default is 0, which means that the key has no credit limit.


# Editing an API Key

API keys can be modified by using the 'Modify' button from the corresponding entry in the 'API Keys' section of the [FireAcademy.io Dashboard](https://dashboard.fireacademy.io). When modifying an API key, you will be allowed to change 4 fields:

## Name

The name is something that is only visible to you. It is intended to help you distinguish between different API keys. To avoid confusion, it is highly recommended that you use a suggestive name.

## Origin

This is a [CORS](https://en.wikipedia.org/wiki/Cross-origin_resource_sharing)-related parameter. Default is `*`.

## Monthly Credit Limit

Through this parameter, you can control how many credits an API key is allowed to use each billing cycle (month). API keys whose usage reached this limit will be considered invalid until the next week. Default is 0, which means that the key has no credit limit.

## Status

If you would like to invalidate an API key (the closest you can get to deleting it), you can set the status to 'Disabled'. This will cause catchpole to reject all requests that use the given key.


# Redeeming a Gift Code

Who doesn't enjoy gifts?

Once logged in to the [FireAcademy.io Dashboard](https://dashboard.fireacademy.io), you can redeem gift codes by pressing on the drop-down showing your email address in the upper righ corner of the page and selecting 'Use Gift Code'. When redeeming a gift code, you will be asked to provide 1 things:

## Gift Code

The code that you want to redeem. This is an UUIDv4 string and should look something like this:

> 405dc08f-d6ce-4b44-b7ea-98770104eaac

## A Note About Credit Expirations

Credits redeemed though a gift code expire at the end of your current billing cycle, which is shown on the dashboard.


# Using API Keys

catchpole has 3 different ways of getting an API key from a request. They are listed below based on priority - if the first one fails, the second one is tried, then the third one.

```go
func getAPIKeyForRequest(c *fiber.Ctx) string {
    api_key := c.Params("api_key")
    if api_key == "" {
        api_key = c.Get("X-API-Key")
    }
    if api_key == "" {
        api_key = c.Query("api-key")
    }

    return api_key
}
```

Note: We'll be using `1a7d0060-2d5a-473d-a8aa-a2cb0c277a31` as an example API key. Replace this with the API key from your dashboard.

## Parameters

In our original release, API keys were included in the url. This worked extremely well - users could migrate to FireAcademy by just changing the base URL of their full nodes and removing certificate auth. We decided to keep this feature in the current release.

To use this method, just include your API key in the requested URL, between the domain and `leaflet`: `https://kraken.fireacademy.io/[api_key]/leaflet/[endpoint]`.

curl snippet:

```bash
curl https://kraken.fireacademy.io/1a7d0060-2d5a-473d-a8aa-a2cb0c277a31/leaflet/get_blockchain_state
```

## Headers

You can also include your API key as the value of a custom header, `X-API-Key`. Note that the header name is NOT case sensitive.

curl snipper:

```bash
curl -H 'X-API-Key: 1a7d0060-2d5a-473d-a8aa-a2cb0c277a31' https://kraken.fireacademy.io/leaflet/get_blockchain_state
```

## GET Query

Ironically, this method also works for POST requests. Just add an `api-key` query to the end of your request (`?api-key=YOUR-API-KEY`). Please note that the name is case-sensitive.

curl snipper:

```bash
curl -X POST 'https://kraken.fireacademy.io/leaflet/get_blockchain_state?api-key=1a7d0060-2d5a-473d-a8aa-a2cb0c277a31'
```


# Leaflet

The up-to-date source code for Leaflet can be found [here](https://github.com/fireacademy/leaflet). On a high level, Leaflet is just a proxy that takes incoming HTTP endpoints, 'wraps' them with the right certificates, sends them to the Chia full node, and returns the response. It also has a readiness check endpoint on `/ready`.

Any POST request to Leaflet's port (18444) will be treated as one that needs to be proxied to the Chia full node RPC.

## FireAcademy.io

Leaflet can be accessed at `https://kraken.fireacademy.io/leaflet/` or `https://kraken.fireacademy.io/{api-key}/leaflet/`. Each request has a different, static cost - please see [this page](/pricing) for more information, including a list of the allowed endpoints.


# Leaflet (testnet10)

FireAcademy.io also provides a testnet10 instance for testing. It is equipped with the latest version of Leaflet.

Leaflet (testnet10) can be accessed at `https://kraken.fireacademy.io/leaflet-testnet10/` or `https://kraken.fireacademy.io/{api-key}/leaflet-testnet10/`. Each request has a different, static cost - please see [this page](/pricing) for more information, including a list of the allowed endpoints.


# Dashboard API

The dashboard API can be accessed by anyone. Its source code can be found[ here](https://github.com/FireAcademy/data-dude/blob/master/dashboard_api.go). Keep in mind that all requests need to have the `Authorization` header set to the Firebase authentication token of the user (no preceding `Bearer` ). All requests should use JSON encoding. The base URL for this API is `https://kraken.fireacademy.io/api`.

The following endpoints are exposed:

* `GET /stripe-dashboard-url` - Get the stripe dashboard URL for the logged in user.
* `GET /subscribe-url` - Get an URL that will allow the user to subscribe to a plan (given by the `plan_id` argument)
* `POST /user-plan` - Updates the user plan - upgrade or just switch auto-purchase of credit packages.
* `GET /dashboard-data` - Returns information about the user, their plan & API keys.
* `POST /api-key` - Creates an API key. Arguments: `name`, `origin`, `monthly_credit_limit`.
* `PUT /api-key` - Certainly a very good use for the `PUT` HTTP verb. Updates an existing API key. Takes the following arguments: `api_key`, `disabled`, `monthly_credit_limit`, `name`, `origin`.
* `POST /gift-code` - Redeems a gift code. Takes 2 arguments: `code` and `api_key`.
* `POST /ticket` - Creates a new ticket - intended for the 'Feedback and Ideas Form.' The endpoints expects 4 arguments: `message`, `emotional_state`, `anonymous`, and `contact`.
* `GET /updates` - Returns unread updates for the logged in user.
* `POST /updates` - Marks all updates as read.
* `GET /plans` - Returns a user's available plans, including custom ones.


# Beta API

The Beta API is in... beta.

***Note:** The Beta API is currently disabled for some much-needed updates. If you need to use it, please* [*contact us*](/contact-us)*.*

Beta currently offers information about singletons.&#x20;

## FireAcademy.io

Leaflet can be acessed at `https://kraken.fireacademy.io/beta/` or `https://kraken.fireacademy.io/{api-key}/beta/`. Billing is based on the number of returned results, with each result costing 42 credits. Each request consumes at least 42 credits:&#x20;

`request_cost = 42 * max(num_results, 1)`

## API

For a better experience, please refer to [this generated page](https://app.swaggerhub.com/apis-docs/Yakuhito/BetaAPI/1.0).

### Puzzles

Wondering what's hidden behind a singleton's inner puzzle hash? Use this endpoint to find out!

{% openapi src="/files/RuyIMJ5jtTw8WzDulEaO" path="/get\_puzzle" method="post" expanded="true" %}
[swagger.yaml](https://3451684478-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYGfRvkWH46FPzusrEuli%2Fuploads%2FKnHY6xdYVDkw1Gnzdilz%2Fswagger.yaml?alt=media\&token=8212e6ad-5b5a-49cf-b210-51a31b818e43)
{% endopenapi %}

### Singleton States

The reason Beta was invented.

{% openapi src="/files/RuyIMJ5jtTw8WzDulEaO" path="/get\_singleton\_states" method="post" expanded="false" %}
[swagger.yaml](https://3451684478-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYGfRvkWH46FPzusrEuli%2Fuploads%2FKnHY6xdYVDkw1Gnzdilz%2Fswagger.yaml?alt=media\&token=8212e6ad-5b5a-49cf-b210-51a31b818e43)
{% endopenapi %}

### Sync

Is Beta up-to-date or a trillion blocks behind?

**Warning**: Not suitable for heptapods.

{% openapi src="/files/RuyIMJ5jtTw8WzDulEaO" path="/get\_peak\_synced\_block" method="get" %}
[swagger.yaml](https://3451684478-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYGfRvkWH46FPzusrEuli%2Fuploads%2FKnHY6xdYVDkw1Gnzdilz%2Fswagger.yaml?alt=media\&token=8212e6ad-5b5a-49cf-b210-51a31b818e43)
{% endopenapi %}

{% openapi src="/files/RuyIMJ5jtTw8WzDulEaO" path="/get\_peak\_synced\_block" method="post" %}
[swagger.yaml](https://3451684478-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYGfRvkWH46FPzusrEuli%2Fuploads%2FKnHY6xdYVDkw1Gnzdilz%2Fswagger.yaml?alt=media\&token=8212e6ad-5b5a-49cf-b210-51a31b818e43)
{% endopenapi %}

{% openapi src="/files/RuyIMJ5jtTw8WzDulEaO" path="/get\_synced\_block" method="post" %}
[swagger.yaml](https://3451684478-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYGfRvkWH46FPzusrEuli%2Fuploads%2FKnHY6xdYVDkw1Gnzdilz%2Fswagger.yaml?alt=media\&token=8212e6ad-5b5a-49cf-b210-51a31b818e43)
{% endopenapi %}

{% openapi src="/files/RuyIMJ5jtTw8WzDulEaO" path="/get\_synced\_blocks" method="post" %}
[swagger.yaml](https://3451684478-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYGfRvkWH46FPzusrEuli%2Fuploads%2FKnHY6xdYVDkw1Gnzdilz%2Fswagger.yaml?alt=media\&token=8212e6ad-5b5a-49cf-b210-51a31b818e43)
{% endopenapi %}


# Contact Us

There are a lot of ways to get in touch with us! Please choose the one that is the most convenient to you.

## Twitter

Feel free to engage with us at [@fireacademyio](https://twitter.com/fireacademyio). For fast PM responses, we recommend directly messaging [@yakuh1t0](https://twitter.com/yakuh1t0).

## Discord

[Our Discord](https://discord.gg/yNVNvQyYXn) has a dedicated channel for saying 'gm'.

## Email

You can reach us at `support@fireacademy.io`

## Pigeon Post

Our address can be found at the bottom of our [Terms and Conditions](https://fireacademy.io/terms-and-conditions.txt). If you meet yakuhito in-person, you can ask for photo evidence regarding pigeons.

## Phone No.

Those that manage to get the phone number of someone from our team can directly call us. Not sure how one might do this, though.


