> 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/de/entwicklerleitfaden/deploy-solidity.md).

# Solidity-Verträge deployen

Dieser Leitfaden behandelt die Bereitstellung von Solidity-Smart-Contracts auf Rome EVM mit Hardhat und Foundry.

## Voraussetzungen

* Node.js v22.13+ (Hardhat) oder Foundry installiert
* Eine finanzierte Rome-EVM-Adresse (siehe [Schnellstart](/de/erste-schritte/quickstart.md))
* Dein als Umgebungsvariable exportierter privater Schlüssel

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

## Netzwerkkonfiguration

| Netzwerk          | RPC-URL                                     | Chain-ID |
| ----------------- | ------------------------------------------- | -------- |
| Lokal             | `http://localhost:9090`                     | `1001`   |
| Hadrian (Devnet)  | `https://hadrian.testnet.romeprotocol.xyz/` | `200010` |
| Martius (Testnet) | `https://martius.testnet.romeprotocol.xyz/` | `121214` |

## Hardhat

### Einrichtung

```bash
mkdir my-rome-project && cd my-rome-project
npx hardhat --init
```

Die Standardeinstellungen akzeptieren (Hardhat 3, aktuelles Verzeichnis, TypeScript + viem-Template); Abhängigkeiten werden automatisch installiert.

### hardhat.config.ts

```typescript
import hardhatToolboxViemPlugin from "@nomicfoundation/hardhat-toolbox-viem";
import { configVariable, defineConfig } from "hardhat/config";

export default defineConfig({
  plugins: [hardhatToolboxViemPlugin],
  solidity: {
    profiles: {
      default: { version: "0.8.28" },
      production: {
        version: "0.8.28",
        settings: { optimizer: { enabled: true, runs: 200 } },
      },
    },
  },
  networks: {
    rome_local: {
      type: "http",
      chainType: "l1",
      chainId: 1001,
      url: "http://localhost:9090",
      accounts: [configVariable("PRIVATE_KEY")],
    },
    hadrian: {
      type: "http",
      chainType: "l1",
      chainId: 200010,
      url: "https://hadrian.testnet.romeprotocol.xyz/",
      accounts: [configVariable("PRIVATE_KEY")],
    },
    martius: {
      type: "http",
      chainType: "l1",
      chainId: 121214,
      url: "https://martius.testnet.romeprotocol.xyz/",
      accounts: [configVariable("PRIVATE_KEY")],
    },
  },
});
```

`configVariable("PRIVATE_KEY")` wird aus der Umgebung aufgelöst (oder aus dem verschlüsselten Keystore — `npx hardhat keystore set PRIVATE_KEY`).

### Bereitstellen

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

### Im Block-Explorer verifizieren

```bash
npx hardhat verify --network martius 0xCONTRACT_ADDRESS
```

Benötigt die Sourcify-Verifier-Konfiguration von [Contracts verifizieren](/de/entwicklerleitfaden/verify-contracts.md) in deinem `hardhat.config.ts`.

## Foundry

### Einrichtung

```bash
forge init my-rome-project
cd my-rome-project
```

### Bereitstellen

```bash
# Lokal
forge create --rpc-url http://localhost:9090 \\
  --private-key $PRIVATE_KEY \\
  src/Counter.sol:Counter

# Devnet
forge create --rpc-url https://hadrian.testnet.romeprotocol.xyz/ \\
  --private-key $PRIVATE_KEY \\
  src/Counter.sol:Counter
```

### Bereitgestellten Vertrag aufrufen

```bash
# Lesen
cast call 0xCONTRACT_ADDRESS "number()" \\
  --rpc-url https://hadrian.testnet.romeprotocol.xyz/

# Schreiben
cast send 0xCONTRACT_ADDRESS "increment()" \\
  --rpc-url https://hadrian.testnet.romeprotocol.xyz/ \\
  --private-key $PRIVATE_KEY
```

## Verwendung des Rome-Solidity-SDK

Für Verträge, die mit Solana-Programmen interagieren, verwende die Schnittstellen aus dem öffentlichen [`rome-solidity`](https://github.com/rome-protocol/rome-solidity) Repo (npm-Veröffentlichung ausstehend):

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

import {ICrossProgramInvocation, IHelperProgram}
    from "@rome-protocol/rome-solidity/contracts/interface.sol";

contract MyRomeContract {
    IHelperProgram constant Helper =
        IHelperProgram(0xFF00000000000000000000000000000000000009);
    ICrossProgramInvocation constant Cpi =
        ICrossProgramInvocation(0xFF00000000000000000000000000000000000008);

    // Übertrage ein SPL-Token aus der PDA des Aufrufenden
    function moveSpl(address to, uint64 tokens, bytes32 mint) external {
        Helper.transfer_spl(to, tokens, mint);
    }

    // Beliebiges Solana-Programm per CPI aufrufen
    function callSolanaProgram(
        bytes32 programId,
        ICrossProgramInvocation.AccountMeta[] calldata accounts,
        bytes calldata data
    ) external {
        Cpi.invoke(programId, accounts, data);
    }
}
```

## Bestehendes Protokoll übernehmen

Jeder Solidity-Vertrag lässt sich auf Rome unverändert bereitstellen — ein Compliance-Vertrag, ein DeFi-Protokoll oder eine bestehende, gehärtete Anwendung. Zwei Produktionsbeispiele, die du mit demselben Hardhat-/Foundry-Flow oben forken und bereitstellen kannst:

* [**compound-on-rome-comet**](https://github.com/rome-protocol/compound-on-rome-comet) — das kanonische Compound v3 (Comet), Standard-Foundry.
* [**rome-aave-v3**](https://github.com/rome-protocol/rome-aave-v3) — das kanonische Aave v3.

Beide erhalten Solana-Ausführung und CPI-Komponierbarkeit ohne Vertragsänderungen.

## Bereitstellungsbeschränkungen

| Beschränkung                 | Limit                  | Hinweise                                                               |
| ---------------------------- | ---------------------- | ---------------------------------------------------------------------- |
| Maximale Vertragsgröße       | 24 KB                  | Wie bei Ethereum (EIP-170, 24.576 Bytes)                               |
| Grenze für Transaktionsgröße | 80 KB pro Holder       | Große Bereitstellungen werden transparent auf Holder-Konten aufgeteilt |
| Compute-Budget               | \~1,4 Mio. CU (atomar) | Verwende den iterativen Modus für aufwendige Verträge                  |
| Solidity-Version             | 0.8.28 empfohlen       | Frühere Versionen funktionieren, aber 0.8.28 entspricht dem SDK        |

## Häufige Fehler

| Fehler                            | Ursache                        | Behebung                                                                                                                     |
| --------------------------------- | ------------------------------ | ---------------------------------------------------------------------------------------------------------------------------- |
| `unzureichende Mittel für Gas`    | EVM-Adresse hat kein Gas-Token | Wickle Gas über die [Rome App](https://app.devnet.romeprotocol.xyz) (siehe [Schnellstart](/de/erste-schritte/quickstart.md)) |
| `nonce zu niedrig`                | Veraltete Nonce in der Wallet  | Setze das MetaMask-Konto zurück oder gib die Nonce manuell an                                                                |
| `Ausführung rückgängig gemacht`   | Vertragslogik fehlgeschlagen   | Debugge mit `eth_call` oder `forge test --fork-url`                                                                          |
| `Transaktion zu niedrig bepreist` | Gaspreis unter dem Minimum     | Erhöhe den Gaspreis in der Transaktion                                                                                       |

## Was kommt als Nächstes

* [Rufe Solana aus der EVM auf](/de/entwicklerleitfaden/call-solana-from-evm.md) — verwende CPI-Precompiles, um mit Solana-Programmen zu interagieren
* [Contracts verifizieren](/de/entwicklerleitfaden/verify-contracts.md) — veröffentliche deinen Quellcode im Block-Explorer


---

# 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/de/entwicklerleitfaden/deploy-solidity.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.
