# Getting Started

## Step 1: Pre-login and login

The **pre-login** and **login APIs** are crucial for the security and functionality of the Proof of Bandwidth or Proof of Location system. The APIs handles initial authentication steps, like generating session tokens and validating access. These APIs are foundational for safeguarding the prover's information and controlling system access, ensuring only authenticated users can interact with critical resources

Start the process by performing a **pre-login** and **login** request

{% hint style="info" %}
**Note:** The `{proof_type}` parameter is crucial in all API requests and **must** be set to one of the following values:

* `pol` (Proof of Location)
* `pob` (Proof of Bandwidth)

Be sure to specify the appropriate value based on the context of your proof request.
{% endhint %}

#### Pre-login

{% openapi src="/files/WWLjK2RiH8JZs6E8BepB" path="/proof/v1/{proof\_type}/pre-login" method="post" %}
[challenge\_api.json](https://651400886-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FaZ7PXq43vesxvXxlBG9x%2Fuploads%2FSxD3akB7T6Vy6Ek6wdcA%2Fchallenge_api.json?alt=media\&token=45395a70-77eb-498b-8209-c4ae4f512011)
{% endopenapi %}

#### Login

After the result is obtained, the **/login** api needs to be invoked

{% openapi src="/files/WWLjK2RiH8JZs6E8BepB" path="/proof/v1/{proof\_type}/login" method="post" %}
[challenge\_api.json](https://651400886-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FaZ7PXq43vesxvXxlBG9x%2Fuploads%2FSxD3akB7T6Vy6Ek6wdcA%2Fchallenge_api.json?alt=media\&token=45395a70-77eb-498b-8209-c4ae4f512011)
{% endopenapi %}

## Step 2: Submit an on-chain Challenge Request&#x20;

Refer to the following chain parameters to trigger a on-chain **submitRequest**

| Parameters                                                                                                                                                        | Values                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Chain ID                                                                                                                                                          | 1237146866                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| Chain Kind                                                                                                                                                        | Polygon CDK (Validium)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| Chain RPC                                                                                                                                                         | <https://blue-orangutan-rpc.eu-north-2.gateway.fm/>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| Chain Block Explorer                                                                                                                                              | <https://blue-orangutan-blockscout.eu-north-2.gateway.fm/txs>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| Contract Address Proxy to interact to initiate a on-chain challenge                                                                                               | [0x8A02C91373929a4764F015309B072DC9C9Fabc49](https://blue-orangutan-blockscout.eu-north-2.gateway.fm/address/0x8A02C91373929a4764F015309B072DC9C9Fabc49)                                                                                                                                                                                                                                                                                                                                                                                                                  |
| Function to invoke                                                                                                                                                | submitRequest                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| <p>Parameters to pass to <strong>submitRequest</strong><br><strong>- timeout</strong> <br><strong>- attributeIDs</strong><br><strong>- challengeInfo</strong></p> | <p>For PoB,<br><a href="https://github.com/witnesschain-com/pox-scheduler/blob/28b305c1faad39c47ae90e159303bc68695c09a1/src/run_challenge.py#L43"><https://github.com/witnesschain-com/pox-scheduler/blob/28b305c1faad39c47ae90e159303bc68695c09a1/src/run_challenge.py#L43></a><br><br>For PoL,<br><a href="https://github.com/witnesschain-com/pox-scheduler/blob/28b305c1faad39c47ae90e159303bc68695c09a1/src/run_challenge.py#L96"><https://github.com/witnesschain-com/pox-scheduler/blob/28b305c1faad39c47ae90e159303bc68695c09a1/src/run_challenge.py#L96></a></p> |
| Contract ABI                                                                                                                                                      | <https://blue-orangutan-blockscout.eu-north-2.gateway.fm/address/0x39B42E1CA5F34E989Df957f4D391996266a460bB?tab=contract>                                                                                                                                                                                                                                                                                                                                                                                                                                                 |

{% hint style="info" %}
We also have a [sample script](https://github.com/witnesschain-com/pox-scheduler/tree/main) written in Python, to trigger a PoL or a PoB challenge.
{% endhint %}

## Step 3: Trigger a Challenge with the Witness Chain Broker

Pass the **challenge-id** obtained in the previous step to the **challenge-request-dcl API**&#x20;

{% openapi src="/files/WWLjK2RiH8JZs6E8BepB" path="/proof/v1/{proof\_type}/challenge-request-dcl" method="post" %}
[challenge\_api.json](https://651400886-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FaZ7PXq43vesxvXxlBG9x%2Fuploads%2FSxD3akB7T6Vy6Ek6wdcA%2Fchallenge_api.json?alt=media\&token=45395a70-77eb-498b-8209-c4ae4f512011)
{% endopenapi %}

## Step 4: Monitor the status of the Challenge to obtain the results

One can monitor the status of the challenge to obtain the results using the **challenge-status-dcl** API

{% openapi src="/files/TzM16hlXy0ClCPhsIbnm" path="/proof/v1/{proof\_type}/challenge-status-dcl" method="post" %}
[challenge\_api.json](https://651400886-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FaZ7PXq43vesxvXxlBG9x%2Fuploads%2FE7gV5fiTkL764eLCzuS1%2Fchallenge_api.json?alt=media\&token=156dbeea-b4f5-4079-b8cd-e703c0827962)
{% endopenapi %}


---

# 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.witnesschain.com/infinity-watch/apis/challenge-apis/getting-started.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.
