The Cairo Book
前言
介绍
Cairo编程语言
1.
入门
❱
1.1.
安装
1.2.
Hello,world!
2.
常见的编程概念
❱
2.1.
变量与可变性
2.2.
数据类型
2.3.
函数
2.4.
注释
2.5.
控制流
3.
常见集合
❱
3.1.
数组
3.2.
字典
4.
认识所有权
❱
4.1.
什么是所有权?
4.2.
引用和快照
5.
使用结构体组织相关联的数据
❱
5.1.
结构体的定义和实例化
5.2.
结构体实例程序
5.3.
方法语法
6.
枚举和模式匹配
❱
6.1.
枚举的定义
6.2.
Match控制流结构
6.3.
Concise Control Flow with if let and while let
7.
使用包、Crate 和模块管理Cairo项目
❱
7.1.
包和 Crate
7.2.
定义模块以控制作用域
7.3.
引用模块项目的路径
7.4.
Bringing Paths into Scope with the use Keyword
7.5.
将模块拆分成多个文件
8.
Generic Types and Traits
❱
8.1.
Generic Data Types
8.2.
Cairo中的Trait
9.
错误处理
❱
9.1.
用panic处理不可恢复的错误
9.2.
用Result处理可恢复的错误
10.
测试Cairo 程序
❱
10.1.
如何编写测试
10.2.
Test Organization
11.
Advanced Cairo Features
❱
11.1.
自定义数据结构
11.2.
Smart Pointers
11.3.
Deref Coercion
11.4.
Associated Items
11.5.
操作符重载
11.6.
使用哈希
11.7.
宏
11.8.
Procedural Macros
11.9.
Inlining in Cairo
11.10.
Printing
11.11.
Arithmetic Circuits
12.
Appendix (Cairo)
❱
12.1.
A - 关键字
12.2.
B - 运算符和符号
12.3.
C - 可派生的 Trait
12.4.
D - The Cairo Prelude
12.5.
E - Common Error Messages
12.6.
F - Useful Development Tools
Smart Contracts in Cairo
13.
Introduction to Starknet Smart Contracts
❱
13.1.
General Introduction to Smart Contracts
13.2.
Anatomy of a Simple Contract
14.
Building Starknet Smart Contracts
❱
14.1.
存储变量
❱
14.1.1.
Storage Mappings
14.1.2.
Storage Vecs
14.2.
合约函数
14.3.
合约的事件
15.
Starknet Contract Interactions
❱
15.1.
Contract Class ABI
15.2.
Interacting with Another Contract
15.3.
Executing Code from Another Class
16.
Building Advanced Starknet Smart Contracts
❱
16.1.
Optimizing Storage Costs
16.2.
Composability and Components
❱
16.2.1.
Under the Hood
16.2.2.
Component Dependencies
16.2.3.
Testing Components
16.3.
Upgradeability
16.4.
L1 \<\> L2 Messaging
16.5.
Oracle Interactions
❱
16.5.1.
Price Feeds
16.5.2.
Randomness
16.6.
Other Examples
❱
16.6.1.
Deploying and Interacting with a Voting Contract
17.
Starknet Smart Contracts Security
❱
17.1.
General Recommendations
17.2.
Testing Smart Contracts
17.3.
Static Analysis Tools
18.
Appendix (Starknet)
❱
18.1.
A - System Calls
Cairo VM
19.
介绍
20.
Architecture
21.
Memory
❱
21.1.
Non-Deterministic Read-only Memory
21.2.
Segments
21.3.
Segment Value
21.4.
Relocation
21.5.
Layout
22.
Execution Model
❱
22.1.
Registers
22.2.
Instructions
22.3.
Cairo Assembly (CASM)
22.4.
State transition
23.
Builtins
❱
23.1.
How Builtins Work
23.2.
Builtins List
❱
23.2.1.
Output
23.2.2.
Pedersen
23.2.3.
Range Check
23.2.4.
ECDSA
23.2.5.
Bitwise
23.2.6.
EC OP
23.2.7.
Keccak
23.2.8.
Poseidon
23.2.9.
Range Check96
23.2.10.
AddMod
23.2.11.
MulMod
23.2.12.
Segment Arena
23.2.13.
Gas
23.2.14.
System
24.
Hints
❱
24.1.
Structure
24.2.
Hint runner
24.3.
List of hints
25.
Runner
❱
25.1.
Program
❱
25.1.1.
Program Artifacts
25.1.2.
Program Parsing
25.2.
Runner Mode
❱
25.2.1.
Execution Mode
25.2.2.
Proof Mode
25.3.
Output
❱
25.3.1.
Cairo PIE
25.3.2.
Memory File
25.3.3.
Trace file
25.3.4.
AIR public input
25.3.5.
AIR private input
26.
Tracer
27.
Implementations
28.
Resources
Light
Rust
Coal
Navy
Ayu
The Cairo Programming Language
Cairo Home
English
Español
Français
简体中文
Indonesian
Turkçe
高级特性
现在,让我们来了解 Cairo 提供的更多高级功能。