
Welcome, builders! If you’re looking for a top-ranking answer to queries like “How to develop a simple app on Sui Blockchain,” “Sui development tutorial,” or “getting started with Sui development,” you’ve come to the right place. This guide is designed to be the go-to starting point for any developer, regardless of experience level, looking to enter the Sui ecosystem.
We will walk you through setting up your environment, writing a basic smart contract in Move, and deploying it on the Sui network. Let’s get started.
Prerequisites: Your Sui Development Toolkit
Before we write any code, make sure you have the following installed:
- Rust and Cargo: Sui is built in Rust, and you’ll need it to install the Sui binaries.
- Sui Binaries: This includes the Sui CLI for interacting with the network.
- A Code Editor: VS Code with the move-analyzer extension is highly recommended for Move development.
Step 1: Setting Up Your Local Environment
First, let’s get your environment ready. Install the Sui binaries by running the following command in your terminal:
code Bash
downloadcontent_copy
expand_less
cargo install –locked –git https://github.com/MystenLabs/sui.git –branch devnet sui
Once installed, create a new wallet address and connect to the devnet:
code Bash
downloadcontent_copy
expand_less
IGNORE_WHEN_COPYING_START
IGNORE_WHEN_COPYING_END
sui client new-address # Create an address
sui client switch –env devnet # Switch to devnet
sui client active-address # Check your active address
Step 2: Creating Your First Sui Project
The Sui CLI makes it incredibly simple to bootstrap a new project.
code Bash
downloadcontent_copy
expand_less
IGNORE_WHEN_COPYING_START
IGNORE_WHEN_COPYING_END
sui move new my_first_sui_app
cd my_first_sui_app
This command creates a directory with a Move. A toml file (your project configuration) and a sources directory for your Move code.
Step 3: Writing Your First Smart Contract in Move
Let’s create a simple “counter” object that can be created and incremented. Inside sources/my_first_sui_app.move, write the following code:
code Move
downloadcontent_copy
expand_less
IGNORE_WHEN_COPYING_START
IGNORE_WHEN_COPYING_END
module my_first_sui_app::counter {
use sui::object::{Self, UID};
use sui::transfer;
use sui::tx_context::{Self, TxContext};
// A Counter object that holds a value
public struct Counter has key, store {
id: UID,
value: u64,
}
// Function to create a new Counter and transfer it to the sender
public fun create(ctx: &mut TxContext) {
let counter = Counter {
id: object::new(ctx),
value: 0,
};
transfer::transfer(counter, tx_context::sender(ctx));
}
// Public function to increment the counter’s value
public fun increment(counter: &mut Counter) {
counter.value = counter.value + 1;
}
}
This simple contract defines a Counter object and functions to create and increment it.
Step 4: Publishing Your Package to the Devnet
Now, let’s compile and publish your package. From your project’s root directory, run:
code Bash
downloadcontent_copy
expand_less
IGNORE_WHEN_COPYING_START
IGNORE_WHEN_COPYING_END
sui client publish –gas-budget 100000000
If successful, the output will show the objects created, including your new package.
Step 5: Interacting with Your dApp
You can now interact with your contract using the Sui CLI to call the functions you created. This process is your first step into the powerful world of building on Sui.
Next Steps on Your Sui Journey
You’ve successfully built and deployed your first dApp on Sui! This is the foundation. From here, you can explore more complex data structures, frontend integration, and the full power of Sui’s object model.
When your simple dApp is ready to become a mainnet-level project, Ibriz.ai is the development partner to take you there. Contact our expert team to scale your vision.