# RPC

The JSON-RPC endpoint is `https://testrpc.dinx.io`. The chain ID inherited from ethereum is 1.

#### Add DINX RPC to MetaMask

You can add the DINX RPC endpoint in two ways: **automatically** or **manually**.

1. **Manual Setup via MetaMask:**
   * Click on the MetaMask settings and add DINX as your RPC provider.
2. **Automatic Setup via URL:**
   * You can switch to DINX by visiting[`https://explorer.dinx.io`](https://explorer.dinx.io) to easily configure your RPC.

Below is an example of how to add the DINX RPC programmatically:

```javascript
try {
  await provider // Or window.ethereum if you don't support EIP-6963.
    .request({
      method: "wallet_switchEthereumChain",
      params: [{ chainId: "0x1" }],
    });
} catch (switchError) {
  // This error code indicates that the chain has not been added to MetaMask.
  if (switchError.code === 4902) {
    try {
      await provider // Or window.ethereum if you don't support EIP-6963.
        .request({
          method: "wallet_addEthereumChain",
          params: [
            {
              chainId: "0x1",
              chainName: "DINX",
              rpcUrls: ["https://testrpc.dinx.io"], // DINX RPC endpoint
            },
          ],
        });
    } catch (addError) {
      // Handle any "add" error.
    }
  }
  // Handle other "switch" errors.
}
```

**Note:** This process is just for switching your RPC provider and does not collect any personal information or introduce additional security risks.

### Wallet support

<table><thead><tr><th width="249">Wallet</th><th width="367">support</th><th>Link</th></tr></thead><tbody><tr><td><img src="https://145503242-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhgfSULx6VEo6eLaLSwM0%2Fuploads%2FfICwLdcST4DOkdJEGgwg%2Fimage.png?alt=media&#x26;token=87a0c59c-da34-4344-afbe-f10c03cf2ee3" alt="" data-size="line"> Metamask</td><td>Yes</td><td><a href="https://chromewebstore.google.com/detail/metamask/nkbihfbeogaeaoehlefnkodbefgpgknn">Download</a></td></tr><tr><td><img src="https://lh3.googleusercontent.com/sO4GPPbgvTCXEFWp-uALYYju9vxVOr5YSr2jqRAclNFSq8FrAIVTQOYmpJV4kMuDM1ZazcgUdjNGLIGKpmMRvR3NzQ=s60" alt="“欧易 Web3 钱包”的产品徽标图片" data-size="line"> OKX Wallet</td><td>Yes</td><td><a href="https://chromewebstore.google.com/detail/%E6%AC%A7%E6%98%93-web3-%E9%92%B1%E5%8C%85/mcohilncbfahbmgdjkbpemcciiolgcge">Download</a></td></tr><tr><td><img src="https://145503242-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhgfSULx6VEo6eLaLSwM0%2Fuploads%2Fx1wGRVKQlJV103LfKFft%2Fimage.png?alt=media&#x26;token=b3a72e19-3361-4951-87ee-b8277f872267" alt="" data-size="line"> TokenPocket</td><td>Yes</td><td><a href="https://chromewebstore.google.com/detail/tokenpocket-web3-nostr-%E9%92%B1%E5%8C%85/mfgccjchihfkkindfppnaooecgfneiii">Download</a></td></tr><tr><td><img src="https://145503242-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhgfSULx6VEo6eLaLSwM0%2Fuploads%2FqtV0nI3552Au21ACJxso%2Fimage.png?alt=media&#x26;token=de2c2fa3-5eb3-476e-9a36-14d89987b79a" alt="" data-size="line"> UniSat Wallet</td><td>No</td><td><a href="https://chromewebstore.google.com/detail/unisat-wallet/ppbibelpcjmhbdihakflkdcoccbgbkpo">Download</a></td></tr></tbody></table>

<br>
