> For the complete documentation index, see [llms.txt](https://docs.rome.builders/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.rome.builders/ru/nachalo-raboty/quickstart.md).

# Быстрый старт

Разверните свой первый контракт Solidity в Rome менее чем за 5 минут. Это руководство предназначено для **Martius**, публичной тестовой сети; те же шаги работают и на [Hadrian](/ru/seti/hadrian.md) (devnet), просто заменив значения сети.

## Предварительные требования

* [Node.js](https://nodejs.org/) v22.13+
* [MetaMask](https://metamask.io/) расширение браузера
* Кошелек Solana (например, Phantom), настроенный на **Devnet**

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

Добавьте его вручную (Настройки → Сети → Добавить сеть):

| Поле                | Значение                                        |
| ------------------- | ----------------------------------------------- |
| Имя сети            | Rome Martius                                    |
| URL RPC             | `https://martius.testnet.romeprotocol.xyz/`     |
| ID цепочки          | `121214`                                        |
| Символ валюты       | `USDC`                                          |
| Обозреватель блоков | `https://via-martius.testnet.romeprotocol.xyz/` |

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

Газ оплачивается токеном SPL gas token сети (USDC в Martius). Есть два способа получить его:

**Из Solana** — получите devnet SOL из [Solana faucet](https://faucet.solana.com/) (установите для кошелька Solana режим Devnet), затем откройте [приложение Rome](https://app.testnet.romeprotocol.xyz), подключите оба кошелька и оберните их в газовый токен.

**Через мост** — отчеканьте тестовый USDC в Ethereum Sepolia из [крана Circle](https://faucet.circle.com/), затем перенесите его в Rome через [Rome Bridge](/ru/prilozheniya-na-rome/bridge-api.md) (CCTP). Для исходящей транзакции вам понадобится немного Sepolia ETH — см. [Краны](/ru/resursy/faucets.md) для каждого крана.

**Сколько?** Развертывания контрактов в Rome несут издержки на стороне аккаунтов Solana, поэтому оценки газа значительно выше, чем предполагает интуиция Ethereum — для быстрого старта контракт оценивается примерно в \~20M gas и обходится примерно в **0.2 USDC** за развертывание, а кошельки заранее проверяют примерно вдвое большую оценку. Пополните как минимум **0.5 USDC на газ**; 1 USDC оставит комфортный запас.

Если депозит на стороне Solana завершается с предупреждением «insufficient SOL», несмотря на пополненный кошелек, установите для своего кошелька Solana режим Testnet Mode / Devnet (см.  [Часто задаваемые вопросы](/ru/resursy/faq.md)).

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

```bash
mkdir rome-hello && cd rome-hello
npx hardhat --init
```

Примите значения по умолчанию при появлении запроса — Hardhat 3, текущий каталог и шаблон TypeScript + Node Test Runner + viem — и дайте ему установить зависимости. В шаблон включен пример `Counter` контракта с тестами; они не мешают этому руководству.

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

Отредактируйте сгенерированный `hardhat.config.ts` и добавьте сети Rome внутри `defineConfig({ ... })`:

```typescript
  networks: {
    martius: {
      type: "http",
      chainType: "l1",
      chainId: 121214,
      url: "https://martius.testnet.romeprotocol.xyz/",
      accounts: [configVariable("PRIVATE_KEY")],
    },
    rome_local: {
      type: "http",
      chainType: "l1",
      chainId: 1001,
      url: "http://localhost:9090",
      accounts: [configVariable("PRIVATE_KEY")],
    },
  },
```

`configVariable("PRIVATE_KEY")` разрешается из окружения, поэтому экспортируйте свой приватный ключ MetaMask:

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

(Для всего, что кроме одноразового ключа, лучше использовать зашифрованное хранилище, поставляемое с toolbox: `npx hardhat keystore set PRIVATE_KEY`.)

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

Создайте `contracts/HelloRome.sol`:

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

contract HelloRome {
    string public greeting = "Привет из 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.ts`:

```typescript
import hardhat from "hardhat";

async function main() {
  const { viem } = await hardhat.network.connect();
  const publicClient = await viem.getPublicClient();

  const hello = await viem.deployContract("HelloRome");
  console.log("HelloRome развернут по адресу:", hello.address);

  const hash = await hello.write.greet();
  await publicClient.waitForTransactionReceipt({ hash });

  console.log("Счетчик:", (await hello.read.counter()).toString());
  console.log("Приветствие:", await hello.read.greeting());
}

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

Развернуть в Martius:

```bash
npx hardhat run scripts/deploy.ts --network martius
```

Ожидаемый вывод (ваш адрес будет отличаться):

```
HelloRome развернут по адресу: 0x09c437e305eeb698e1776cff23ca16c1bb25aabd
Счетчик: 1
Приветствие: Привет из Solana!
```

Откройте развернутый адрес в [обозревателе](https://via-martius.testnet.romeprotocol.xyz/) чтобы увидеть инструкции Solana, лежащие за вашей транзакцией. Теперь ваш контракт Solidity работает в Solana.

## Что дальше

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

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

| Ошибка                    | Причина                                                                           | Исправление                                                                                                              |
| ------------------------- | --------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------ |
| `недостаточно средств`    | Недостаточно газового токена — кошельки заранее проверяют примерно 2× оценку газа | Пополните как минимум 0.5 USDC на газ (см. шаг 2) через [приложение Rome](https://app.testnet.romeprotocol.xyz) или мост |
| `слишком маленький nonce` | Несоответствие nonce транзакции                                                   | Сбросьте учетную запись (MetaMask → Настройки → Дополнительно → Очистить активность)                                     |
| `выполнение отменено`     | Выполнение контракта завершилось сбоем                                            | Проверьте логику контракта; используйте `eth_call` для отладки                                                           |
| Тайм-аут соединения       | RPC недоступен                                                                    | Проверьте URL RPC                                                                                                        |


---

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