From 8e059b15b20d2ee9694f40bdc6d5110977dd6fa7 Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Tue, 24 Sep 2024 06:31:16 +0000 Subject: [PATCH 01/20] Update commit status table --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 4bf4183..f34ba9f 100644 --- a/README.md +++ b/README.md @@ -116,7 +116,7 @@ Starknet 残酷共学是由 LXDAO、Starknet Astro、AAStar 联合发起,旨 | Hansen | ✅ | ✅ | ⭕️ | ✅ | ✅ | ✅ | | | | | | | | | | | | | | | | | Reign | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | | | | | | | | | | | | | | | | qiaopengjun | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | | | | | | | | | | | | | | -| Ric-Li-C | ✅ | ⭕️ | ⭕️ | ✅ | ✅ | ✅ | | | | | | | | | | | | | | | | +| Ric-Li-C | ✅ | ⭕️ | ⭕️ | ✅ | ✅ | ✅ | ✅ | | | | | | | | | | | | | | | | River | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | | | | | | | | | | | | | | | | awaqawaqawaq | ✅ | ✅ | ✅ | ⭕️ | ⭕️ | ✅ | | | | | | | | | | | | | | | | | phipupt | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | | | | | | | | | | | | | | | @@ -234,6 +234,7 @@ Starknet 残酷共学是由 LXDAO、Starknet Astro、AAStar 联合发起,旨 + From 0f0c08a7316bf4d100b30f132ccbe4c384db5eb7 Mon Sep 17 00:00:00 2001 From: awaqawaqawaq <81813136+awaqawaqawaq@users.noreply.github.com> Date: Tue, 24 Sep 2024 19:02:24 +0800 Subject: [PATCH 02/20] Update awaqawaqawaq.md --- awaqawaqawaq.md | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/awaqawaqawaq.md b/awaqawaqawaq.md index efd4c7d..ffd068b 100644 --- a/awaqawaqawaq.md +++ b/awaqawaqawaq.md @@ -116,7 +116,15 @@ StarkNet's tokenomics . ### 2024.09.23 - [观看了第一期视频,看的懂但是看不懂🙃🙃🙃](https://youtu.be/p6mPT2HOGKI) - - - +### 2024.09.24 +- 事件 + - 将数据存储在事件中比存储在存储变量中更具成本效益 + - 事件不能直接从合约内部读取。 + - 诸如 starknet.js 的应用程序可以通过 RPC 接口订阅这些事件,并在前端触发响应。 + - #[event]和#[derive(Drop, starknet::Event)] + - 事件变体成员必须是一个与变体同名的结构体 + - 使用emit()释放 +- 异常处理 + - assert() + - panic() From b5e4fbc62c5f670685b023b626d7db189118c5a2 Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Tue, 24 Sep 2024 11:02:39 +0000 Subject: [PATCH 03/20] Update commit status table --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index f34ba9f..04bb907 100644 --- a/README.md +++ b/README.md @@ -118,7 +118,7 @@ Starknet 残酷共学是由 LXDAO、Starknet Astro、AAStar 联合发起,旨 | qiaopengjun | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | | | | | | | | | | | | | | | Ric-Li-C | ✅ | ⭕️ | ⭕️ | ✅ | ✅ | ✅ | ✅ | | | | | | | | | | | | | | | | River | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | | | | | | | | | | | | | | | -| awaqawaqawaq | ✅ | ✅ | ✅ | ⭕️ | ⭕️ | ✅ | | | | | | | | | | | | | | | | +| awaqawaqawaq | ✅ | ✅ | ✅ | ⭕️ | ⭕️ | ✅ | ✅ | | | | | | | | | | | | | | | | phipupt | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | | | | | | | | | | | | | | | | MartinYeung5 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | | | | | | | | | | | | | | | dethan3 | ✅ | ⭕️ | ✅ | ⭕️ | ❌ | | | | | | | | | | | | | | | | | @@ -235,6 +235,7 @@ Starknet 残酷共学是由 LXDAO、Starknet Astro、AAStar 联合发起,旨 + From 01c2f4a306cf5e85290c4e73796f1e785df45d43 Mon Sep 17 00:00:00 2001 From: Colder Date: Tue, 24 Sep 2024 19:47:27 +0800 Subject: [PATCH 04/20] Update Reign.md --- Reign.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Reign.md b/Reign.md index 131878e..266d082 100644 --- a/Reign.md +++ b/Reign.md @@ -265,7 +265,7 @@ This chapter provides a guide for compiling, deploying, and interacting with a S This chapter outlines the complete workflow for developing and managing Starknet smart contracts, focusing on ensuring compatibility between tools and providing practical commands for contract management. -### 2024.09.23 +### 2024.09.24 ### Summary of Scarb: The Package Manager **Scarb** is the package manager for Cairo and Starknet projects, handling dependencies, compiling projects, and streamlining the development process, similar to Rust's Cargo. Here's an overview of its usage: From 420f44b5358f73b09d4cf688b63bb1e4711d7a9d Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Tue, 24 Sep 2024 11:47:41 +0000 Subject: [PATCH 05/20] Update commit status table --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 04bb907..e4c4005 100644 --- a/README.md +++ b/README.md @@ -114,7 +114,7 @@ Starknet 残酷共学是由 LXDAO、Starknet Astro、AAStar 联合发起,旨 | geyu | ⭕️ | ✅ | ✅ | ✅ | ✅ | ✅ | | | | | | | | | | | | | | | | | aliyan404 | ✅ | ✅ | ✅ | ⭕️ | ✅ | ✅ | | | | | | | | | | | | | | | | | Hansen | ✅ | ✅ | ⭕️ | ✅ | ✅ | ✅ | | | | | | | | | | | | | | | | -| Reign | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | | | | | | | | | | | | | | | +| Reign | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | | | | | | | | | | | | | | | qiaopengjun | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | | | | | | | | | | | | | | | Ric-Li-C | ✅ | ⭕️ | ⭕️ | ✅ | ✅ | ✅ | ✅ | | | | | | | | | | | | | | | | River | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | | | | | | | | | | | | | | | @@ -236,6 +236,7 @@ Starknet 残酷共学是由 LXDAO、Starknet Astro、AAStar 联合发起,旨 + From 2c3db07f8175fe8e9b618a4bec63b448d5c24eb0 Mon Sep 17 00:00:00 2001 From: Colder Date: Tue, 24 Sep 2024 19:48:31 +0800 Subject: [PATCH 06/20] Update Reign.md --- Reign.md | 1 + 1 file changed, 1 insertion(+) diff --git a/Reign.md b/Reign.md index 266d082..03300cd 100644 --- a/Reign.md +++ b/Reign.md @@ -266,6 +266,7 @@ This chapter outlines the complete workflow for developing and managing Starknet ### 2024.09.24 + ### Summary of Scarb: The Package Manager **Scarb** is the package manager for Cairo and Starknet projects, handling dependencies, compiling projects, and streamlining the development process, similar to Rust's Cargo. Here's an overview of its usage: From 21f459fdef883432b25b884144d8992c4671a238 Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Tue, 24 Sep 2024 11:48:46 +0000 Subject: [PATCH 07/20] Update commit status table --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index e4c4005..77f96e6 100644 --- a/README.md +++ b/README.md @@ -237,6 +237,7 @@ Starknet 残酷共学是由 LXDAO、Starknet Astro、AAStar 联合发起,旨 + From 75cd01427fb7c714eb6c867c225c8a6b3960d456 Mon Sep 17 00:00:00 2001 From: geyu Date: Tue, 24 Sep 2024 21:41:48 +0800 Subject: [PATCH 08/20] Step 3 --- geyu.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/geyu.md b/geyu.md index 63579df..168e2aa 100644 --- a/geyu.md +++ b/geyu.md @@ -28,6 +28,7 @@ fork 了 counter-workshop 通过了counter-workshop Step 4 ### 2024.09.23 学习 https://docs.starknet.io/ 的文档,目前进度:Deploying a smart contract - +### 2024.09.24 +学习 https://docs.starknet.io/ 的文档,目前进度: Using a development network From bd569c6b8490460d28383f048feaf8d6e390d909 Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Tue, 24 Sep 2024 13:42:46 +0000 Subject: [PATCH 09/20] Update commit status table --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 77f96e6..4f8fcbf 100644 --- a/README.md +++ b/README.md @@ -111,13 +111,13 @@ Starknet 残酷共学是由 LXDAO、Starknet Astro、AAStar 联合发起,旨 | Name | 9.18 | 9.19 | 9.20 | 9.21 | 9.22 | 9.23 | 9.24 | 9.25 | 9.26 | 9.27 | 9.28 | 9.29 | 9.30 | 10.01 | 10.02 | 10.03 | 10.04 | 10.05 | 10.06 | 10.07 | 10.08 | | ------------- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | | Ache | ⭕️ | ⭕️ | ❌ | | | | | | | | | | | | | | | | | | | -| geyu | ⭕️ | ✅ | ✅ | ✅ | ✅ | ✅ | | | | | | | | | | | | | | | | +| geyu | ⭕️ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | | | | | | | | | | | | | | | aliyan404 | ✅ | ✅ | ✅ | ⭕️ | ✅ | ✅ | | | | | | | | | | | | | | | | | Hansen | ✅ | ✅ | ⭕️ | ✅ | ✅ | ✅ | | | | | | | | | | | | | | | | | Reign | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | | | | | | | | | | | | | | | qiaopengjun | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | | | | | | | | | | | | | | | Ric-Li-C | ✅ | ⭕️ | ⭕️ | ✅ | ✅ | ✅ | ✅ | | | | | | | | | | | | | | | -| River | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | | | | | | | | | | | | | | | +| River | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ⭕️ | | | | | | | | | | | | | | | | awaqawaqawaq | ✅ | ✅ | ✅ | ⭕️ | ⭕️ | ✅ | ✅ | | | | | | | | | | | | | | | | phipupt | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | | | | | | | | | | | | | | | | MartinYeung5 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | | | | | | | | | | | | | | @@ -238,6 +238,7 @@ Starknet 残酷共学是由 LXDAO、Starknet Astro、AAStar 联合发起,旨 + From ccb3641bf5bca5ed75ae84820bdaeab5a5dd6b2c Mon Sep 17 00:00:00 2001 From: hansen <78713865@qq.com> Date: Tue, 24 Sep 2024 22:25:34 +0800 Subject: [PATCH 10/20] Update Hansen.md --- Hansen.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Hansen.md b/Hansen.md index 73e11d4..4978c9d 100644 --- a/Hansen.md +++ b/Hansen.md @@ -11,6 +11,18 @@ timezone: Asia/Shanghai ## Notes +### 2024.09.24 + +学习 Starknet-js: Javascript SDK +- Starknet.js 是web 前端连接starknet 链的库。 +- js-》 provider -》链 + +- Starknet accounts are contracts. +- The provider allows you to interact with the Starknet network. +- contracts: 合约地址 和 abi 接口 + +- Next.js是一个基于React的框架,构建服务器端渲染的应用程序。React仍然是应用程序的基础,但结构和导航机制--架构--是由Next.js定义的。 + ### 2024.09.23 听 线上的课程:starknet 工具链与开发环境 下一步目标,做一个合约,部署在测试链上。 From b501387dc7f3a16fcfb8fce18db473c97b3dd2e7 Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Tue, 24 Sep 2024 14:25:50 +0000 Subject: [PATCH 11/20] Update commit status table --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 4f8fcbf..06639f9 100644 --- a/README.md +++ b/README.md @@ -113,7 +113,7 @@ Starknet 残酷共学是由 LXDAO、Starknet Astro、AAStar 联合发起,旨 | Ache | ⭕️ | ⭕️ | ❌ | | | | | | | | | | | | | | | | | | | | geyu | ⭕️ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | | | | | | | | | | | | | | | aliyan404 | ✅ | ✅ | ✅ | ⭕️ | ✅ | ✅ | | | | | | | | | | | | | | | | -| Hansen | ✅ | ✅ | ⭕️ | ✅ | ✅ | ✅ | | | | | | | | | | | | | | | | +| Hansen | ✅ | ✅ | ⭕️ | ✅ | ✅ | ✅ | ✅ | | | | | | | | | | | | | | | | Reign | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | | | | | | | | | | | | | | | qiaopengjun | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | | | | | | | | | | | | | | | Ric-Li-C | ✅ | ⭕️ | ⭕️ | ✅ | ✅ | ✅ | ✅ | | | | | | | | | | | | | | | @@ -239,6 +239,7 @@ Starknet 残酷共学是由 LXDAO、Starknet Astro、AAStar 联合发起,旨 + From 071eac2fdc2333e63dd16713c3ae341f0716adb9 Mon Sep 17 00:00:00 2001 From: coco <1285015889@qq.com> Date: Tue, 24 Sep 2024 22:45:05 +0800 Subject: [PATCH 12/20] create 2024.09.24 note --- River.md | 98 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) diff --git a/River.md b/River.md index a8dca42..f99d500 100644 --- a/River.md +++ b/River.md @@ -668,6 +668,104 @@ Loops和递归是两种重复执行代码的方式。 +### 2024.09.24 +#### 数组 + +数组是一系列具有相同类型的元素的集合。可以使用核心库的特征`ArrayTrait`来创建和使用数组。 + +⚠️ 数组是一种队列,里面的值无法修改。事实上一旦写入到内存槽中就无法重写,只能读取。在数组中,只能在最后添加元素,以及从前面删除元素。 + +###### 创建数组 + +* `ArrayTrait::new()` +* `ArrayTrait::::new();` + +~~~rust +fn main() { + let mut a = ArrayTrait::new(); + a.append(0); + a.append(1); + a.append(2); + + let mut arr1 = ArrayTrait::::new(); + + let mut arr2:Array = ArrayTrait::new(); +} +~~~ + +###### 更新数组 + +* 添加元素:`append()` + +* 删除元素:`pop_front()`。会返回`Option`,使用`unwrap()`获取删除的元素,如果返回`Option::None`表示数组是空的 + + ~~~rust + fn main() { + let mut a = ArrayTrait::new(); + a.append(10); + a.append(1); + a.append(2); + + let first_value = a.pop_front().unwrap(); + println!("The first value is {}", first_value); + } + ~~~ + +###### 读取数组 + +* `get()`:返回`Option>`,如果元素不存在则返回None, +* `at()`:`arr.at(index)`和`arr[index]`等价,如果下标益处则会Panic + + + +###### 容量相关的方法 + +* `len()`:确定数组的元素个数,返回`usize`类型的值 +* `is_empty()`:判断数组是否为空 + + + +###### `array!`Macro + +如果需要创建在编译期就能确定值的数组时,可以使用`array!`来简化创建带有元素的数组 + +~~~rust +let arr = array![1, 2, 3, 4, 5]; +~~~ + + + +###### 存储多种类型 + +可以使用`Enum`自定义的数据类型在数组中存储多种数据类型 + +~~~rust +#[derive(Copy, Drop)] +enum Data { + Integer: u128, + Felt: felt252, + Tuple: (u32, u32), +} + +fn main() { + let mut messages: Array = array![]; + messages.append(Data::Integer(100)); + messages.append(Data::Felt('hello world')); + messages.append(Data::Tuple((10, 30))); +} +~~~ + + + +###### `Span` + +`Span`是一种表示数组快照的结构。 + +用来在不修改原数组的前提下,提供数组中元素的安全以及访问控制。 + +在函数间传递数组或者执行只读操作的时候,保证数据完整性和避免借用问题时非常有用。 + +使用方法:`array.span()` From 1cff508cc0687ac3d24346cf7c30786a0ab95450 Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Tue, 24 Sep 2024 14:46:17 +0000 Subject: [PATCH 13/20] Update commit status table --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 06639f9..f842f98 100644 --- a/README.md +++ b/README.md @@ -117,7 +117,7 @@ Starknet 残酷共学是由 LXDAO、Starknet Astro、AAStar 联合发起,旨 | Reign | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | | | | | | | | | | | | | | | qiaopengjun | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | | | | | | | | | | | | | | | Ric-Li-C | ✅ | ⭕️ | ⭕️ | ✅ | ✅ | ✅ | ✅ | | | | | | | | | | | | | | | -| River | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ⭕️ | | | | | | | | | | | | | | | +| River | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | | | | | | | | | | | | | | | awaqawaqawaq | ✅ | ✅ | ✅ | ⭕️ | ⭕️ | ✅ | ✅ | | | | | | | | | | | | | | | | phipupt | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | | | | | | | | | | | | | | | | MartinYeung5 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | | | | | | | | | | | | | | @@ -240,6 +240,7 @@ Starknet 残酷共学是由 LXDAO、Starknet Astro、AAStar 联合发起,旨 + From 6a5f1e27c3477f08fa9340d711a22fb9ba903c03 Mon Sep 17 00:00:00 2001 From: phipupt Date: Tue, 24 Sep 2024 22:48:46 +0800 Subject: [PATCH 14/20] phipupt's update 09.24 --- phipupt.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/phipupt.md b/phipupt.md index 311f953..2352951 100644 --- a/phipupt.md +++ b/phipupt.md @@ -98,4 +98,28 @@ Starknet Foundry 使用: Starknet Foundry 居然还没有本地节点? +### 2024.09.24 +starknet-devnet-rs 使用 + +安装: +``` +cargo install starknet-devnet +``` +运行节点: +``` +starknet-devnet-rs +``` + +RPC 调用(获取账户余额): +curl -X POST --data '{ + "jsonrpc": "2.0", + "id": "1", + "method": "devnet_getAccountBalance", + "params": { + "address": "
", + "unit": "WEI", + "block_tag": "latest" + } +}' http://127.0.0.1:5050/rpc + From 9bff1bd172f7375e479af648e46d593db63efb91 Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Tue, 24 Sep 2024 14:49:10 +0000 Subject: [PATCH 15/20] Update commit status table --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index f842f98..ad91126 100644 --- a/README.md +++ b/README.md @@ -119,7 +119,7 @@ Starknet 残酷共学是由 LXDAO、Starknet Astro、AAStar 联合发起,旨 | Ric-Li-C | ✅ | ⭕️ | ⭕️ | ✅ | ✅ | ✅ | ✅ | | | | | | | | | | | | | | | | River | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | | | | | | | | | | | | | | | awaqawaqawaq | ✅ | ✅ | ✅ | ⭕️ | ⭕️ | ✅ | ✅ | | | | | | | | | | | | | | | -| phipupt | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | | | | | | | | | | | | | | | +| phipupt | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | | | | | | | | | | | | | | | MartinYeung5 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | | | | | | | | | | | | | | | dethan3 | ✅ | ⭕️ | ✅ | ⭕️ | ❌ | | | | | | | | | | | | | | | | | | Cavn | ✅ | ✅ | ⭕️ | ⭕️ | ❌ | | | | | | | | | | | | | | | | | @@ -241,6 +241,7 @@ Starknet 残酷共学是由 LXDAO、Starknet Astro、AAStar 联合发起,旨 + From 4a3293835f89604726062383ef8af73539eb1808 Mon Sep 17 00:00:00 2001 From: MartinYeung5 <41377418+MartinYeung5@users.noreply.github.com> Date: Wed, 25 Sep 2024 01:06:33 +0800 Subject: [PATCH 16/20] 20240925_notes --- MartinYeung5.md | 84 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) diff --git a/MartinYeung5.md b/MartinYeung5.md index f6925ac..19f00cd 100644 --- a/MartinYeung5.md +++ b/MartinYeung5.md @@ -207,5 +207,89 @@ download specific versions: * katana --version ![alt text](https://github.com/MartinYeung5/starknet/blob/main/MartinYeung5/20240924_9.png?raw=true) +### 2024.09.25 +* initiating a Scarb project + +* scarb new my_contract +![alt text](https://github.com/MartinYeung5/starknet/blob/main/MartinYeung5/20240925_1.png?raw=true) + +* update Scarb.toml +``` +[package] +name = "my_contract" +version = "0.1.0" +edition = "2023_11" + +[dependencies] +starknet = ">=2.5.4" + +[[target.starknet-contract]] + +``` + +有2個變數是必需要的,1個是starknet戶口,另一個是starknet代理: 用於設置使用網絡。 +* 創建一個src/.env, +然後加入以下修改: +``` +export STARKNET_ACCOUNT=katana-0 +export STARKNET_RPC=http://0.0.0.0:5050 +``` + +* 更新src/lib.cairo +``` +#[starknet::interface] +trait IHello { + fn get_name(self: @T) -> felt252; + fn set_name(ref self: T, name: felt252); +} + +#[starknet::contract] +mod hello { + #[storage] + struct Storage { + name: felt252, + } + + #[constructor] + fn constructor(ref self: ContractState, name: felt252) { + self.name.write(name); + } + + #[abi(embed_v0)] + impl HelloImpl of super::IHello { + fn get_name(self: @ContractState) -> felt252 { + self.name.read() + } + + fn set_name(ref self: ContractState, name: felt252) { + self.name.write(name); + } + } +} +``` + +Compile the contract with the Scarb compiler: +* scarb build +![alt text](https://github.com/MartinYeung5/starknet/blob/main/MartinYeung5/20240925_1.png?raw=true) + +The above command results in a compiled contract under target/dev/, named "my_contract_hello.contract_class.json" + +去src, 執行: +* source .env + +如果沒有執行 source src/.env , 會有以下錯誤訊息: +![alt text](https://github.com/MartinYeung5/starknet/blob/main/MartinYeung5/20240925_3.png?raw=true) + +執行 +* katanakatana +如下圖所示 +![alt text](https://github.com/MartinYeung5/starknet/blob/main/MartinYeung5/20240925_4.png?raw=true) + +去my_contract +To declare your contract, execute: +* starkli declare target/dev/my_contract_hello.contract_class.json +正常會出現以下錯誤訊息: +![alt text](https://github.com/MartinYeung5/starknet/blob/main/MartinYeung5/20240925_5.png?raw=true) + From 0fbf2dadb5130c5ea2091210e9ab02c563cac9d5 Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Tue, 24 Sep 2024 17:06:50 +0000 Subject: [PATCH 17/20] Update commit status table --- README.md | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index ad91126..0db837f 100644 --- a/README.md +++ b/README.md @@ -111,19 +111,19 @@ Starknet 残酷共学是由 LXDAO、Starknet Astro、AAStar 联合发起,旨 | Name | 9.18 | 9.19 | 9.20 | 9.21 | 9.22 | 9.23 | 9.24 | 9.25 | 9.26 | 9.27 | 9.28 | 9.29 | 9.30 | 10.01 | 10.02 | 10.03 | 10.04 | 10.05 | 10.06 | 10.07 | 10.08 | | ------------- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | | Ache | ⭕️ | ⭕️ | ❌ | | | | | | | | | | | | | | | | | | | -| geyu | ⭕️ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | | | | | | | | | | | | | | -| aliyan404 | ✅ | ✅ | ✅ | ⭕️ | ✅ | ✅ | | | | | | | | | | | | | | | | -| Hansen | ✅ | ✅ | ⭕️ | ✅ | ✅ | ✅ | ✅ | | | | | | | | | | | | | | | -| Reign | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | | | | | | | | | | | | | | -| qiaopengjun | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | | | | | | | | | | | | | | -| Ric-Li-C | ✅ | ⭕️ | ⭕️ | ✅ | ✅ | ✅ | ✅ | | | | | | | | | | | | | | | +| geyu | ⭕️ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | | | | | | | | | | | | | | +| aliyan404 | ✅ | ✅ | ✅ | ⭕️ | ✅ | ✅ | ⭕️ | | | | | | | | | | | | | | | +| Hansen | ✅ | ✅ | ⭕️ | ✅ | ✅ | ✅ | ✅ | | | | | | | | | | | | | | | +| Reign | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | | | | | | | | | | | | | | +| qiaopengjun | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | | | | | | | | | | | | | | +| Ric-Li-C | ✅ | ⭕️ | ⭕️ | ✅ | ✅ | ✅ | ✅ | | | | | | | | | | | | | | | | River | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | | | | | | | | | | | | | | -| awaqawaqawaq | ✅ | ✅ | ✅ | ⭕️ | ⭕️ | ✅ | ✅ | | | | | | | | | | | | | | | -| phipupt | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | | | | | | | | | | | | | | -| MartinYeung5 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | | | | | | | | | | | | | | +| awaqawaqawaq | ✅ | ✅ | ✅ | ⭕️ | ⭕️ | ✅ | ✅ | | | | | | | | | | | | | | | +| phipupt | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | | | | | | | | | | | | | | +| MartinYeung5 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | | | | | | | | | | | | | | dethan3 | ✅ | ⭕️ | ✅ | ⭕️ | ❌ | | | | | | | | | | | | | | | | | | Cavn | ✅ | ✅ | ⭕️ | ⭕️ | ❌ | | | | | | | | | | | | | | | | | -| Ellen | ✅ | ⭕️ | ⭕️ | ✅ | ✅ | ✅ | | | | | | | | | | | | | | | | +| Ellen | ✅ | ⭕️ | ⭕️ | ✅ | ✅ | ✅ | ⭕️ | | | | | | | | | | | | | | | @@ -242,6 +242,7 @@ Starknet 残酷共学是由 LXDAO、Starknet Astro、AAStar 联合发起,旨 + From ba52354cda740a7a9b6c42d911f70c9005a42365 Mon Sep 17 00:00:00 2001 From: Colder Date: Wed, 25 Sep 2024 08:07:24 +0800 Subject: [PATCH 18/20] Update Reign.md --- Reign.md | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/Reign.md b/Reign.md index 03300cd..5091792 100644 --- a/Reign.md +++ b/Reign.md @@ -295,6 +295,44 @@ This chapter outlines the complete workflow for developing and managing Starknet 6. **Version Changes**: - Version 2.3.0 introduced JSON outputs for Sierra and CASM code and support for components. +### 2024.09.25 + +#### Installation Steps for Starknet Development Tools + +This guide helps set up essential Starknet development tools. + +1. **Essential Tools**: + - **Starkli**: A command-line interface (CLI) for interacting with Starknet. + - **Scarb**: Cairo’s package manager for compiling code to Sierra, the intermediary language for Starknet. + - **Katana**: A Starknet node designed for local development. + +2. **Starkli Installation**: + - Install via command: + ``` + curl https://get.starkli.sh | sh + ``` + - Verify installation with `starkli --version`. Repeat the steps to upgrade. + +3. **Scarb Package Manager Installation**: + - **Requirements**: Ensure a Git executable is available in your PATH. + - Install via **asdf** for version management: + ``` + asdf plugin add scarb + asdf install scarb 2.5.4 + asdf global scarb 2.5.4 + ``` + - Alternatively, install directly: + ``` + curl --proto '=https' --tlsv1.2 -sSf https://docs.swmansion.com/scarb/install.sh | sh + ``` + - Verify installation with `scarb --version`. + +4. **Katana Node Installation**: + - Install using the Dojo engine installer: + ``` + curl -L https://install.dojoengine.org | bash + ``` + - Verify installation with `katana --version`. From 4849068a832698b932261d32ae2d83327e0724f0 Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Wed, 25 Sep 2024 00:07:38 +0000 Subject: [PATCH 19/20] Update commit status table --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 0db837f..76852d6 100644 --- a/README.md +++ b/README.md @@ -114,7 +114,7 @@ Starknet 残酷共学是由 LXDAO、Starknet Astro、AAStar 联合发起,旨 | geyu | ⭕️ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | | | | | | | | | | | | | | | aliyan404 | ✅ | ✅ | ✅ | ⭕️ | ✅ | ✅ | ⭕️ | | | | | | | | | | | | | | | | Hansen | ✅ | ✅ | ⭕️ | ✅ | ✅ | ✅ | ✅ | | | | | | | | | | | | | | | -| Reign | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | | | | | | | | | | | | | | +| Reign | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | | | | | | | | | | | | | | qiaopengjun | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | | | | | | | | | | | | | | | Ric-Li-C | ✅ | ⭕️ | ⭕️ | ✅ | ✅ | ✅ | ✅ | | | | | | | | | | | | | | | | River | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | | | | | | | | | | | | | | @@ -243,6 +243,7 @@ Starknet 残酷共学是由 LXDAO、Starknet Astro、AAStar 联合发起,旨 + From f14ec0c6f731953e014eadd077947a8b3ffa5efc Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Wed, 25 Sep 2024 00:58:15 +0000 Subject: [PATCH 20/20] Update commit status table --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 76852d6..2de45d0 100644 --- a/README.md +++ b/README.md @@ -244,6 +244,7 @@ Starknet 残酷共学是由 LXDAO、Starknet Astro、AAStar 联合发起,旨 +