# Reporting With Telliot

## Reporting a Price <a href="#telliot-feeds-reporting-a-price" id="telliot-feeds-reporting-a-price"></a>

It's really simple to report data with Telliot.

First, make sure you're in python's virtual environment `(venv)`:

{% hint style="warning" %}
Everytime you run Telliot or DVM you need to enter this virtual environment. To enter it, go to `telliot-feeds` folder and run `source venv/bin/activate`. To exit it, run `deactivate`.

Through the command line you can use `cd <name of folder>` to enter a folder and `cd ..` to move one folder up (go back).
{% endhint %}

Now, confirm you have at least the minimum current stake amount of FETCH in your reporter's wallet address and run the command below to report a median spot price for PLS/USD.

<mark style="color:blue;">You can check the current minimum stake amount in</mark> [Fetch Dashboard](https://testnet.fetchoracle.com/#/), <mark style="color:blue;">top left of the page!</mark>

```sh
telliot report -a <yourAccName> -qt pls-usd-spot
```

{% hint style="success" %}
`telliot report` is the base command to submit reports. `-a` is the option where you declare the acc name for the wallet you want to use. `-qt` is the query tag you want to report.
{% endhint %}

After running the above, Telliot will: Display some detailed info about contracts and where it is going to try to report, ask for your acc password, try to stake if you don't have the minimum stake amount and try to submit the report. That's it!

{% hint style="warning" %} <mark style="color:red;">**Each reporter is responsible for the data they're submitting**</mark><mark style="color:red;">.</mark>

Make sure to check FIRST which feed you are reporting for what sources they are using! (Submitting data to Testnet first is a great way to get familiar with Reporting without risking real money)

Submitting data that is deemed incorrect may be challenged by *anyone* in the community and you risk losing at least 1 stake per report disputed!

It's highly beneficial and recommended to check within the community of reporters which feeds and sources are being accepted as truth **and** what are the thresholds of tolerance for monitoring data submitted.

You can get more info on all the above at the official telegram group:

<https://t.me/fetchoracle>
{% endhint %}

<mark style="color:green;">Congratulations you submitted your first report!</mark> :tada:

Below are the detailed information of what happens in the process:

<figure><img src="https://2715759442-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuaWlV2rnUpdykVKTSfXx%2Fuploads%2FWMETde9bL5ejsnsnhedQ%2Fimage.png?alt=media&#x26;token=a5d743df-d5a3-4f47-848f-f56753f69d0b" alt=""><figcaption><p>Detailed info about wallet address and chain it will try to report after confirming password</p></figcaption></figure>

Telliot will automatically calculate the current min stake amount and try to stake it by asking you to confirm your password again to submit a deposit transaction.

After that it will calculate the PLS/USD price using its sources and submit the median price.

<figure><img src="https://2715759442-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuaWlV2rnUpdykVKTSfXx%2Fuploads%2F3V7qXqEzqpDDOXUlVd64%2Fimage.png?alt=media&#x26;token=b17dc097-ee0b-42e8-aae8-79c217f60600" alt=""><figcaption><p>If the FETCH price being used has changed, it can calculate the current stake amount for a new stake</p></figcaption></figure>

<figure><img src="https://2715759442-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuaWlV2rnUpdykVKTSfXx%2Fuploads%2FxYWkEESFzHl2GVI7zRND%2Fimage.png?alt=media&#x26;token=063fe773-01dc-4740-b933-1e647f68840f" alt=""><figcaption><p>Details about staking and asking for password to confirm the deposit of the min stake amount</p></figcaption></figure>

<figure><img src="https://2715759442-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuaWlV2rnUpdykVKTSfXx%2Fuploads%2F8r6249bxlYAzTN5VHb5r%2Fimage.png?alt=media&#x26;token=1d5ac09c-c2cd-4e77-af19-4641db8c1db4" alt=""><figcaption><p>Stake deposited and it will continue to submit the price</p></figcaption></figure>

After staking it calculates the PLS/USD price and submits it on chain. It will keep trying to report again after 7 seconds by default.&#x20;

To stop it, press `ctrl + c`.

It will also display an approximate time for when you'll be able to submit a report again, based on the current min stake amount in the contract and your deposited stake amount.

<figure><img src="https://2715759442-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuaWlV2rnUpdykVKTSfXx%2Fuploads%2FLKP3yt4Ehzx9lBAL2A8C%2Fimage.png?alt=media&#x26;token=f3bc7384-c705-4f29-a12e-368d38fa1b2a" alt=""><figcaption><p>It has reported and tried again to report after 7 seconds. It's in 'reporter lock' period and the time left for a possible new report is displayed.</p></figcaption></figure>

{% hint style="info" %}
Remember: It will keep trying to report to the same query tag unless you stop Telliot by pressing `ctrl + c`.
{% endhint %}

## Reporting a Random Number using RNG <a href="#telliot-feeds-reporting-a-price" id="telliot-feeds-reporting-a-price"></a>

{% hint style="warning" %}
This is **an example** demonstrating how Fetch can be used to generate a ‘random’ number, based on the original Tellor RNG example feed.

Before using this example in Mainnet, **where disputes may arise**, proper due diligence is required. The primary goal is to showcase additional potential use cases for Fetch.

We encourage others to build upon this idea, improve it, or create new RNG feeds and data sources. If you would like to contribute, consider submitting a review on [GitHub](https://github.com/tellor-io/telliot-feeds) to enable broader participation in data provision.
{% endhint %}

### Process Overview

1\. **User Input:** The user provides a timestamp.

2\. **Fetching Blocks**: Telliot retrieves the next Bitcoin (BTC) and PulseChain (PLS) blocks based on the given timestamp.

3\. **Random Number Generation**: A random number is generated using data from the retrieved blocks.

4\. **Reporting**: The generated number is encoded and submitted for reporting.

### Detailed steps

To report a random number using Telliot RNG use the query tag `tellor-rng-example`

The process begins by prompting the user to input a timestamp:\
From this timestamp, it will fetch the next BTC and PLS block.

```
Enter timestamp for generating a random number:
1742466660
```

Telliot confirms the generation process:

```
Generating random number from timestamp: 1742466660
Press [ENTER] to confirm.
```

Telliot retrieves the latest BTC block:

```
INFO | telliot_feeds.sources.blockhash_aggregator | Using BTC block number 888619
```

Next, it fetches the corresponding block from PulseChain (chain ID: 369):

```
INFO | telliot_feeds.sources.blockhash_aggregator | Trying to fetch block from chain: 369
INFO | telliot_feeds.sources.blockhash_aggregator | Block api data: {'blockNumber': '22996631'}
INFO | telliot_feeds.sources.blockhash_aggregator | Block received: 22996631
INFO | telliot_feeds.sources.blockhash_aggregator | Using block number 22996631
```

The random number is derived from the two retrieved blocks and stored:

```
INFO    | telliot_feeds.sources.blockhash_aggregator | Stored random number for timestamp 1742466660: 0x1989faad8a133a7ce5da64eddd6679a9dd3ef61f893da049895dc92c0f31663f
DEBUG   | telliot_feeds.reporters.tellor_360 | Current query: {"type":"TellorRNG","timestamp":0}
```

The random number is encoded for reporting:

```
DEBUG   | telliot_feeds.reporters.tellor_360 | Reporter Encoded value: 1989faad8a133a7ce5da64eddd6679a9dd3ef61f893da049895dc92c0f31663f
```

### RNG on Fetch Dashboard

Currently, the Fetch Dashboard *does* not display the query or the generated random number. However, the reported data can be seen in the Discord notifications. Below is an example RNG notification in Discord;

```
Query: {"type":"TellorRNG","timestamp":0}
Price Submitted: 11,551,609,377,654,775,654,021,618,183,836,409,979,244,170,088,532,462,796,800
```
