> For the complete documentation index, see [llms.txt](https://docs.nexus.xyz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.nexus.xyz/network/building-on-nexus/developer-environment-setup.md).

# Developer Environment Setup

### RPC Endpoints

<table><thead><tr><th>Network</th><th width="86.41796875">Chain ID</th><th width="276">HTTP RPC</th><th width="150.3046875">WebSocket RPC</th><th width="94.90234375">Status</th></tr></thead><tbody><tr><td>Nexus Mainnet </td><td>3946</td><td><code>https://mainnet.rpc.nexus.xyz</code></td><td><code>wss://mainnet.rpc.nexus.xyz</code></td><td>Live</td></tr><tr><td>Nexus Testnet</td><td>3945</td><td><code>https://testnet.rpc.nexus.xyz</code></td><td><code>wss://testnet.rpc.nexus.xyz</code></td><td>Live</td></tr></tbody></table>

Notes:

* WebSocket connections require an `X-Api-Key` header on the upgrade handshake. Since browsers cannot set custom headers on WebSocket connections, WSS is currently limited to server-side use (Node.js, Python, etc). Browser dApps should use HTTP polling or a server-side relay.
* OFAC-restricted jurisdictions are blocked at the edge. See [Restricted Jurisdictions](https://nexus.xyz/restricted-jurisdictions).

### Request Limits

| Limit                  | Value  | Error                                 |
| ---------------------- | ------ | ------------------------------------- |
| Max payload size       | 2 MB   | JSON-RPC `-32005`                     |
| Max batch sub-requests | 10     | JSON-RPC `-32005`                     |
| Per-IP rate limiting   | Active | JSON-RPC error + `Retry-After` header |

### Testnet Faucet

Developers can acquire Testnet $NEX here: <https://faucet.nexus.xyz>

### Wallet Setup

| Field              | Mainnet                         | Testnet                              |
| ------------------ | ------------------------------- | ------------------------------------ |
| Network Name       | Nexus Mainnet                   | Nexus Testnet                        |
| RPC URL            | `https://mainnet.rpc.nexus.xyz` | `https://testnet.rpc.nexus.xyz`      |
| Chain ID           | `3946`                          | `3945`                               |
| Currency Symbol    | `NEX`                           | `NEX`                                |
| Block Explorer URL | `https://explorer.nexus.xyz`    | `https://testnet.explorer.nexus.xyz` |

To add programmatically:

```javascript
await window.ethereum.request({
  method: "wallet_addEthereumChain",
  params: [{
    chainId: "0xF6A",  // 3946 in hex
    chainName: "Nexus Mainnet",
    nativeCurrency: {
      name: "NEX",
      symbol: "NEX",
      decimals: 18,
    },
    rpcUrls: ["https://mainnet.rpc.nexus.xyz"],
    blockExplorerUrls: ["https://explorer.nexus.xyz"],
  }],
});
```

### Hardhat

```bash
npm install --save-dev hardhat @nomicfoundation/hardhat-toolbox
```

`hardhat.config.ts`:

```typescript
import { HardhatUserConfig } from "hardhat/config";
import "@nomicfoundation/hardhat-toolbox";

const config: HardhatUserConfig = {
  solidity: "0.8.24",
  networks: {
    nexusMainnet: {
      url: process.env.NEXUS_RPC_URL || "https://mainnet.rpc.nexus.xyz",
      chainId: 3946,
      accounts: process.env.PRIVATE_KEY ? [process.env.PRIVATE_KEY] : [],
    },
    nexusTestnet: {
      url: process.env.NEXUS_TESTNET_RPC_URL || "https://testnet.rpc.nexus.xyz",
      chainId: 3945,
      accounts: process.env.PRIVATE_KEY ? [process.env.PRIVATE_KEY] : [],
    },
  },
};

export default config;
```

### Foundry

```bash
curl -L https://foundry.paradigm.xyz | bash
foundryup
```

`foundry.toml`:

```toml
[profile.default]
solc_version = "0.8.24"

[rpc_endpoints]
nexus_mainnet = "https://mainnet.rpc.nexus.xyz"
nexus_testnet = "https://testnet.rpc.nexus.xyz"
```

```bash
forge create src/MyContract.sol:MyContract \
  --rpc-url nexus_testnet \
  --chain-id 3945 \
  --private-key $PRIVATE_KEY
```

### Remix

1. Open [Remix IDE](https://remix.ethereum.org/)
2. Deploy & Run tab → "Injected Provider — MetaMask"
3. Ensure MetaMask is connected to Nexus (chain ID 3946 or 3945)

### Environment verification

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

Expected: a valid hex block number in the `result` field.

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

Expected: `"0xf6a"` (3946) for mainnet, `"0xf69"` (3945) for testnet.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.nexus.xyz/network/building-on-nexus/developer-environment-setup.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
