# 7.2 Integrations

GRX Chain is EVM-compatible and built for open, standards-based integration. This page provides wallet settings, core contracts, JSON-RPC details, security guidance, and copy-paste code for rapid onboarding.

### Quick Start

#### Add Network (MetaMask → UI)

**Mainnet**

* Network: `GRX Chain`
* RPC: `https://rpc.grxchain.io`
* Chain ID: `1110` (hex `0x456`)
* Currency: `GRX`
* Block Explorer: `https://grxscan.io`

**Testnet**

* Network: `GRX Chain Testnet`
* RPC: `https://testnet.grxchain.io`
* Chain ID: `2507` (hex `0x9CB`)
* Currency: `GRX`
* Block Explorer: `https://testnet.grxscan.io`

#### Programmatic Add (MetaMask)

```js
// Mainnet
await window.ethereum.request({
  method: 'wallet_addEthereumChain',
  params: [{
    chainId: '0x456',
    chainName: 'GRX Chain',
    nativeCurrency: { name: 'GRX', symbol: 'GRX', decimals: 18 },
    rpcUrls: ['https://rpc.grxchain.io'],
    blockExplorerUrls: ['https://grxscan.io']
  }]
});

// Testnet
await window.ethereum.request({
  method: 'wallet_addEthereumChain',
  params: [{
    chainId: '0x9CB',
    chainName: 'GRX Chain Testnet',
    nativeCurrency: { name: 'GRX', symbol: 'GRX', decimals: 18 },
    rpcUrls: ['https://testnet.grxchain.io'],
    blockExplorerUrls: ['https://testnet.grxscan.io']
  }]
});
```

### Network Details

#### Mainnet

* **Network Name:** GRX Chain
* **RPC:** `https://rpc.grxchain.io`
* **Chain ID:** `1110` (hex `0x456`)
* **Symbol:** `GRX`
* **Explorer:** `https://grxscan.io`

**Core Contracts**

* Multicall: `0x2cd9E100Ca0d883A00eC8Ce635EbD4C17508FE3B`
* **WGRX (Wrapped GRX):** `0x45C7287F897B3A79Cd3f6e4F14B4CE568f023bD5`
* GRXswap Factory: `0xc7316818841f355c5107753A3f3FDEA799BD25f6`
* GRXswap Router v2: `0x28fC93b8a20570f2B59d5CA9f8a1dA02C4DBcDF5`
* Pair Init Code Hash: `0xb23d9a8f0a03ecd8f95e43ab1025c71bb79f1cb7128d40546417bfb4b2a74d9c`

**Canonical Tokens**

* USDT (pegged, 6d): 0x173462F5eb7CA0D1ab6aaea846fEFe85A28029E2
* BTC (pegged, 8d): `0x2F4632ABAd26A1FF9212a76597fb3c3d8539E275`
* ETH (pegged, 18d): `0x02D129c8A26839c814925eE0f1D320F63114E1FE`

#### Testnet

* **Network Name:** GRX Chain Testnet
* **RPC:** `https://testnet.grxchain.io`
* **Chain ID:** `2507` (hex `0x9CB`)
* **Symbol:** `GRX`
* **Explorer:** `https://testnet.grxscan.io`
* **Faucet:** `https://faucet.grxchain.io`

### Chain Parameters

* **Average block time:** \~2s
* **Recommended confirmations:** 12 (retail), 60 (exchange/critical)
* **Gas model:** Legacy (pre-1559). When/if 1559 is enabled, we’ll publish `maxFeePerGas` / `maxPriorityFeePerGas` guidance.
* **Target block gas limit:** \~30,000,000
* **Finality:** Probabilistic; short reorgs are rare but possible. Wait the confirmations above.
* **EVM/EIP support:** EIP-155 (chain ID), EIP-2718 (typed tx), EIP-2930 (access list). 1559 TBD via governance.

### Bridging

**Official bridge:** **Only via GroveX** — `https://grovex.io`\
Do not use third-party bridges unless later listed on the Official Channels page.

**Directions (current)**

* Inbound → GRX Chain: supported assets (e.g., ETH, BTC, USDT) credited as pegged assets/WGRX where applicable.
* Outbound ← GRX Chain: WGRX/pegged assets back to source networks (where supported).

**Notes**

* Exchange-mediated, may require KYC and an account.
* Fees/limits/timelines published on GroveX and may change.
* Show a domain check in UIs (must equal `grovex.io`); warn about look-alike domains.

**Config (JSON)**

```json
{
  "bridge": {
    "provider": "GroveX",
    "url": "https://grovex.io",
    "supported": {
      "inbound": ["ETH", "BTC", "USDT", "WGRX"],
      "outbound": ["WGRX", "USDT", "BTC", "ETH"]
    },
    "requirements": { "kyc": true, "account": true },
    "confirmations": { "grxChain": 12 },
    "warnings": [
      "Only use grovex.io for bridging.",
      "Beware of look-alike domains and fake support."
    ]
  }
}
```

### JSON-RPC

* **Public RPC:** `https://rpc.grxchain.io` (mainnet), `https://testnet.grxchain.io` (testnet)
* **WebSocket:** `wss://rpc.grxchain.io/ws`, `wss://testnet.grxchain.io/ws`
* **Rate limits (suggested to publish):** HTTP 50 req/s/IP (burst 100/10s); WS 1 stream, \~2000 msgs/min/IP
* **Headers:** `X-RateLimit-Limit`, `X-RateLimit-Remaining`, `Retry-After`
* **Errors:** `429` = backoff+jitter; `-32005` log range too large; `-32602` invalid params
* **CORS:** enabled for common wallets; avoid cross-origin POSTs from untrusted pages

**Health check**

```bash
curl -s -X POST https://rpc.grxchain.io \
 -H "Content-Type: application/json" \
 -d '{"jsonrpc":"2.0","id":1,"method":"eth_chainId","params":[]}'
# Expect: 0x456
```

**Gas price (legacy)**

```bash
curl -s -X POST https://rpc.grxchain.io \
 -H "Content-Type: application/json" \
 -d '{"jsonrpc":"2.0","id":1,"method":"eth_gasPrice","params":[]}'
```

**WebSocket tips**\
Use keepalive ping \~25s, reconnect with exponential backoff. On drops, resume from the last confirmed block.

### Explorer & APIs

* **Explorer:** `https://grxscan.io`
* **Testnet Explorer:** `https://testnet.grxscan.io`

**Examples** *(adjust to GRXscan’s API spec)*

```bash
# Tx by hash
curl -s "https://grxscan.io/api?module=transaction&action=gettxinfo&txhash=<TX_HASH>"

# Address tx list
curl -s "https://grxscan.io/api?module=account&action=txlist&address=<ADDRESS>&page=1&offset=25"
```

### Developer Tooling

* **Frameworks:** Remix, Hardhat, Truffle
* **Libraries:** ethers.js, web3.js
* **Infra:** Use public RPCs for dev; for production, run your own node or a provider.

**Hardhat sample**

```js
export default {
  solidity: "0.8.24",
  networks: {
    grx: { url: "https://rpc.grxchain.io", chainId: 1110, accounts: [process.env.PRIVATE_KEY].filter(Boolean) },
    grxTestnet: { url: "https://testnet.grxchain.io", chainId: 2507, accounts: [process.env.PRIVATE_KEY].filter(Boolean) }
  }
}
```

**ethers.js — read WGRX balance**

```js
import { ethers } from "ethers";
const provider = new ethers.JsonRpcProvider("https://rpc.grxchain.io");
const wgrx = new ethers.Contract(
  "0x45C7287F897B3A79Cd3f6e4F14B4CE568f023bD5",
  ["function balanceOf(address) view returns (uint256)"],
  provider
);
const bal = await wgrx.balanceOf("0xYourAddress");
console.log("WGRX balance:", bal.toString());
```

### GRXswap (Router v2) — Examples

**Swap exact tokens for tokens (ethers v6)**

```js
import { ethers } from "ethers";
const provider = new ethers.JsonRpcProvider("https://rpc.grxchain.io");
const signer = new ethers.Wallet(process.env.PRIVATE_KEY, provider);

const router = new ethers.Contract(
  "0x28fC93b8a20570f2B59d5CA9f8a1dA02C4DBcDF5",
  [
    "function swapExactTokensForTokens(uint256,uint256,address[] calldata,address,uint256) returns (uint256[] memory)",
    "function getAmountsOut(uint256,address[] calldata) view returns (uint256[] memory)"
  ],
  signer
);

const WGRX = "0x45C7287F897B3A79Cd3f6e4F14B4CE568f023bD5";
const USDT = "0x1d3bc9646d126D379b4da4d71c8a4fa6b830Dd20";

const amountIn = ethers.parseUnits("10", 18);
const path = [WGRX, USDT];

const amounts = await router.getAmountsOut(amountIn, path);
const minOut = (amounts[1] * 995n) / 1000n; // 0.5% slippage
const tx = await router.swapExactTokensForTokens(
  amountIn, minOut, path, await signer.getAddress(), Math.floor(Date.now()/1000)+600
);
await tx.wait();
```

**Wrap/unwrap WGRX**

```js
const wgrx = new ethers.Contract(
  "0x45C7287F897B3A79Cd3f6e4F14B4CE568f023bD5",
  ["function deposit() payable", "function withdraw(uint256 wad)"],
  signer
);

// Wrap 1 GRX -> 1 WGRX
await (await wgrx.deposit({ value: ethers.parseUnits("1", 18) })).wait();

// Unwrap 1 WGRX -> 1 GRX
await (await wgrx.withdraw(ethers.parseUnits("1", 18))).wait();
```

**Best practices**\
Approve the Router before first swap: `await erc20.approve(router, amount)`\
Validate pair addresses against Factory; verify init code hash.\
Use Multicall for batched reads; keep batches <100 calls or <500k gas per aggregate.

### Official Token List (JSON)

```json
{
  "name": "GRX Official Tokens",
  "timestamp": "2025-10-30T00:00:00Z",
  "version": { "major": 1, "minor": 0, "patch": 0 },
  "tags": { "pegged": { "description": "Externally backed or bridged representations" } },
  "logoURI": "https://grxchain.io/logo.png",
  "keywords": ["grx", "wgrx", "official"],
  "tokens": [
    { "chainId": 1110, "address": "0x45C7287F897B3A79Cd3f6e4F14B4CE568f023bD5", "name": "Wrapped GRX", "symbol": "WGRX", "decimals": 18 },
    { "chainId": 1110, "address": "0x1d3bc9646d126D379b4da4d71c8a4fa6b830Dd20", "name": "Tether USD (Pegged)", "symbol": "USDT", "decimals": 6, "tags": ["pegged"] },
    { "chainId": 1110, "address": "0x2F4632ABAd26A1FF9212a76597fb3c3d8539E275", "name": "Bitcoin (Pegged)", "symbol": "BTC", "decimals": 8, "tags": ["pegged"] },
    { "chainId": 1110, "address": "0x02D129c8A26839c814925eE0f1D320F63114E1FE", "name": "Ether (Pegged)", "symbol": "ETH", "decimals": 18, "tags": ["pegged"] }
  ]
}
```

### Network Object (Mainnet + Testnet)

```json
{
  "mainnet": {
    "chainIdDecimal": 1110,
    "chainIdHex": "0x456",
    "name": "GRX Chain",
    "currency": { "name": "GRX", "symbol": "GRX", "decimals": 18 },
    "rpc": ["https://rpc.grxchain.io"],
    "explorers": [{ "name": "GRXscan", "url": "https://grxscan.io" }],
    "contracts": {
      "multicall": "0x2cd9E100Ca0d883A00eC8Ce635EbD4C17508FE3B",
      "wgrx": "0x45C7287F897B3A79Cd3f6e4F14B4CE568f023bD5",
      "grxswapFactory": "0xc7316818841f355c5107753A3f3FDEA799BD25f6",
      "grxswapRouterV2": "0x28fC93b8a20570f2B59d5CA9f8a1dA02C4DBcDF5",
      "pairInitCodeHash": "0xb23d9a8f0a03ecd8f95e43ab1025c71bb79f1cb7128d40546417bfb4b2a74d9c"
    }
  },
  "testnet": {
    "chainIdDecimal": 2507,
    "chainIdHex": "0x9CB",
    "name": "GRX Chain Testnet",
    "currency": { "name": "GRX", "symbol": "GRX", "decimals": 18 },
    "rpc": ["https://testnet.grxchain.io"],
    "explorers": [{ "name": "GRXscan Testnet", "url": "https://testnet.grxscan.io" }],
    "faucet": "https://faucet.grxchain.io"
  }
}
```

### Standards Matrix

| Standard           | Support | Notes                                                       |
| ------------------ | ------- | ----------------------------------------------------------- |
| ERC-20             | ✅       | WGRX conforms; decimals 18                                  |
| ERC-2612 Permit    | ✅/TBD   | Confirm if enabled for WGRX; publish domain separator if so |
| ERC-165            | ✅       | Interface detection for applicable contracts                |
| ERC-2771 (Meta-tx) | ⬜       | Planned/optional                                            |
| EIP-1559           | ⬜       | Legacy gas today; 1559 subject to governance                |

### Event Indexing & Reorg Safety

* Index logs in **block windows** (e.g., 2,000-block chunks).
* Maintain a **12-block reorg buffer**; reprocess recent blocks.
* On WS disconnects, resume from the **last confirmed block**.

### Multicall Guidance

* Use Multicall (`0x2cd9E100…FE3B`) for batched reads.
* Keep batches < **100 calls** or < **500k gas** per aggregate to avoid timeouts.

### Security & Support

* **Official channels only:** trust addresses/URLs listed on the Official Channels page.
* **Public RPCs:** best-effort; run your own nodes or use a provider for production.
* **Hardware wallets:** keep firmware/apps up to date; verify recipient addresses on-device.
* **Bug bounty / disclosures:** (link if available) — respond to security@ with PGP if you publish a key.

### Status & Changelog

* **Status:** `https://status.grxchain.io` (outages, maintenance, incident notes)
* **Changelog:** publish API/RPC/Explorer updates, contract upgrades, and breaking changes.
* **Policy:** aim for **14 days’ notice** before public endpoint deprecations unless urgent security fixes are required.

#### Attribution

* **GRX Chain** and portals are owned/operated by **GRXCHAIN Inc. (BVI)**.
* **GroveX exchange** is operated by **GroveX Pty Ltd (AU)**.
* **WGRX** mainnet contract: `0x45C7287F897B3A79Cd3f6e4F14B4CE568f023bD5`.


---

# 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.grxchain.io/7.2-integrations.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.
