# Cairo Level 6: Starknet Contracts

> Level 6: Starknet Contracts of the LoWisa Cairo course: Contract Structure, Storage, External Functions. 3 lessons and 9 ideas, each explained in one line.

Starknet Contracts is level 6 of 14 of the [LoWisa Cairo course](/courses/cairo/). It has 3 lessons and 9 ideas. Below is every lesson and what it teaches, in one line each.

## Contract Structure

- **Contract modules.** A Starknet contract is a module with the **#[starknet::contract]** attribute: state plus entry points.
- **Storage struct.** The **Storage** struct declares persistent state: every field a storage variable.
- **Constructor.** The **constructor** runs once at deployment: initial owners and parameters written into storage.

## Storage

- **Reads and writes.** State reads with self.field.**read()** and writes with write: access explicit, costs visible.
- **Storage mappings.** A storage **Map** keys values by address or id: balances and ownership tables.
- **Storage packing.** Storage slots cost: **packing** small fields and lean layouts are money, as on every chain.

## External Functions

- **external and view.** **#[external]** functions mutate state; view functions promise reads only: the ABI surface.
- **Contract state parameter.** Entry points receive **self**: ContractState threading storage access through signatures.
- **Inputs validated.** Every external input is **untrusted**: validated before any storage write, always.

## Before and after this level

- **Before:** [Level 5: Modules & Packages](/courses/cairo/level-5-modules-and-packages/): Modules, Scarb, Package Organisation.
- **Next:** [Level 7: Events & Contract Interaction](/courses/cairo/level-7-events-and-contract-interaction/): Events, Dispatchers and Interfaces, Contract-to-Contract Communication.

In the app each of these ideas is taught and then asked back, and the level ends with a checkpoint and flashcards. See [Checkpoints and flashcards](/help/checkpoints-and-flashcards/).

## Frequently asked questions

### What does Cairo Level 6: Starknet Contracts cover?

Contract Structure, Storage, External Functions: 3 lessons and 9 ideas.

### What should I know before this level?

The level before it, Level 5: Modules & Packages, which covers Modules, Scarb, Package Organisation.

## Learn Cairo on your phone

The first level is free. LoWisa is on Google Play and the App Store.

---

Source: https://lowisa.dev/courses/cairo/level-6-starknet-contracts/ · Updated 2026-11-30
