# RPC endpoint and chainId

While the default RPC endpoint and chainId are automatically configured in the StartrailSdk based on the environment you select, you can also overwrite them by specifying the values at the time of StartrailSdk instantiation. This is particularly useful in irregular cases that require immediate action or action without a StartrailSdk update, such as when

* a particular RPC endpoint experiences downtime
* the chainId is changed due to network deprecation

As the production environment is connected to the Polygon network while the staging environment is connected to the Amoy network, it's essential to provide the same rpcEndpoint as the network to which the StartrailSdk is connected.

{% hint style="warning" %}
It's important to note that Startrail smart contracts reside in the Polygon and Amoy blockchains, and changing the chainId to other networks is not supported.
{% endhint %}

### RPC endpoint

One of the following RPC endpoints is selected after a live status check from StartrailSdk, following the order from the top under the hood.

<table><thead><tr><th width="147.33333333333331">Env</th><th>Staging</th><th>Production</th></tr></thead><tbody><tr><td><strong>EVM network</strong></td><td><strong>Amoy</strong></td><td><strong>Polygon</strong></td></tr><tr><td><strong>Default RPC</strong></td><td><pre class="language-typescript"><code class="lang-typescript">https://polygon-amoy.infura.io/v3/693b51fa95334eb3bb1849da03cef748
</code></pre></td><td><pre><code>'https://polygon-rpc.com',
'https://rpc-mainnet.matic.network',
'https://matic-mainnet.chainstacklabs.com',
'https://rpc-mainnet.maticvigil.com',
'https://rpc-mainnet.matic.quiknode.pro',
'https://matic-mainnet-full-rpc.bwarelabs.com'
</code></pre></td></tr><tr><td>Default ChainId</td><td>80002</td><td>137</td></tr></tbody></table>

```javascript

sdk = new Startrail({
	...
  // example
  rpcEndpoint: 'https://YOUR_RPC_ENDPOINT',
  chainId: 123 // Select the chainId you want to overwrite.
})
```


---

# 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.startrail.io/startrail-sdk-js/getting-started/rpc-endpoint.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.
