# بداية سريعة

انشر أول عقد Solidity الخاص بك على Rome EVM في أقل من 5 دقائق.

## المتطلبات الأساسية

* [Node.js](https://nodejs.org/) v18+
* [MetaMask](https://metamask.io/) إضافة متصفح
* محفظة Solana تحتوي على devnet SOL (للغاز)

## 1. أضف شبكة Rome إلى MetaMask

افتح MetaMask → الإعدادات → الشبكات → إضافة شبكة:

| الحقل         | القيمة                                     |
| ------------- | ------------------------------------------ |
| اسم الشبكة    | Rome Devnet                                |
| عنوان RPC     | `https://montispl.devnet.romeprotocol.xyz` |
| معرّف السلسلة | `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 إلى:", address);

  // استدعِ العقد
  const tx = await hello.greet();
  await tx.wait();

  const count = await hello.counter();
  console.log("العداد:", count.toString());

  const greeting = await hello.greeting();
  console.log("التحية:", greeting);
}

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

انشر على Rome devnet:

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

المخرجات المتوقعة:

```
تم نشر HelloRome إلى: 0x5FbDB2315678afecb367f032d93F642f64180aa3
العداد: 1
التحية: Hello from Solana!
```

عقد Solidity الخاص بك يعمل الآن على Solana.

## ما التالي

* [نشر Solidity](/ar/adlh-almtwryn/deploy-solidity.md) — دليل نشر مفصل باستخدام Foundry وHardhat
* [استدعِ Solana من EVM](/ar/adlh-almtwryn/call-solana-from-evm.md) — استخدم CPI لاستدعاء Jupiter وKamino وبرامج Solana الأخرى من Solidity
* [البنية المعمارية](/ar/albda/architecture.md) — افهم كيف يعمل Rome EVM من الداخل

## الأخطاء الشائعة

| الخطأ                | السبب                           | الإصلاح                                                   |
| -------------------- | ------------------------------- | --------------------------------------------------------- |
| `أموال غير كافية`    | عنوان EVM لا يحتوي على رصيد     | أودِع SOL عبر واجهة الإيداع                               |
| `nonce منخفض جدًا`   | عدم تطابق nonce للمعاملة        | أعد تعيين حساب MetaMask (الإعدادات → متقدم → مسح النشاط)  |
| `execution reverted` | فشل تنفيذ العقد                 | تحقق من منطق العقد؛ استخدم `eth_call` لأغراض التصحيح      |
| انتهت مهلة الاتصال   | نقطة نهاية RPC غير قابلة للوصول | تحقق من عنوان الشبكة؛ وتحقق مما إذا كانت شبكة 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/ar/albda/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.
