0Pricing
Blockchain Smart Contracts with Solidity · Lektion

Ihr erster Solidity-Contract

Schreiben und kompilieren Sie mit der Remix IDE einen einfachen „Hello World“-Smart-Contract und sammeln Sie praktische Erfahrungen mit der Solidity-Syntax.

Ihr erster Solidity-Contract ist eine kostenlose Blockchain Smart Contracts with Solidity-Lektion auf CoddyKit. Dies ist Lektion 3 von 4. Du kannst die komplette Lektion unten kostenlos lesen – dann übst du sie direkt im Browser mit einem integrierten Code-Editor und einem KI-Tutor rund um die Uhr. Sie ist Teil des Blockchain Smart Contracts with Solidity-Lernpfads, und dein Fortschritt wird über Web und CoddyKit-App synchronisiert. Der Blockchain Smart Contracts with Solidity-Kurs umfasst insgesamt 4 Lektionen.

Teile dieser Lektion wurden noch nicht übersetzt und werden auf Englisch angezeigt.

Your First Smart Contract!

Time to write your first smart contract! We'll build a simple Hello World in Solidity using the browser-based Remix IDE - no setup needed.

Meet Remix IDE

Remix IDE lets you write, compile, debug, and deploy Solidity contracts right in your browser. It's perfect for learning and quick prototyping.

Solidity Version Pragma

Every Solidity file opens with a pragma that pins the compiler version. The code below means versions 0.8.0 up to (but not including) 0.9.0 are allowed.

pragma solidity ^0.8.0;

Defining Your Contract

Solidity code lives inside a contract, much like a class in OOP. You declare it with the contract keyword, a name, and curly braces, as shown.

contract MyFirstContract {
  // Your contract's code goes here
}

Adding a State Variable

A state variable is stored permanently on chain and defines your contract's state. Here we add a string called greeting; public makes it readable by anyone.

contract MyFirstContract {
  string public greeting;
}

The Constructor Function

The constructor runs exactly once, at deployment, to initialize state. Here it sets greeting to "Hello CoddyKit!" the moment the contract goes live.

contract MyFirstContract {
  string public greeting;

  constructor() {
    greeting = "Hello CoddyKit!";
  }
}

Writing a View Function

A view function reads contract state without changing it. This getGreeting is public and returns a string from memory, as shown below.

contract MyFirstContract {
  string public greeting;

  constructor() {
    greeting = "Hello CoddyKit!";
  }

  function getGreeting() public view returns (string memory) {
    return greeting;
  }
}

Our Full 'Hello World' Contract

Here's the full Hello World contract. Paste it into Remix, compile, deploy to a test chain, then call getGreeting() to see it work.

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

contract SimpleGreeting {
  string public greeting;

  constructor() {
    greeting = "Hello CoddyKit!";
  }

  function getGreeting() public view returns (string memory) {
    return greeting;
  }
}

Compiling Your Contract

Before deploying, a contract must be compiled - turning your Solidity into EVM bytecode. Remix has a built-in compiler with a handy Auto compile option.

Quick Check: Contract Structure

Which part of a Solidity smart contract specifies the minimum compatible compiler version?

Recap: Your First Contract

Recap: you built a Solidity contract with a pragma, a contract block, a state variable, a constructor, and a view function - all in Remix. Nice work!

Häufig gestellte Fragen

Ist die Lektion „Ihr erster Solidity-Contract“ kostenlos?

Ja — der vollständige Text von „Ihr erster Solidity-Contract“ ist hier im Web kostenlos zu lesen. Um sie interaktiv zu üben (integrierter Code-Editor und 24/7 KI-Tutor) und den Rest des Blockchain Smart Contracts with Solidity-Kurses freizuschalten, upgrade auf CoddyKit PRO. Der Blockchain Smart Contracts with Solidity-Kurs umfasst insgesamt 4 Lektionen.

Was lerne ich in „Ihr erster Solidity-Contract“?

Schreiben und kompilieren Sie mit der Remix IDE einen einfachen „Hello World“-Smart-Contract und sammeln Sie praktische Erfahrungen mit der Solidity-Syntax. Du übst Blockchain Smart Contracts with Solidity mit praktischem Code, den du direkt im Browser ausführst, und ein 24/7 KI-Tutor beantwortet deine Fragen während du die Lektion bearbeitest.

Brauche ich Erfahrung, um Blockchain Smart Contracts with Solidity zu starten?

Keine Vorkenntnisse erforderlich. Blockchain Smart Contracts with Solidity auf CoddyKit ist für Anfänger bis fortgeschrittene Lernende strukturiert, sodass du hier starten oder von Anfang an beginnen und in deinem eigenen Tempo voranschreiten kannst. Dies ist Lektion 3 von 4.

Wie lange dauert die Lektion „Ihr erster Solidity-Contract“?

Die meisten CoddyKit-Lektionen dauern etwa 5–10 Minuten. Jede ist kompakt und interaktiv, sodass du stetig Fortschritte machst und genau dort weitermachst, wo du aufgehört hast – im Web und in der App.

Kann ich in dieser Blockchain Smart Contracts with Solidity-Lektion Code schreiben und ausführen?

Ja. Jede Blockchain Smart Contracts with Solidity-Lektion enthält einen integrierten Code-Editor, sodass du echten Code direkt in deinem Browser schreibst und ausführst und sofort KI-Feedback erhältst — ohne lokale Einrichtung erforderlich.

Alle Lektionen in diesem Kurs

  1. Was ist Blockchain-Technologie?
  2. Ethereum-Grundlagen und EVM
  3. Ihr erster Solidity-Contract
  4. Wallets, Schlüssel und Transaktionen
← Zurück zu Blockchain Smart Contracts with Solidity