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.
Functional Language Features: Iterators and Closures
❱
11.1.
Closures: Anonymous Functions that Capture Their Environment
12.
Advanced Cairo Features
❱
12.1.
自定义数据结构
12.2.
Smart Pointers
12.3.
Deref Coercion
12.4.
Associated Items
12.5.
操作符重载
12.6.
使用哈希
12.7.
宏
12.8.
Procedural Macros
12.9.
Inlining in Cairo
12.10.
Printing
12.11.
Arithmetic Circuits
13.
Appendix (Cairo)
❱
13.1.
A - 关键字
13.2.
B - 运算符和符号
13.3.
C - 可派生的 Trait
13.4.
D - The Cairo Prelude
13.5.
E - Common Error Messages
13.6.
F - Useful Development Tools
Smart Contracts in Cairo
14.
Introduction to Smart Contracts
15.
Building Starknet Smart Contracts
❱
15.1.
存储变量
❱
15.1.1.
Storage Mappings
15.1.2.
Storage Vecs
15.2.
合约函数
15.3.
合约的事件
16.
Starknet Contract Interactions
❱
16.1.
Contract Class ABI
16.2.
Interacting with Another Contract
16.3.
Executing Code from Another Class
17.
Building Advanced Starknet Smart Contracts
❱
17.1.
Optimizing Storage Costs
17.2.
Composability and Components
❱
17.2.1.
Under the Hood
17.2.2.
Component Dependencies
17.2.3.
Testing Components
17.3.
Upgradeability
17.4.
L1 \<\> L2 Messaging
17.5.
Oracle Interactions
❱
17.5.1.
Price Feeds
17.5.2.
Randomness
17.6.
Other Examples
❱
17.6.1.
Deploying and Interacting with a Voting Contract
18.
Starknet Smart Contracts Security
❱
18.1.
General Recommendations
18.2.
Testing Smart Contracts
18.3.
Static Analysis Tools
19.
Appendix (Starknet)
❱
19.1.
A - System Calls
Cairo VM
20.
介绍
21.
Architecture
22.
Memory
❱
22.1.
Non-Deterministic Read-only Memory
22.2.
Segments
22.3.
Segment Value
22.4.
Relocation
22.5.
Layout
23.
Execution Model
❱
23.1.
Registers
23.2.
Instructions
23.3.
Cairo Assembly (CASM)
23.4.
State transition
24.
Builtins
❱
24.1.
How Builtins Work
24.2.
Builtins List
❱
24.2.1.
Output
24.2.2.
Pedersen
24.2.3.
Range Check
24.2.4.
ECDSA
24.2.5.
Bitwise
24.2.6.
EC OP
24.2.7.
Keccak
24.2.8.
Poseidon
24.2.9.
Range Check96
24.2.10.
AddMod
24.2.11.
MulMod
24.2.12.
Segment Arena
24.2.13.
Gas
24.2.14.
System
25.
Hints
❱
25.1.
Structure
25.2.
Hint runner
25.3.
List of hints
26.
Runner
❱
26.1.
Program
❱
26.1.1.
Program Artifacts
26.1.2.
Program Parsing
26.2.
Runner Mode
❱
26.2.1.
Execution Mode
26.2.2.
Proof Mode
26.3.
Output
❱
26.3.1.
Cairo PIE
26.3.2.
Memory File
26.3.3.
Trace file
26.3.4.
AIR public input
26.3.5.
AIR private input
27.
Tracer
28.
Implementations
29.
Resources
Light
Rust
Coal
Navy
Ayu
The Cairo Programming Language
Cairo Home
English
Español
Français
简体中文
Indonesian
Turkçe
Starknet Smart Contracts Security