Your very first steps with Move on Sui — no blockchain experience needed. We'll start from scratch and build up to your first smart contract.
Before we write any code, let's make sure we're on the same page. A smart contract is just a program that runs on a blockchain instead of on your computer or a server. Once you publish it, anyone in the world can use it, and nobody — not even you — can secretly change how it works. That's what makes it "smart": the rules are transparent and enforced by code. On Sui, these programs are written in a language called Move.
In Move, your code lives inside a "module." A module is just a container — like a file folder — that holds your data definitions and functions together. You give your module a name, and everything related to one feature goes inside it. For example, you might have a module called `greeter` that handles greeting messages, or a module called `counter` that tracks a count. Modules are grouped into "packages" (a package is just a collection of related modules that you publish together). Let's look at what a simple module looks like:
Every Sui smart contract uses a few common building blocks from the Sui framework. Think of these as tools in your toolbox. You don't need to memorize them — you'll get familiar with them through practice. Here are the four you'll see most often:
Functions are where the action happens. A function is a reusable block of code that does something — like "create a greeting" or "add two numbers." In Move, you declare a function with the `fun` keyword, give it a name, and put your code inside curly braces. If your function needs input, you list the parameters in parentheses. If it produces a result, you specify the return type after a colon. Let's see three simple examples:
Not every function should be callable by everyone. Move lets you control access with visibility modifiers — keywords you put before `fun`. Think of it like permissions: some functions are internal helpers that only your own code should use, while others are the public-facing buttons that users press. Here are the ones that matter most:
When someone uses your smart contract — say, from a wallet app — they're calling an `entry` function. It's the connection between the real world and your on-chain code. There's one special thing about entry functions on Sui: the last parameter is usually `ctx: &mut TxContext`. You don't need to understand this deeply yet — just know that `ctx` is automatically provided by Sui and tells your function who is calling it. Let's see a complete example:
Every programming language has basic data types, and Move is no different. The main number type is `u64` — an unsigned (no negative numbers) 64-bit integer. It can hold values from 0 up to about 18.4 quintillion, which is plenty for most things. Move also has smaller and bigger number types (`u8` for small values like ages, `u128` and `u256` for huge numbers used in crypto math), and `bool` for true/false values. One important thing: Move has NO negative numbers. This is a safety feature — it eliminates a whole category of bugs where numbers accidentally go below zero.
On Sui, every wallet and every object has a unique address — a long string of letters and numbers that looks like `0x7d3ab...`. Think of it like a mailing address: it tells the blockchain where to find something or where to send something. In your code, you'll use the `address` type when you need to know who's calling your contract or where to send an object. The most common way to get an address is `tx_context::sender(ctx)` — this gives you the address of the person who called your function.
Time to see everything working together in one example. This module creates a simple profile on the blockchain. Read through the code — every line has an explanation. Notice how we use `u8` for age (because ages fit in 0-255), `vector<u8>` for the name (Move's way of storing text — more on this in the next lesson), and `address` to know who the profile belongs to.