# Quickstart

Разверните свой первый контракт Solidity в Rome EVM менее чем за 5 минут.

## Требования

* [Node.js](https://nodejs.org/) v18+
* [MetaMask](https://metamask.io/) расширение для браузера
* Кошелёк Solana с devnet SOL (для газа)

## 1. Добавьте сеть Rome в MetaMask

Откройте MetaMask → Настройки → Сети → Добавить сеть:

| Поле                | Значение                                   |
| ------------------- | ------------------------------------------ |
| Имя сети            | Rome Devnet                                |
| RPC URL             | `https://montispl.devnet.romeprotocol.xyz` |
| ID сети             | `200002`                                   |
| Символ валюты       | `RSOL`                                     |
| Обозреватель блоков | —                                          |

## 2. Пополните ваш кошелёк

Внесите devnet SOL на ваш адрес Rome EVM через [интерфейс пополнения](https://deposit.devnet.romeprotocol.xyz). Подключите ваш кошелёк Solana (с devnet SOL) и MetaMask, затем введите сумму для пополнения. Интерфейс конвертирует SOL в RSOL в соотношении 1:1 и зачислит средства на ваш EVM-адрес.

## 3. Создайте проект Hardhat

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

При появлении запроса выберите «Create a JavaScript project».

## 4. Настройте Hardhat для Rome

Отредактируйте `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],
    },
  },
};
```

Экспортируйте ваш приватный ключ MetaMask:

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

## 5. Напишите контракт

Создайте `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. Разверните

Создайте `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);

  // Вызовите контракт
  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;
});
```

Разверните в Rome devnet:

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

Ожидаемый результат:

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

Ваш контракт Solidity теперь работает в Solana.

## Что дальше

* [Развернуть Solidity](/ru/rukovodstva-dlya-razrabotchikov/deploy-solidity.md) — подробное руководство по развёртыванию с Foundry и Hardhat
* [Вызов Solana из EVM](/ru/rukovodstva-dlya-razrabotchikov/call-solana-from-evm.md) — используйте CPI для вызова Jupiter, Kamino и других программ Solana из Solidity
* [Архитектура](/ru/nachalo-raboty/architecture.md) — поймите, как Rome EVM работает под капотом

## Распространённые ошибки

| Ошибка                 | Причина                                    | Исправление                                                                       |
| ---------------------- | ------------------------------------------ | --------------------------------------------------------------------------------- |
| `недостаточно средств` | У EVM-адреса нет баланса                   | Внесите SOL через интерфейс пополнения                                            |
| `nonce too low`        | Несоответствие nonce транзакции            | Сбросьте аккаунт MetaMask (Настройки → Расширенные → Очистить историю активности) |
| `execution reverted`   | Выполнение контракта завершилось с ошибкой | Проверьте логику контракта; используйте `eth_call` для отладки                    |
| Тайм-аут соединения    | Недоступна RPC-точка входа                 | Проверьте URL сети; убедитесь, что devnet работает                                |


---

# 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/ru/nachalo-raboty/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.
