Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
luffythink committed Aug 16, 2024
2 parents 9602035 + 5085581 commit 90389d5
Show file tree
Hide file tree
Showing 8 changed files with 229 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Lu_ZICL1st.md
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,6 @@ GPT解释:同态加密的解谜过程固定。难度是受解密密钥和算
`GPT解释number的各种分类:在等式x²+1 = 0中,无real numbers解,因为实数不可能是负数,可是可以有复数解,解是个虚数imaginary unit。还有,5+0i是pure real numbers,0+2i是pure imaginary numbers,3+4i是general complex numbers`
- 剩10分钟幂函数这块明天在看。

### 2024.08.13
### 2024.08.15
- 幂函数对于群论的作用?Adding inputs = multiply outputs
<!-- Content_END -->
38 changes: 24 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ ZK 的原理是什么?为什么能实现隐私保护?ZK 技术为什么被
| Ache || ⭕️ | ⭕️ || | | | | | | | | | | | | | | | | |
| Rayerleier |||| ⭕️ | ⭕️ || | | | | | | | | | | | | | | |
| Lambert || ⭕️ | ⭕️ || | | | | | | | | | | | | | | | | |
| Draculabo ||||||||||||||||||| | | |
| Draculabo ||||||||||||||||||| | | |
| Suweet ||| ⭕️ | ⭕️ || | | | | | | | | | | | | | | | |
| Leo ||||||||||||||| ⭕️ | ⭕️ || | | | |
| Iyi ||| ⭕️ | ⭕️ || | | | | | | | | | | | | | | | |
Expand All @@ -118,39 +118,39 @@ ZK 的原理是什么?为什么能实现隐私保护?ZK 技术为什么被
| Derick ||| ⭕️ | ⭕️ || | | | | | | | | | | | | | | | |
| Stone ||| ⭕️ | ⭕️ || | | | | | | | | | | | | | | | |
| Xiongyi |||||| ⭕️ | ⭕️ |||| ⭕️ | ⭕️ || | | | | | | | |
| Oscar |||||| ⭕️ | ⭕️ |||||| ⭕️ |||||| | | |
| Oscar |||||| ⭕️ | ⭕️ |||||| ⭕️ |||||| | | |
| Alex |||||||||||| ⭕️ | ⭕️ || | | | | | | |
| ChloeZhu ||| ⭕️ || ⭕️ || | | | | | | | | | | | | | | |
| Ziicu2019 || ⭕️ ||||||||| ⭕️ | ⭕️ || | | | | | | | |
| Hansen ||| ⭕️ |||| ⭕️ | ⭕️ | ⭕️ || | | | | | | | | | | |
| xiaodongQ ||||||||||| ⭕️ | ⭕️ |||||| | | | |
| Ray || ⭕️ |||||||||||||||| | | | |
| xiaodongQ ||||||||||| ⭕️ | ⭕️ |||||| ⭕️ | | | |
| Ray || ⭕️ |||||||||||||||| ⭕️ | | | |
| monnaliya |||||||||||| ⭕️ | ⭕️ || | | | | | | |
| tom_jerry || ⭕️ | ⭕️ || | | | | | | | | | | | | | | | | |
| barry |||| ⭕️ | ⭕️ || | | | | | | | | | | | | | | |
| Dust ||||||||||||||||| ⭕️ | | | | |
| Dust ||||||||||||||||| ⭕️ | ⭕️ | | | |
| Transnature ||| ⭕️ | ⭕️ || | | | | | | | | | | | | | | | |
| Antigone4224 ||| ⭕️ ||| ⭕️ || | | | | | | | | | | | | | |
| Alvan || ⭕️ || ⭕️ || | | | | | | | | | | | | | | | |
| Yiyanwannian |||||||||||||||||| | | | |
| Yiyanwannian |||||||||||||||||| | | | |
| GINAYY || ⭕️ | ⭕️ || | | | | | | | | | | | | | | | | |
| Coooder |||| ⭕️ || ⭕️ ||||| ⭕️ | ⭕️ || | | | | | | | |
| liujianyu2022 |||| ⭕️ || ⭕️ |||| ⭕️ |||| ⭕️ | ⭕️ ||| | | | |
| Capybara |||||||||||||||| ⭕️ | ⭕️ | | | | |
| liujianyu2022 |||| ⭕️ || ⭕️ |||| ⭕️ |||| ⭕️ | ⭕️ ||| | | | |
| Capybara |||||||||||||||| ⭕️ | ⭕️ | | | | |
| billchen-818 ||| ⭕️ | ⭕️ || | | | | | | | | | | | | | | | |
| hython |||| ⭕️ |||| ⭕️ | ⭕️ || | | | | | | | | | | |
| spn ||||||||||||||||| ⭕️ | | | | |
| HazelGong |||| ⭕️ | ⭕️ ||| ⭕️ | ⭕️ |||||| ⭕️ | ⭕️ || | | | |
| Punkcan |||||||||||||||| ⭕️ | ⭕️ | | | | |
| Zemmer |||||||||| ⭕️ || ⭕️ |||||| | | | |
| Lu |||||||| ⭕️ |||||| ⭕️ | ⭕️ || ⭕️ | | | | |
| spn ||||||||||||||||| ⭕️ | ⭕️ | | | |
| HazelGong |||| ⭕️ | ⭕️ ||| ⭕️ | ⭕️ |||||| ⭕️ | ⭕️ || | | | |
| Punkcan |||||||||||||||| ⭕️ | ⭕️ | | | | |
| Zemmer |||||||||| ⭕️ || ⭕️ |||||| | | | |
| Lu |||||||| ⭕️ |||||| ⭕️ | ⭕️ || ⭕️ | | | | |
| Zedz ||||||||||| ⭕️ | ⭕️ || | | | | | | | |
| jidalii || ⭕️ | ⭕️ || | | | | | | | | | | | | | | | | |
| 0xhardman || ⭕️ ||| ⭕️ || | | | | | | | | | | | | | | |
| Kero || ⭕️ | ⭕️ || | | | | | | | | | | | | | | | | |
| Warmzhang || ⭕️ | ⭕️ || | | | | | | | | | | | | | | | | |
| treesirop || ⭕️ | ⭕️ || | | | | | | | | | | | | | | | | |
| btou ||||| ⭕️ || ⭕️ ||||||||||| | | | |
| btou ||||| ⭕️ || ⭕️ ||||||||||| | | | |
| ocean |||| ⭕️ | ⭕️ |||| ⭕️ | ⭕️ || | | | | | | | | | |
| maxwell || ⭕️ |||| ⭕️ || ⭕️ | ⭕️ || | | | | | | | | | | |
<!-- END_COMMIT_TABLE -->
Expand Down Expand Up @@ -364,6 +364,16 @@ ZK 的原理是什么?为什么能实现隐私保护?ZK 技术为什么被
















Expand Down
15 changes: 15 additions & 0 deletions Yiyanwannian_ZICL1st.md
Original file line number Diff line number Diff line change
Expand Up @@ -355,4 +355,19 @@ timezone: Pacific/Auckland # 新西兰标准时间 (UTC+12)
- circom本地环境搭建
### 2024.08.15
- 学习主题:
- Semaphore文档阅读
- 学习内容小结:
- Semaphore本地测试
### 2024.08.16
- 学习主题:
- 看视频 [Semaphore in a Nutshell](https://www.youtube.com/watch?v=WEKqycIMmLY)
- 学习内容小结:
- 了解Semaphore具体是做什么的
<!-- Content_END -->
163 changes: 163 additions & 0 deletions Zemmer_ZICL1st.md
Original file line number Diff line number Diff line change
Expand Up @@ -1811,6 +1811,169 @@ component main = XOR();

#####

### 2024.08.15
### 强制控制相等ForceEqualIfEnabled

1、enabled为输入参数,当1为强制两个输入的整数必须相等,即返回1。否则电路出错。

2、为0时候只是判断两个整数是否相等,和isEqual一样,不做控制。

3、使用场景是有点类似于将输入控制为0或1的x * (1 - x) === 0; 一样,就是控制输入。

```js
pragma circom 2.0.0;

include "IsZero.circom";

template ForceEqualIfEnabled() {
signal input enabled;
signal input in[2];

component isz = IsZero();

in[1] - in[0] ==> isz.in;

(1 - isz.out)*enabled === 0;
}
```

## 交换

将两个输入a和b进行交换,输出为b和a

#### 算数

a, b = b, a

#### 电路

设置了一个开关s

```js
pragma circom 2.1.6;

template Swap() {
signal input input1;
signal input input2;
signal input s; // 交换标识,0 或 1
signal output output1;
signal output output2;

0 === s * (s - 1);
output1 <== (input2 - input1) * s + input1;
output2 <== (input1 - input2) * s + input2;
}

component main = Swap();

/* INPUT = {
"input1": 15,
"input2": 8,
"s": 1
} */

```

#### 场景

排序

## 排序

从大到小排序

#### 代码

```python
a = [ 1, 5, 6, 3]
print( sorted(a, reverse=True))

# 冒泡排序
for i in range(len(a)):
for j in range(0, len(a)-i-1):
if a[j] < a[j+1]:
a[j], a[j+1] = a[j+1], a[j]

print(a) # Output: [6, 5, 3, 1]
```

#### 算法

1、依次比较元素,如果a < b则交换位置

2、比较一轮后开始第二轮,执行元素多的轮次。

#### 电路

1、排序必须导入交换swap、两个数比较大小GreaterThan和数字转化二进制Num2Bits、

2、电路的排序需要明确被比较的元素数量,不能未知数量。

```js
// 以下只能三个非负整数按照从小到大排列。
pragma circom 2.1.6;

include "GreaterThan.circom";
include "Swap.circom";

// BubbleSort3 模板,用于对3个数字进行冒泡排序(从大到小)
template BubbleSort3(n) {
signal input in[3];
signal output out[3];

// 第一次比较和交换
component gt1 = GreaterThan(n);
gt1.in[0] <== in[0];
gt1.in[1] <== in[1];

component swap1 = Swap();
swap1.input1 <== in[0];
swap1.input2 <== in[1];
swap1.s <== gt1.out;

// 交换后的中间结果
signal temp0;
signal temp1;
temp0 <== swap1.output1;
temp1 <== swap1.output2;

// 第二次比较和交换
component gt2 = GreaterThan(n);
gt2.in[0] <== temp0;
gt2.in[1] <== in[2];

component swap2 = Swap();
swap2.input1 <== temp0;
swap2.input2 <== in[2];
swap2.s <== gt2.out;

// 交换后的中间结果
signal temp2;
temp2 <== swap2.output2;

// 第三次比较和交换
component gt3 = GreaterThan(n);
gt3.in[0] <== temp1;
gt3.in[1] <== temp2;

component swap3 = Swap();
swap3.input1 <== temp1;
swap3.input2 <== temp2;
swap3.s <== gt3.out;

// 输出最终结果
out[0] <== swap2.output1;
out[1] <== swap3.output1;
out[2] <== swap3.output2;
}

component main= BubbleSort3(10);

/* INPUT = {
"in": [2,4,2]
} */
```



<!-- Content_END -->
10 changes: 10 additions & 0 deletions btou_ZICL1st.md
Original file line number Diff line number Diff line change
Expand Up @@ -295,4 +295,14 @@ NP Complete场景eg.:
效率:实用电路是为了在计算资源有限的情况下高效工作而设计的。它们需要在短时间内完成计算,并且占用尽量少的内存和处理能力。
举个例子:
如果你要证明你有足够的钱购买一件商品,你可以设计一个实用电路来计算你账户里的余额是否大于商品的价格。这个电路会通过加密的方法来验证这个计算是正确的,但它不会透露你的账户余额具体是多少。
### 2024.08.15
zkVM 就是一个由零知识证明来保证安全可验证可信特性的虚拟机, 简单来说就是, 输入旧状态和程序, 返回新状态. 它能让所有的应用都被赋予零知识证明的超能力。
zkVM 的优点:
易用: 开发者不用学密码学或者零知识开发就可以使用 zkVM 来运行程序保证计算安全 ( 不代表完全无门槛 )
通用: zkVM 可以给任何程序和计算生成证明.
简洁: 相对比较少量 constraints 就可以描述整个 VM ( 不用重复生成整个 VM 的电路 ).
递归: 免费的递归特性. 和通用性一样, 对 VM 的验证可以通过 VM 来进行. 这个就挺好玩, 比如你可以在 zkVM 里放一个 zkVM, 就类似 StarkWare 说的 L3 的概念.
zkVM 的缺点:
计算架构特殊: 并非所有零知识证明系统可以被用来做 zkVM.
性能问题: 电路需要优化, 可以为特定计算进行针对性优化.
<!-- Content_END -->
5 changes: 5 additions & 0 deletions liujianyu2022_ZICL1st.md
Original file line number Diff line number Diff line change
Expand Up @@ -309,4 +309,9 @@ y2 = k(x0 - x2) - y0
今天学习内容:
复习circom代码

### 2024.08.15
今天学习内容:
编写简单的circom代码


<!-- Content_END -->
5 changes: 5 additions & 0 deletions spn_ZICL1st.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,4 +188,9 @@ XDU大四学生,ZK在学。

- 学习主题:复建
- 学习内容小结:熟悉cairo和circom

## 2024.08.15

- 学习主题:学习snarkjs和web3js
- 学习内容小结:学习js跟circom电路结合
- <!-- Content_END -->
6 changes: 6 additions & 0 deletions xiaodongQ_ZICL1st.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,4 +179,10 @@ timezone: Asia/Shanghai
- 学习内容小结:
- 只看了部分

### 2024.08.16

- 学习主题:继续学习视频 [ZKP Lecture 2: Overview of Modern SNARK Constructions](https://www.youtube.com/watch?v=bGEXYpt3sj0)
- 学习内容小结:
- 学习视频

<!-- Content_END -->

0 comments on commit 90389d5

Please sign in to comment.