# Guide: Enter the GR1D Testnet

Alright, welcome to the GR1D Testnet! If you’re looking to get hands-on with GR1D’s L2 solution, you’re in the right place. Whether you’re deploying smart contracts, testing cross-chain functionality, or simply exploring the GR1D environment, this guide will get you connected and building in no time.

### 1. Setting Up Your Dev Environment

First things first—you’ll want to set up your development environment to interact with the GR1D Testnet. If you’re familiar with tools like **MetaMask**, **Hardhat**, or **Truffle**, you’re already halfway there. Here’s the lowdown:

#### Step 1: Add GR1D Testnet to MetaMask

1. Fire up **MetaMask** and go to the network dropdown.
2. Click **"Add Network"** and fill in the following details:
   * **Network Name**: GR1D Testnet
   * **New RPC URL**: <https://rpc-123420000418.raas-testnet.gelato.digital>
   * **Chain ID**: `123420000418`
   * **Currency Symbol**: ETH (we’re using Sepolia ETH here)
   * **Block Explorer URL**: <https://explorer-testnet.gr1d.network/>
3. Save it, and boom—you’re connected to the GR1D Testnet via MetaMask.

#### Step 2: Configuring Hardhat or Truffle

Now, for the real fun—getting your smart contracts ready. We’ll set up either Hardhat or Truffle to deploy on the GR1D Testnet.

**Hardhat Configuration**

In your `hardhat.config.js`, plug in the following:

```javascript
module.exports = {
  networks: {
    gr1dTestnet: {
      url: "https://rpc-123420000418.raas-testnet.gelato.digital",
      accounts: [`0x${YOUR_PRIVATE_KEY}`], // Replace with your private key, keep it safe!
      chainId: 123420000418,
      gas: "auto",
      gasPrice: "auto",
    },
  },
  solidity: "0.8.26", // Make sure this matches your contracts
};
```

To deploy your contracts:

```bash
npx hardhat run scripts/deploy.js --network gr1dTestnet
```

**Truffle Configuration**

Update your `truffle-config.js` to include:

```javascript
module.exports = {
  networks: {
    gr1dTestnet: {
      provider: () => new HDWalletProvider("YOUR_MNEMONIC", "https://rpc-123420000418.raas-testnet.gelato.digital"),
      network_id: 123420000418, // GR1D Testnet Chain ID
      gas: 3000000, // Adjust this based on your contract's requirements
      gasPrice: 20000000000, // 20 gwei; tweak as needed
    },
  },
  compilers: {
    solc: {
      version: "0.8.26",
    },
  },
};
```

Deploy with:

```bash
truffle migrate --network gr1dTestnet
```

### 2. Checking Out the GR1D Testnet Explorer

Got your contracts deployed? Need to debug a transaction? Head over to the [**GR1D Testnet Explorer**](https://blockscout-123420000418.raas-testnet.gelato.digital/).&#x20;

It’s your go-to for viewing transactions, inspecting smart contracts, and seeing token transfers in action. If something doesn’t look right, this is where you’ll find the details.

#### Real-Time Event Tracking with WebSockets

For those wanting real-time updates, you can connect via the WebSocket endpoint:

* **WSS URL**: <wss://ws-123420000418.raas-testnet.gelato.digital>\
  Perfect for monitoring on-chain events or listening for contract events like NFT mints or DeFi protocol actions.

### 3. Bridging Assets on the GR1D Testnet

Ready to test out cross-chain functionality? Let’s bridge some assets between Sepolia (L1) and the GR1D Testnet (L2). It’s all done through the [GR1D Testnet Bridge](https://testnet-bridge.gelato.network/bridge/gr1d-testnet-1). Here’s how you do it:

1. **Connect MetaMask** to the Sepolia testnet.
2. Set up the bridge with:
   * **Source**: Sepolia Testnet (L1)
   * **Destination**: GR1D Testnet (L2)
3. **Choose your asset** (e.g., Sepolia ETH or any ERC-20 deployed there).
4. Enter the **amount** and confirm the transaction.
5. **Sign in MetaMask** and let the bridge do its thing. You should see the assets on GR1D Testnet in a few minutes.

### 4. Deploying Smart Contracts

Let’s get your smart contracts live on the GR1D Testnet. It’s straightforward if you’ve deployed on Ethereum before—same tooling, just a different network.

#### Step 1: Write Your Contracts

Make sure your Solidity version matches the one set in your Hardhat/Truffle config (I recommend `0.8.26`).

#### Step 2: Compile and Deploy

With Hardhat:

```bash
npx hardhat compile
```

```bash
npx hardhat run scripts/deploy.js --network gr1dTestnet
```

With Truffle:

```bash
truffle compile
```

```bash
truffle migrate --network gr1dTestnet
```

#### Step 3: Verify Your Deployment

Check the [GR1D Testnet Explorer](https://blockscout-123420000418.raas-testnet.gelato.digital/) to make sure everything’s in place. You’ll be able to see transaction details, contract interactions, and token transfers—perfect for debugging and validating your deployments.

### 5. Monitoring and Managing Network Activity

#### Key L1 and L2 Smart Contracts

GR1D’s architecture links L1 (Sepolia) and L2 (GR1D Testnet), and you might want to interact with the key contracts:

* **Batcher on L1**: [Batcher Contract](https://sepolia.etherscan.io/address/0xfbFbe73846784101809930E1a2f28cAc235E9F97)\
  This handles batching transactions and syncing state between L1 and L2.
* **Proposer on L1**: [Proposer Contract](https://sepolia.etherscan.io/address/0x0A4ABdE5C08063616c647424c606Bf6B58212153)\
  Submits state roots and keeps everything consistent between the GR1D Testnet and Sepolia.

### 6. Best Practices for Working with the Testnet

* **Use a Test Wallet**: Always keep a separate wallet for testnet activity. Keeps things tidy and avoids accidental mainnet confusion.
* **Test Everything**: The GR1D Testnet is built for experimentation. Push the limits—bridge assets, deploy contracts, and simulate real-world scenarios.
* **Use the Explorer**: Don’t skip the [GR1D Testnet Explorer](https://blockscout-123420000418.raas-testnet.gelato.digital/). It’s your best friend for transaction logs, contract validation, and debugging.
