Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add initial description of lombard integration #65

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/Introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,6 @@ RedStone was designed with a modular architecture making it easy to incorporate
- Our code was audited by multiple security experts including [ABDK](https://abdk.consulting/) [Peckshield](https://peckshield.com/) and a co-founder of [L2Beat](https://pl.linkedin.com/company/l2beat#:~:text=Join%20Piotr%20Szlachciak%20Cofounder%20%26%20CEO,insights%20shaping%20the%20%23DeFi%20landscape!).
- RedStone supports leading projects like [Morpho](https://morpho.org/), [Venus](https://venus.io/), and [Pendle Finance](https://www.pendle.finance/).

<a href="https://raw.githubusercontent.com/redstone-finance/redstone-docs/main/static/img/redstone-architecture-simple.png">
<img alt="RedStone Architecure" src="/img/redstone-architecture-simple.png" target="_blank"/>
<a target="_blank" href="https://raw.githubusercontent.com/redstone-finance/redstone-docs/main/static/img/redstone-architecture-simple.png">
<img alt="RedStone Architecure" src="/img/redstone-architecture-simple.png"/>
</a>
32 changes: 15 additions & 17 deletions docs/data-providers/deploy.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ sidebar_label: "Deploy"

# Deploy

In this section you will see how to run a RedStone node using Docker Compose.
In this section you will see how to run a RedStone node using Docker Compose.

:::caution
For production deployments consider using more sofisticated tools, e.g. Kubernetes.
Expand All @@ -18,11 +18,10 @@ For production deployments consider using more sofisticated tools, e.g. Kubernet
- At least 30 GB of storage (mainly for logs)
- [Docker](https://docs.docker.com/get-docker/) and [Docker Compose](https://docs.docker.com/compose/install/)

:::tip
:::tip
The hardware requirements for running a RedStone node are quite low, but you should reserve a healthy margin. The more resources you spare when provisioning your machine, the better it will perform and the less likely it will be to run into issues.
:::


### Docker Compose Example

Here's a simple example of a `docker-compose.yml` file that you can use to run the RedStone oracle node locally. Copy this configuration and adjust it to your needs.
Expand All @@ -38,7 +37,7 @@ services:
- public_network
- private_network
volumes:
- redstone-oracle-node:/oracle-node-level-db
- redstone-oracle-node:/oracle-node-level-db
environment:
OVERRIDE_DIRECT_CACHE_SERVICE_URLS: '["https://httpbin.org/anything"]'
OVERRIDE_MANIFEST_USING_FILE: ./manifests/dev/dev.json
Expand All @@ -59,8 +58,8 @@ services:
- private_key

secrets:
private_key:
file: private_key.txt
private_key:
file: private_key.txt

volumes:
redstone-oracle-node:
Expand All @@ -69,36 +68,35 @@ networks:
public_network:
driver: bridge
private_network:
internal: true # This ensures the network is private
internal: true # This ensures the network is private
```

### Services

#### RedsStone KMS (Key Management Service)

RedStone KMS' sole purpose is to handle all operations on your private key. It signs the data fetched by the oracle node and returns the evm address. This should be the only service that has access to your private key. Use the [RedStone KMS](https://gallery.ecr.aws/y7v2w8b2/kms) Docker image.
RedStone KMS' sole purpose is to handle all operations on your private key. It signs the data fetched by the oracle node and returns the evm address. This should be the only service that has access to your private key. Use the [RedStone KMS](https://gallery.ecr.aws/y7v2w8b2/kms) Docker image.

| Param | Description | Example value |
| ------------------------ | ---------------------------------------------------------------------------------------------------- | ----------------------------------------------- |
| **KMS_PRIVATE_KEY_FILE** | Path to the file with your private key. The file should contain a single line with your private key. | `KMS_PRIVATE_KEY_FILE=/run/secrets/private_key` |
| **KMS_PRIVATE_KEY** | Hex encoded key. Alternative way of passing the key | `KMS_PRIVATE_KEY=0xYOUR_PRIVATE_KEY` |
| **KMS_ADDRESS** | Bind address | `KMS_ADDRESS=0.0.0.0:4499` |

#### RedStone Node
RedStone oracle node will fetch data from main public APIs, sign them with your private keys and broadcast to the streamr network and redstone Data Distribution Layer (DDL).
It should be configured using environment variables.
#### RedStone Node

RedStone oracle node will fetch data from main public APIs, sign them with your private keys and broadcast to the streamr network and redstone Data Distribution Layer (DDL).
It should be configured using environment variables.

| Param | Description | Example value |
| ---------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ |
| **ENABLE_REMOTE_SIGNER** | Delegate signing to a remote signer. Only this image has access to your ECDSA private key | `ENABLE_REMOTE_SIGNER=true` |
| REMOTE_SIGNER_URL | This is where Redstone's signer is listening. We recommend using a colocation e.g. in Kubernetes oracle-node and signer should be run in the same POD. By default `http://localhost:4499`.key | `REMOTE_SIGNER_URL=http://localhost:4499` |
| Param | Description | Example value |
| -------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ |
| **ENABLE_REMOTE_SIGNER** | Delegate signing to a remote signer. Only this image has access to your ECDSA private key | `ENABLE_REMOTE_SIGNER=true` |
| REMOTE_SIGNER_URL | This is where Redstone's signer is listening. We recommend using a colocation e.g. in Kubernetes oracle-node and signer should be run in the same POD. By default `http://localhost:4499`.key | `REMOTE_SIGNER_URL=http://localhost:4499` |
| **OVERRIDE_DIRECT_CACHE_SERVICE_URLS** | Your personal private URLs of gateways to the RedStone Data Distribution Layer (DDL). For running a local node you can simply put `OVERRIDE_DIRECT_CACHE_SERVICE_URLS=["https://httpbin.org/anything"]`. But for production node running you should [request them](https://redstone.finance/discord) from the RedStone team. | `OVERRIDE_DIRECT_CACHE_SERVICE_URLS=["https://xxx.yyy.secret-url-1.com","https://zzz.aaa.secret-url-2.com"]` |
| **OVERRIDE_MANIFEST_USING_FILE** | Path to your manifest file. Manifest is a public JSON file that defines the provider's obligation regarding the data that they provide. It sets fetching interval, tokens, sources and other public technical details for the provided data. You can check available manifests [here.](https://github.com/redstone-finance/redstone-oracles-monorepo/tree/main/packages/oracle-node/manifests) | `OVERRIDE_MANIFEST_USING_FILE=./manifests/dev/dev.json` |
| **LEVEL_DB_LOCATION** | Path to the level DB. Each RedStone oracle node relies on a single-level DB. It is used to store recently fetched values from the last 15 minutes. These values are used for checking value deviations, filtering outliers and preventing price manipulation attacks. <br/><br/> You don't need to create a Level DB instance manually, it will be created automatically at the specified path during the first node launch. | `LEVEL_DB_LOCATION=/oracle-node-level-db` |
| **LEVEL_DB_LOCATION** | Path to the level DB. Each RedStone oracle node relies on a single-level DB. It is used to store recently fetched values from the last 15 minutes. These values are used for checking value deviations, filtering outliers and preventing price manipulation attacks. <br/><br/> You don't need to create a Level DB instance manually, it will be created automatically at the specified path during the first node launch. | `LEVEL_DB_LOCATION=/oracle-node-level-db` |
| **ENABLE_REMOTE_SIGNER** | Switch on signing with RedStone KMS | `ENABLE_REMOTE_SIGNER=true` |

:::tip Custom local manifest
If you want to run oracle-node from Docker with your custom manifest you should [mount the manifest file](https://docs.docker.com/storage/bind-mounts/) from your local system to the docker container and update the `OVERRIDE_MANIFEST_USING_FILE` env variable.
:::

11 changes: 7 additions & 4 deletions docs/data-providers/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,32 @@
sidebar_position: 1
sidebar_label: "Introduction"
---

# Introduction

RedStone is one of the leading oracle providers on the market, but with great power comes great responsibility. In order to minimize the (already small) risk of price manipulation RedStone is allowing other, verified and trusted companies to send oracle data to its gateways. This way we increase safety, transparency and improve data quality.

We call those companies **External Oracle Providers** (EOP).

We call those companies **External Oracle Providers** (EOP).

## Becoming External Oracle Provider

Not every company may become an External Oracle Provider (EOP). Institutions need to meet some legal and technical conditions. The whole process may be divided into 3 steps - legal analysis, joining staging and joining production environments.

### Legal Analysis
### Legal Analysis

At the end of this stage EOP understands what are the legal consequences of malicious manipulation of rates. EOP also knows how the compensation mechanism works.

### Staging

Now that all legal matters are out of the way EOP will start setting up its own Oracle Node. At this point RedStone’s and EOP’s dev ops contact and set it all up.
First EOP connects to staging environment where we monitor in detail how stable is the deployment. We record downtime as well as the provided prices - we do everything we can to catch problems before EOP is moved to production.

This stage lasts for as long as it is needed, at least 30 days. RedStone will be in constant contact with EOP's team to inform about the problems so they may be fixed right away.

### Production

After EOP runs on Staging and both parties agree that it's ok - we move to Production. RedStone continues to monitor EOP, but now data is available in our production gateways.

:::info Data availability
RedStone consumers will be able to use the data published by your node [on all supported chains.](/docs/get-started/supported-chains) You can learn more about the RedStone Oracles architecture [here.](../get-started/selecting-redstone-model.md)
:::
:::
14 changes: 9 additions & 5 deletions docs/get-started/data-formatting-processing.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
---
sidebar_position: 3
sidebar_label: "Data Formatting & Processing"
sidebar_label: "💾 Data Formatting & Processing"
---

# How Data Flows to the Blockchain

<a href="https://raw.githubusercontent.com/redstone-finance/redstone-docs/main/static/img/architecture.png">
<img src="/img/architecture.png" target="_blank" alt="RedStone Architecture"/>
<a target="_blank" href="https://raw.githubusercontent.com/redstone-finance/redstone-docs/main/static/img/architecture.png">
<img src="/img/architecture.png" alt="RedStone Architecture"/>
</a>

## Overview
Expand All @@ -32,13 +32,17 @@ All of the steps are executed automatically by the ContractWrapper and is transp

2. Data is packed into a message based on the structure of the ‘Transaction Payload’ diagram below…

<a href="https://raw.githubusercontent.com/redstone-finance/redstone-docs/main/static/img/redstone-tx-wrapping.png">
<img src="/img/redstone-tx-wrapping.png" target="_blank" alt="Payload Wrapping"/>
<a target="_blank" href="https://raw.githubusercontent.com/redstone-finance/redstone-docs/main/static/img/payload.png">
<img src="/img/payload.png" alt="RedStone Payload"/>
</a>

3. The package is appended to the original transaction message, signed, and submitted to the network.
<br />

<a target="_blank" href="https://raw.githubusercontent.com/redstone-finance/redstone-docs/main/static/img/redstone-tx-wrapping.png">
<img src="/img/redstone-tx-wrapping.png" alt="Payload Wrapping"/>
</a>

### How Data Is Unpacked, Verified and Then Aggregated On-Chain

Firstly, the appended data packages are extracted from the call data. Then, security steps are taken including verifying if the signature was created by a trusted provider and validating the timestamp, confirming the information is correct. Afterward, for each requested data feed RedStone calculates the number of received unique signers, extracts the value for each unique signer, and calculates the aggregated value. The middle value of all the values (median), is the default value that is provided. This logic is executed in the on-chain environment and its execution has been optimized using a low-level assembly code to reduce gas consumption to the absolute minimum. To increase the security of the RedStone Oracle system, we've created the on-chain aggregation mechanism. This mechanism adds an additional requirement of ensuring a minimum number of distinct data feeds are relied on. The values from different providers are then aggregated before returning to a consumer contract. By default, RedStone uses the median value calculation for aggregation. This way, even if a small subset of providers are corrupt (e.g. 2 of 10), it does not significantly affect the aggregated value.
Expand Down
Loading