Sui Move Development
Comprehensive knowledge base for Sui blockchain and Move smart contract development.
GitHub:
Setup References
Clone the official documentation:
CODEBLOCK0
Additional Resources
Awesome Move (references/awesome-move/)
A curated list of Move resources, including:
- - Example projects and code snippets
- Libraries and frameworks
- Tools and utilities
- Learning resources
⚠️ Note: Some code examples in awesome-move may be outdated as the Move language and Sui platform evolve. Always verify against the latest Move Book and Sui documentation.
Reference Structure
Move Book (references/move-book/book/)
| Directory | Content |
|---|
| INLINECODE2 | Hello World, Hello Sui tutorials |
| INLINECODE3 |
Variables, functions, structs, abilities, generics |
|
concepts/ | Packages, manifest, addresses, dependencies |
|
storage/ | Object storage, UID, transfer functions |
|
object/ | Object model, ownership, dynamic fields |
|
programmability/ | Events, witness, publisher, display |
|
move-advanced/ | BCS, PTB, cryptography |
|
guides/ | Testing, debugging, upgrades, BCS |
|
appendix/ | Glossary, reserved addresses |
Sui Docs (references/sui/docs/content/)
- - Concepts, guides, standards, references
Quick Search
CODEBLOCK1
Key Concepts
Move Language Basics
Abilities - Type capabilities:
- -
copy - Can be copied - INLINECODE13 - Can be dropped (destroyed)
- INLINECODE14 - Can be stored in objects
- INLINECODE15 - Can be used as a key in global storage (objects)
CODEBLOCK2
Object Model:
- - Every object has a unique INLINECODE16
- Objects can be owned (address), shared, or immutable
- Transfer functions:
transfer::transfer, transfer::share_object, INLINECODE19
Common Patterns
Create and Transfer Object:
CODEBLOCK3
Shared Object:
CODEBLOCK4
Entry Functions:
CODEBLOCK5
CLI Commands
CODEBLOCK6
Workflow
When answering Sui/Move questions:
- 1. Search references first:
CODEBLOCK7
- 2. Read relevant files:
CODEBLOCK8
- 3. Provide code examples from the references
- 4. Link to official docs when helpful:
- Move Book: https://move-book.com
- Sui Docs: https://docs.sui.io
Topics Index
| Topic | Location |
|---|
| Hello World | INLINECODE20 |
| Hello Sui |
move-book/book/your-first-move/hello-sui.md |
| Primitives |
move-book/book/move-basics/primitive-types.md |
| Structs |
move-book/book/move-basics/struct.md |
| Abilities |
move-book/book/move-basics/abilities-introduction.md |
| Generics |
move-book/book/move-basics/generics.md |
| Object Model |
move-book/book/object/ |
| Storage |
move-book/book/storage/ |
| Events |
move-book/book/programmability/events.md |
| Testing |
move-book/book/guides/testing.md |
| Upgrades |
move-book/book/guides/upgradeability.md |
| PTB |
move-book/book/move-advanced/ptb/ |
| BCS |
move-book/book/move-advanced/bcs.md |
Related Skills
This skill is part of the Sui development skill suite:
| Skill | Description |
|---|
| sui-decompile | Fetch and read on-chain contract source code |
| sui-move |
Write and deploy Move smart contracts |
|
sui-coverage | Analyze test coverage with security analysis |
|
sui-agent-wallet | Build and test DApps frontend |
Workflow:
CODEBLOCK9
All skills:
Notes
- - Move 2024 edition introduces new features (enums, method syntax, etc.)
- Sui uses a unique object-centric model different from other blockchains
- Gas is paid in SUI tokens
- Testnet/Devnet available for development
Sui Move 开发
Sui 区块链和 Move 智能合约开发的综合知识库。
GitHub:
设置参考
克隆官方文档:
bash
创建技能目录
mkdir -p {baseDir}/references && cd {baseDir}/references
克隆 Move Book(Move 语言圣经)
git clone --depth 1 https://github.com/MystenLabs/move-book.git
克隆 Sui 文档(稀疏检出)
git clone --depth 1 --filter=blob:none --sparse https://github.com/MystenLabs/sui.git
cd sui && git sparse-checkout set docs
克隆 Awesome Move(精选示例和资源)
注意:部分代码示例可能已过时
git clone --depth 1 https://github.com/MystenLabs/awesome-move.git
其他资源
Awesome Move(references/awesome-move/)
精选的 Move 资源列表,包括:
- - 示例项目和代码片段
- 库和框架
- 工具和实用程序
- 学习资源
⚠️ 注意:随着 Move 语言和 Sui 平台的发展,awesome-move 中的部分代码示例可能已过时。请始终对照最新的 Move Book 和 Sui 文档进行验证。
参考结构
Move Book(references/move-book/book/)
| 目录 | 内容 |
|---|
| your-first-move/ | Hello World、Hello Sui 教程 |
| move-basics/ |
变量、函数、结构体、能力、泛型 |
| concepts/ | 包、清单、地址、依赖 |
| storage/ | 对象存储、UID、转移函数 |
| object/ | 对象模型、所有权、动态字段 |
| programmability/ | 事件、见证、发布者、显示 |
| move-advanced/ | BCS、PTB、密码学 |
| guides/ | 测试、调试、升级、BCS |
| appendix/ | 术语表、保留地址 |
Sui 文档(references/sui/docs/content/)
快速搜索
bash
在 Move Book 中搜索主题
rg -i 关键词 {baseDir}/references/move-book/book/ --type md
在 Sui 文档中搜索
rg -i 关键词 {baseDir}/references/sui/docs/ --type md
查找所有关于某个主题的文件
find {baseDir}/references -name *.md | xargs grep -l 主题
关键概念
Move 语言基础
能力 - 类型能力:
- - copy - 可复制
- drop - 可丢弃(销毁)
- store - 可存储在对象中
- key - 可用作全局存储中的键(对象)
move
public struct MyStruct has key, store {
id: UID,
value: u64
}
对象模型:
- - 每个对象都有唯一的 UID
- 对象可以是拥有的(地址)、共享的或不可变的
- 转移函数:transfer::transfer、transfer::shareobject、transfer::freezeobject
常见模式
创建并转移对象:
move
public fun create(ctx: &mut TxContext) {
let obj = MyObject {
id: object::new(ctx),
value: 0
};
transfer::transfer(obj, tx_context::sender(ctx));
}
共享对象:
move
public fun create_shared(ctx: &mut TxContext) {
let obj = SharedObject {
id: object::new(ctx),
counter: 0
};
transfer::share_object(obj);
}
入口函数:
move
public entry fun do_something(obj: &mut MyObject, value: u64) {
obj.value = value;
}
CLI 命令
bash
创建新项目
sui move new my_project
构建
sui move build
测试
sui move test
发布
sui client publish --gas-budget 100000000
调用函数
sui client call --package
--module --function --args
获取对象
sui client object
工作流程
回答 Sui/Move 问题时:
- 1. 首先搜索参考:
bash
rg -i 主题 {baseDir}/references/move-book/book/ -l
- 2. 阅读相关文件:
bash
cat {baseDir}/references/move-book/book/<路径>/<文件>.md
- 3. 提供参考中的代码示例
- 4. 必要时链接到官方文档:
- Move Book:https://move-book.com
- Sui 文档:https://docs.sui.io
主题索引
| 主题 | 位置 |
|---|
| Hello World | move-book/book/your-first-move/hello-world.md |
| Hello Sui |
move-book/book/your-first-move/hello-sui.md |
| 基本类型 | move-book/book/move-basics/primitive-types.md |
| 结构体 | move-book/book/move-basics/struct.md |
| 能力 | move-book/book/move-basics/abilities-introduction.md |
| 泛型 | move-book/book/move-basics/generics.md |
| 对象模型 | move-book/book/object/ |
| 存储 | move-book/book/storage/ |
| 事件 | move-book/book/programmability/events.md |
| 测试 | move-book/book/guides/testing.md |
| 升级 | move-book/book/guides/upgradeability.md |
| PTB | move-book/book/move-advanced/ptb/ |
| BCS | move-book/book/move-advanced/bcs.md |
相关技能
本技能是 Sui 开发技能套件的一部分:
编写和部署 Move 智能合约 |
| sui-coverage | 通过安全分析分析测试覆盖率 |
| sui-agent-wallet | 构建和测试 DApp 前端 |
工作流程:
sui-decompile → sui-move → sui-coverage → sui-agent-wallet
学习 编写 测试与审计 构建 DApp
所有技能:
备注
- - Move 2024 版本引入了新特性(枚举、方法语法等)
- Sui 使用独特的以对象为中心的模型,与其他区块链不同
- Gas 以 SUI 代币支付
- 提供测试网/开发网用于开发