# Quickstart

Deploy your first Solidity contract on Rome EVM in under 5 minutes.

## Prerequisites

* [Node.js](https://nodejs.org/) v18+
* [MetaMask](https://metamask.io/) browser extension
* A Solana wallet with devnet SOL (for gas)

## 1. Add Rome Network to MetaMask

Open MetaMask → Settings → Networks → Add Network:

| Field           | Value                                      |
| --------------- | ------------------------------------------ |
| Network Name    | Rome Devnet                                |
| RPC URL         | `https://montispl.devnet.romeprotocol.xyz` |
| Chain ID        | `200002`                                   |
| Currency Symbol | `RSOL`                                     |
| Block Explorer  | —                                          |

## 2. Fund Your Wallet

Deposit devnet SOL to your Rome EVM address via the [deposit UI](https://deposit.devnet.romeprotocol.xyz). Connect your Solana wallet (with devnet SOL) and your MetaMask, then enter the amount to deposit. The UI converts SOL to RSOL at 1:1 and credits your EVM address.

## 3. Create a Hardhat Project

```bash
mkdir rome-hello && cd rome-hello
npm init -y
npm install --save-dev hardhat @nomicfoundation/hardhat-toolbox
npx hardhat init
```

Select "Create a JavaScript project" when prompted.

## 4. Configure Hardhat for Rome

Edit `hardhat.config.js`:

```javascript
require("@nomicfoundation/hardhat-toolbox");

module.exports = {
  solidity: "0.8.28",
  networks: {
    rome_devnet: {
      url: "https://montispl.devnet.romeprotocol.xyz",
      chainId: 200002,
      accounts: [process.env.PRIVATE_KEY],
    },
    rome_local: {
      url: "http://localhost:9090",
      chainId: 1001,
      accounts: [process.env.PRIVATE_KEY],
    },
  },
};
```

Export your MetaMask private key:

```bash
export PRIVATE_KEY="0xYOUR_PRIVATE_KEY"
```

## 5. Write a Contract

Create `contracts/HelloRome.sol`:

```solidity
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;

contract HelloRome {
    string public greeting = "Hello from Solana!";
    uint256 public counter;

    event Greeted(address indexed sender, uint256 count);

    function greet() external returns (string memory) {
        counter++;
        emit Greeted(msg.sender, counter);
        return greeting;
    }

    function setGreeting(string calldata _greeting) external {
        greeting = _greeting;
    }
}
```

## 6. Deploy

Create `scripts/deploy.js`:

```javascript
const hre = require("hardhat");

async function main() {
  const HelloRome = await hre.ethers.getContractFactory("HelloRome");
  const hello = await HelloRome.deploy();
  await hello.waitForDeployment();

  const address = await hello.getAddress();
  console.log("HelloRome deployed to:", address);

  // Call the contract
  const tx = await hello.greet();
  await tx.wait();

  const count = await hello.counter();
  console.log("Counter:", count.toString());

  const greeting = await hello.greeting();
  console.log("Greeting:", greeting);
}

main().catch((error) => {
  console.error(error);
  process.exitCode = 1;
});
```

Deploy to Rome devnet:

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

Expected output:

```
HelloRome deployed to: 0x5FbDB2315678afecb367f032d93F642f64180aa3
Counter: 1
Greeting: Hello from Solana!
```

Your Solidity contract is now running on Solana.

## What's Next

* [Deploy Solidity](/developer-guides/deploy-solidity.md) — detailed deployment guide with Foundry and Hardhat
* [Call Solana from EVM](/developer-guides/call-solana-from-evm.md) — use CPI to call Jupiter, Kamino, and other Solana programs from Solidity
* [Architecture](/getting-started/architecture.md) — understand how Rome EVM works under the hood

## Common Errors

| Error                | Cause                      | Fix                                                           |
| -------------------- | -------------------------- | ------------------------------------------------------------- |
| `insufficient funds` | EVM address has no balance | Deposit SOL via the deposit UI                                |
| `nonce too low`      | Transaction nonce mismatch | Reset MetaMask account (Settings → Advanced → Clear Activity) |
| `execution reverted` | Contract execution failed  | Check contract logic; use `eth_call` to debug                 |
| Connection timeout   | RPC endpoint unreachable   | Verify network URL; check if devnet is operational            |


---

# 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.rome.builders/getting-started/quickstart.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.
