Sui
Sui Overview¶
Sui is a next-generation Layer 1 blockchain developed by Mysten Labs, featuring an innovative object-centric data model and parallel execution engine that achieves extremely high throughput and ultra-low latency. Sui uses the Move programming language for building smart contracts and implements large-scale parallel processing through its object ownership model, with theoretical TPS reaching hundreds of thousands. As a high-performance blockchain designed for next-generation Web3 applications, Sui is particularly well-suited for gaming, DeFi, and large-scale consumer applications.
Official Website: https://sui.io/
Core Innovations¶
1. Object-Centric Model¶
Sui's data model innovation:
- Object Storage: Everything is an object, including tokens, NFTs, and contract state
- Object Ownership: Clear ownership relationships (owned, shared, immutable)
- Direct Access: Access directly via object ID, no traversal needed
- Parallel Friendly: Transactions on owned objects can be processed in parallel
- Version Control: Each object has a version number, supporting optimistic concurrency
2. Move Language¶
A secure smart contract language:
- Resource-Oriented: Resources cannot be copied or discarded, only moved
- Formal Verification: Supports formal verification to ensure safety
- Capability System: Fine-grained permission control
- Generics Support: Powerful generic programming capabilities
- Modular: Clear module and visibility management
3. Consensus Mechanism¶
Innovative consensus design:
- Narwhal & Bullshark: High-performance consensus engine
- Simple Transaction Fast Path: Owned object transactions require no consensus
- Byzantine Agreement: Shared object transactions use BFT consensus
- Finality: Instant transaction finality
- Checkpoints: Periodic checkpoint generation ensures data integrity
4. Parallel Execution¶
Breakthrough performance:
- Deterministic Execution: Transaction execution results are predictable
- Optimistic Locking: Uses version numbers for optimistic concurrency control
- Parallel Processing: Independent transactions execute fully in parallel
- Horizontal Scaling: Scales with additional validator nodes
- Low Latency: Sub-second transaction confirmation
Technical Architecture¶
Object Model¶
Object structure and types:
Object Types: - Owned Objects: Single owner, can be processed in parallel - Shared Objects: Accessible by multiple parties, requires consensus - Immutable Objects: Read-only, no synchronization needed
Object Structure:
struct Object {
id: UID, // Globally unique identifier
owner: Address, // Owner address
version: u64, // Version number
contents: T, // Object data
}
Transaction Model¶
Transaction structure and execution:
- Transaction Types: Transfers, contract calls, module publishing
- Gas Mechanism: SUI tokens pay for Gas
- Sponsored Transactions: Third parties can pay Gas on behalf of users
- Programmable Transaction Blocks: Batch-execute multiple operations
- Transaction Effects: Clear record of object changes
Development Guide¶
Install Sui CLI¶
# Install Sui
cargo install --locked --git https://github.com/MystenLabs/sui.git --branch mainnet sui
# Verify installation
sui --version
# Create wallet
sui client new-address ed25519
# Get test tokens
sui client faucet
Move Smart Contracts¶
Simple token example:
module my_coin::coin {
use sui::coin::{Self, Coin, TreasuryCap};
use sui::transfer;
use sui::tx_context::{Self, TxContext};
/// Token type
struct COIN has drop {}
/// Initialization function
fun init(witness: COIN, ctx: &mut TxContext) {
let (treasury, metadata) = coin::create_currency(
witness,
6, // Decimal places
b"MYCOIN", // Symbol
b"My Coin", // Name
b"My test coin", // Description
option::none(), // Icon URL
ctx
);
transfer::public_freeze_object(metadata);
transfer::public_transfer(treasury, tx_context::sender(ctx))
}
/// Mint tokens
public entry fun mint(
treasury_cap: &mut TreasuryCap<COIN>,
amount: u64,
recipient: address,
ctx: &mut TxContext
) {
let coin = coin::mint(treasury_cap, amount, ctx);
transfer::public_transfer(coin, recipient)
}
}
NFT Contract¶
Creating an NFT:
module my_nft::nft {
use sui::url::{Self, Url};
use sui::object::{Self, UID};
use sui::transfer;
use sui::tx_context::{Self, TxContext};
use std::string::{Self, String};
/// NFT Object
struct MyNFT has key, store {
id: UID,
name: String,
description: String,
image_url: Url,
}
/// Mint NFT
public entry fun mint(
name: vector<u8>,
description: vector<u8>,
url: vector<u8>,
ctx: &mut TxContext
) {
let nft = MyNFT {
id: object::new(ctx),
name: string::utf8(name),
description: string::utf8(description),
image_url: url::new_unsafe_from_bytes(url)
};
transfer::public_transfer(nft, tx_context::sender(ctx))
}
/// Transfer NFT
public entry fun transfer(
nft: MyNFT,
recipient: address,
_: &mut TxContext
) {
transfer::public_transfer(nft, recipient)
}
}
Deploy Contract¶
# Build project
sui move build
# Publish to chain
sui client publish --gas-budget 100000000
# Call contract
sui client call \
--package <PACKAGE_ID> \
--module coin \
--function mint \
--args <TREASURY_CAP> 1000000 <RECIPIENT> \
--gas-budget 10000000
TypeScript SDK¶
Using the Sui TypeScript SDK:
import { SuiClient, getFullnodeUrl } from '@mysten/sui.js/client'
import { TransactionBlock } from '@mysten/sui.js/transactions'
import { Ed25519Keypair } from '@mysten/sui.js/keypairs/ed25519'
// Connect to Sui
const client = new SuiClient({ url: getFullnodeUrl('testnet') })
// Create key pair
const keypair = Ed25519Keypair.generate()
const address = keypair.getPublicKey().toSuiAddress()
// Query balance
const balance = await client.getBalance({ owner: address })
console.log('Balance:', balance.totalBalance)
// Build transaction
const tx = new TransactionBlock()
tx.moveCall({
target: `${packageId}::coin::mint`,
arguments: [
tx.object(treasuryCapId),
tx.pure(1000000),
tx.pure(recipientAddress)
]
})
// Sign and execute
const result = await client.signAndExecuteTransactionBlock({
signer: keypair,
transactionBlock: tx
})
console.log('Transaction result:', result.digest)
Ecosystem¶
DeFi Protocols¶
Major DeFi applications:
- Cetus: Leading DEX and liquidity protocol
- Turbos Finance: AMM and liquidity mining
- Scallop: Lending protocol
- Navi Protocol: Money market
- Aftermath Finance: DEX aggregator
NFT and Gaming¶
NFT ecosystem:
- BlueMove: NFT marketplace
- Clutchy: NFT trading platform
- SuiFrens: Sui official NFT collection
- Run Legends: Blockchain game
- Abyss World: MMORPG game
Infrastructure¶
Development tools:
- Sui Explorer: Blockchain explorer
- Sui Wallet: Official wallet
- Suiet: Third-party wallet
- Move Analyzer: IDE plugin
- Sui SDK: Multi-language SDK
Advantages¶
1. Extreme Performance¶
- High Throughput: Theoretical TPS over 100,000
- Low Latency: Transaction confirmation < 1 second
- Scalable: Horizontal scaling capability
- Parallel Execution: Non-conflicting transactions fully parallelized
2. Developer Friendly¶
- Move Language: Secure and expressive
- Rich Tooling: Complete development toolchain
- Detailed Documentation: Comprehensive development docs
- Active Community: Developer community support
3. User Experience¶
- Fast Confirmation: Instant transaction feedback
- Low Fees: Affordable Gas fees
- Sponsored Transactions: Users can use without paying Gas
- Intuitive Interaction: Simplified interaction patterns
4. Security¶
- Formal Verification: Move supports formal verification
- Resource Safety: Resources cannot be copied or lost
- Auditing: Core code has been audited
- Bug Bounty: Active bug bounty program
SUI Token¶
Native token uses:
- Gas Fees: Pay transaction fees
- Staking: Delegate stake to earn rewards
- Governance: Participate in network governance
- Storage Fees: Pay for on-chain storage
- Participation: Engage in the Sui economy
Token Economics¶
- Total Supply: 10 billion SUI
- Distribution: Community, team, investors, reserves
- Release: Gradual unlock mechanism
- Inflation: Staking rewards and validator rewards
Best Practices¶
1. Smart Contract Development¶
- Fully leverage the object ownership model
- Prefer owned objects for better performance
- Follow Move language best practices
- Conduct thorough testing and auditing
- Use formal verification tools
2. Performance Optimization¶
- Minimize shared object usage
- Use programmable transaction blocks for batch operations
- Design object structures wisely
- Optimize Gas consumption
- Leverage object caching
3. Security Recommendations¶
- Validate all input parameters
- Correctly handle resource ownership
- Implement access controls
- Regularly audit contract code
- Use the latest stable version
Related Concepts and Technologies¶
- Move: The programming language used by Sui
- Aptos: Another blockchain using Move
- Solana: Another high-performance Layer 1
- zkSync: Ethereum Layer 2 solution
- BFT Consensus: Byzantine Fault Tolerant consensus mechanism
Summary¶
Sui provides high-performance, secure, and user-friendly blockchain infrastructure for Web3 applications through its innovative object-centric model and Move language. Its unique parallel execution architecture and instant finality make Sui particularly well-suited for building applications requiring high throughput and low latency. As the ecosystem continues to grow and technology evolves, Sui is becoming an important platform for next-generation Web3 applications. For developers seeking extreme performance and development experience, Sui offers a highly attractive choice.