Mastering Sui DeepBook: A Hands-On DeFi DEX Series (2)

Published: (December 14, 2025 at 12:53 AM EST)
2 min read
Source: Dev.to

Source: Dev.to

Environment Setup

In this section, we will install the necessary tools and dependencies to begin working with Sui DeepBook.

Bootstrapping the Boilerplate

First, set up the boilerplate for our Sui DeepBook contract. This provides a starting point for smart‑contract development.

  1. Open your terminal.

  2. Clone the boilerplate repository (using the template branch):

    git clone -b template https://github.com/Rajesh-Royal/SUI-Deepbookv3-Dex
  3. Change into the boilerplate directory:

    cd SUI-Deepbookv3-Dex

Now the boilerplate is ready. Next, install the required tools and dependencies.

Installing Sui and Dev Tools

The first step is to install Sui, Move, and the necessary development tools. Follow the instructions for your operating system.

Installing on Codespaces (Ubuntu/Debian)

If you are using GitHub Codespaces or a Linux environment:

Install required dependencies

sudo apt update
sudo apt install curl git-all cmake gcc libssl-dev pkg-config libclang-dev libpq-dev build-essential -y

Install Rust and Cargo

curl https://sh.rustup.rs -sSf | sh

When prompted, type 1 and press Enter. Then configure your shell:

source "$HOME/.cargo/env"

Install Sui binaries

cargo install --locked --git https://github.com/MystenLabs/sui.git --branch devnet sui

Verify the installation

sui --version

Installing on macOS

Install Homebrew (if not already installed)

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Install Sui

brew install sui

Verify the installation

sui --version

Understanding the Boilerplate Code

Now that the boilerplate is set up, let’s explore its structure and the purpose of each file, preparing the main.move file for our Sui DeepBook contract.

Boilerplate Code Structure

The contract directory should have the following layout:

SUI-Deepbookv3-Dex
├── contract
│   ├── sources
│   │   ├── main-test.move
│   │   ├── main.move
│   │   ├── wbtc.move
│   ├── Move.toml
│   ├── contract-publish.sh
│   ├── README.md
└── package.json

File descriptions

  • sources/main-test.move – Placeholder for unit tests related to the main contract.
  • sources/main.move – The main contract file where the Sui DeepBook logic will be implemented (currently empty).
  • sources/wbtc.move – Example module implementing a wrapped Bitcoin (WBTC) token, showing initialization, minting, and burning functions.
  • Move.toml – Package manifest that defines dependencies on the Sui and DeepBook frameworks and assigns a blockchain address to the contract.
  • contract-publish.sh – Script that automates building and publishing the contract, extracting necessary information from the build output and setting environment variables for later use.
Back to Blog

Related posts

Read more »

Smart contracts for dummies

Introduction Learning blockchain concepts can be challenging, but understanding smart contracts doesn’t have to be. This guide introduces the basics of smart c...