0Pricing
Web3 & DApp Development Fundamentals · Lektion

Einführung in Solidity

Verschaffen Sie sich einen Überblick über Syntax und Struktur von Solidity sowie über die grundlegende Deklaration von Contracts, einschließlich der Schlüsselwörter pragma und contract.

Einführung in Solidity ist eine kostenlose Web3 & DApp Development Fundamentals-Lektion auf CoddyKit. Dies ist Lektion 1 von 3. 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 Web3 & DApp Development Fundamentals-Lernpfads, und dein Fortschritt wird über Web und CoddyKit-App synchronisiert. Der Web3 & DApp Development Fundamentals-Kurs umfasst insgesamt 3 Lektionen.

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

Meet Solidity: Language of Smart Contracts

Welcome to Solidity! It's the primary language for writing smart contracts on blockchain platforms like Ethereum.

Think of smart contracts as self-executing agreements stored on a blockchain. Learning Solidity opens the door to building decentralized applications (DApps).

Why Solidity Matters

Solidity is a high-level, object-oriented language. It's specifically designed to implement business logic for DApps.

It enables you to create digital tokens, build decentralized finance (DeFi) protocols, and manage digital assets securely on a blockchain.

Your First Solidity File

Every Solidity smart contract lives in a file ending with the .sol extension.

  • Just like a .js file for JavaScript.
  • Or a .py file for Python.
  • The first line of a Solidity file often defines the compiler version to be used.

The Pragma Directive

The pragma directive is crucial. It tells the Solidity compiler which version to use for your contract.

For example, pragma solidity ^0.8.0; means "use any compiler version from 0.8.0 up to, but not including, 0.9.0."

This ensures your contract compiles predictably and avoids unexpected behavior from future compiler changes.

Declaring a Contract

In Solidity, the fundamental building block for your smart contract is the contract keyword.

  • It's similar to a "class" in object-oriented programming languages.
  • Your entire smart contract's logic, including variables and functions, will live inside a contract block.

Our First Basic Contract

Let's put pragma and contract together. This is the most basic, yet complete, Solidity contract you can write.

It doesn't do much yet, but it's ready to be compiled and deployed!

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

contract MyFirstContract {
  // This contract is currently empty!
}

Comments in Solidity

Comments help explain your code to others and your future self. They are ignored by the compiler.

  • Single-line comments start with //.
  • Multi-line comments are enclosed by /* and */.
  • The SPDX-License-Identifier is a special comment used to specify the contract's license.

Contract Name & Structure

Contract names usually start with an uppercase letter, following common programming conventions (e.g., MyFirstContract).

The code inside the curly braces {} defines the contract's logic. This is where you'll add state variables, functions, and events as you learn more.

Quick Check: Pragma Purpose

The pragma solidity ^0.8.0; line is essential for smart contract development. What is its primary role?

Recap: Your Solidity Journey Begins!

You've learned the very basics of Solidity!

  • We covered the .sol file extension.
  • The critical pragma directive for compiler versions.
  • The fundamental contract keyword.
  • How to add comments for code clarity.

Next, we'll dive deeper into variables and data types!

Häufig gestellte Fragen

Ist die Lektion „Einführung in Solidity“ kostenlos?

Ja — der vollständige Text von „Einführung in Solidity“ ist hier im Web kostenlos zu lesen. Um sie interaktiv zu üben (integrierter Code-Editor und 24/7 KI-Tutor) und den Rest des Web3 & DApp Development Fundamentals-Kurses freizuschalten, upgrade auf CoddyKit PRO. Der Web3 & DApp Development Fundamentals-Kurs umfasst insgesamt 3 Lektionen.

Was lerne ich in „Einführung in Solidity“?

Verschaffen Sie sich einen Überblick über Syntax und Struktur von Solidity sowie über die grundlegende Deklaration von Contracts, einschließlich der Schlüsselwörter pragma und contract. Du übst Web3 & DApp Development Fundamentals 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 Web3 & DApp Development Fundamentals zu starten?

Keine Vorkenntnisse erforderlich. Web3 & DApp Development Fundamentals 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 1 von 3.

Wie lange dauert die Lektion „Einführung in Solidity“?

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 Web3 & DApp Development Fundamentals-Lektion Code schreiben und ausführen?

Ja. Jede Web3 & DApp Development Fundamentals-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. Einführung in Solidity
  2. Variablen und Datentypen
  3. Funktionen und Kontrollstrukturen
← Zurück zu Web3 & DApp Development Fundamentals