# Orakl Network Proof of Reserve

## Description

The **Orakl Network Proof of Reserve** is a critical component within the Orakl Network ecosystem, designed to establish and verify the reserve holdings of financial entities. This service ensures transparency and trust in the financial operations by providing a secure and auditable process for validating reserve data. The Orakl Network Proof of Reserve is a cornerstone within the ecosystem, dedicated to establishing trust in financial operations. This service seamlessly integrates off-chain and on-chain processes, providing a robust framework to verify and authenticate reserve holdings.

A Proof of Reserve is defined by a pair of an adapter and an aggregator, and can be accessed on-chain through a `AggregatorProxy` smart contract, where the on-chain implementation of contracts are reused from [contracts v0.1](https://github.com/Bisonai/orakl/tree/d1cde6fcd0845c07391b6a7f28f9f83ca911ad54/contracts/v0.1). The `AggregatorProxy` is an auxiliary contract that redirects read requests to `Aggregator` contract. The Proof of Reserve's `Aggregator` contract holds all submission values that is served to consumers through `AggregatorProxy` contract.

Every proof of reserve has configuration that describes the least frequent update interval called `heartbeat`, and minimum deviation threshold (`deviationTreshold`).

The **Orakl Network Proof of Reserve** operates as a streamlined, single-process system, easily triggered by a Cron job. The initial phase involves retrieving the most recent `roundId` and `PoR value` from the Proof of Reserve `Aggregator contract`. Subsequently, the process assesses eligibility for submission through a combination of the `Heartbeat Check` and `Deviation Check`. If either condition is met, the final step involves fetching data from the `API resource` and reporting the next round to the `POR contract`. This cohesive workflow ensures efficient and timely execution of the `Proof of Reserve` process.

The code is located under [./node/pkg/por](https://github.com/Bisonai/orakl/tree/master/node/pkg/por) directory

## Configuration

Before we launch the **Orakl Network Proof of Reserve**, we must specify [several environment variables](https://github.com/Bisonai/orakl/blob/master/node/.env.example). The environment variables are automatically loaded from a `.env` file.

```.env
# POR
POR_REPORTER_PK=
POR_CHAIN=
POR_PROVIDER_URL=
# (optional) defaults to 3000
POR_PORT=
```

* `POR_REPORTER_PK`: designated por reporter's pk, should be whitelisted from the aggregator contract
* `POR_CHAIN`: chain name of POR (`baobab` or `cypress`)
* `POR_PROVIDER_URL`: json rpc url to be used for reading and submitting onchain
* `POR_PORT`: port to be used for healthcheck (defaults to `3000`)

## Launch

Before launch, setup environment variables required by Orakl Node. You can find detailed explanation at [Orakl Node README](https://github.com/Bisonai/orakl/blob/master/node/README.md).

To launch Proof Of Reserve navigate to `node` directory and execute the command below.

```sh
task local:por
```


---

# 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.orakl.network/node-operators-guide/proof-of-reserve.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.
