This commit is contained in:
AtHeartEngineer
2022-07-07 16:03:00 +00:00
commit 09d40ac45b
19 changed files with 156 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
book

24
book.toml Normal file
View File

@@ -0,0 +1,24 @@
[book]
authors = ["AtHeartEngineer"]
language = "en"
multilingual = false
src = "src"
title = "Rate-Limiting Nullifier"
[rust]
edition = "2021"
[output.html]
additional-js = ["mermaid.min.js", "mermaid-init.js"]
[output.html.search]
limit-results = 15
[preprocessor]
[preprocessor.mermaid]
command = "mdbook-mermaid"
[preprocessor.toc]
command = "mdbook-toc"
renderer = ["html"]

6
build.sh Executable file
View File

@@ -0,0 +1,6 @@
if ! [ -x "$(command -v mdbook)" ]; then
echo 'Error: mdbook is not installed.' >&2
echo 'Error: please install mdbook via cargo.' >&2
exit 1
fi
mdbook build

1
mermaid-init.js Normal file
View File

@@ -0,0 +1 @@
mermaid.initialize({startOnLoad:true});

4
mermaid.min.js vendored Normal file

File diff suppressed because one or more lines are too long

12
package.json Normal file
View File

@@ -0,0 +1,12 @@
{
"name": "rln-documentation",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"build": "./build.sh"
},
"keywords": [],
"author": "",
"license": "ISC"
}

14
src/SUMMARY.md Normal file
View File

@@ -0,0 +1,14 @@
# Summary
- [About](./about.md)
- [Concepts](./concepts.md)
- [What is RLN](./what_is_rln.md)
- [Uses](./uses.md)
- [Terminology](./terminology.md)
- [Under the hood](./under_the_hood.md)
- [Circom Circuit](./rln_circuit.md)
- [References](./references.md)
- [Code](./code.md)
- [Usage](./how_to_use.md)
- [Theory](./theory.md)
- [Shamir's Secret Sharing](./sss.md)

5
src/about.md Normal file
View File

@@ -0,0 +1,5 @@
# About
RLN (Rate-Limiting Nullifier) is part of Privacy & Scaling Explorations (PSE), a multidisciplinary team supported by the Ethereum Foundation. PSE explores new use cases for zero knowledge proofs and other cryptographic primitives.
[appliedzkp.org](https://appliedzkp.org)

1
src/code.md Normal file
View File

@@ -0,0 +1 @@
# Code

3
src/concepts.md Normal file
View File

@@ -0,0 +1,3 @@
# Concepts
This section is a starting point for understanding the concepts of RLN.

1
src/how_to_use.md Normal file
View File

@@ -0,0 +1 @@
# Usage

8
src/references.md Normal file
View File

@@ -0,0 +1,8 @@
# References
[Idea was proposed by Barry WhiteHat](https://ethresear.ch/t/semaphore-rln-rate-limiting-nullifier-for-spam-prevention-in-anonymous-p2p-setting/5009)
[RLN Overview](https://medium.com/privacy-scaling-explorations/rate-limiting-nullifier-a-spam-protection-mechanism-for-anonymous-environments-bbe4006a57d)
[RLN Spec](https://hackmd.io/@aeAuSD7mSCKofwwx445eAQ/BJcfDByNF)
[VAC RLN Spec](https://rfc.vac.dev/spec/32/)

45
src/rln_circuit.md Normal file
View File

@@ -0,0 +1,45 @@
# Circom Circuit for RLN
```mermaid
flowchart TB
subgraph Generate Secret Key
random0(Random 32 bytes) --> a_0(Secret key)
random1(Random 32 bytes) --> a_0
end
subgraph RLN
subgraph Identity Commitment
a_0 --> h0(Poseidon Hash)
h0 --> q(Identity Commitment)
end
subgraph Calculate Internal Nullifier
a_0 --> h1(Poseidon Hash)
epoch(Epoch) --> h1
h1 --> a_1
rln_identifier(RLN Identifier) --> h2(Poseidon Hash)
a_1 --> h2
h2 --> nullifier(RLN Internal Nullifier)
end
subgraph Merkle Tree
q --> merkle_tree_inclusion_proof(Merkle Tree Inclusion Proof)
merkle_tree_inclusion_proof --> root(ZKP of Merkle Tree Root)
end
subgraph Shamirs Secret Scheme
a_0 --> plus(+)
a_1 --> multiply(*)
x(Hashed Messaage) --> multiply
multiply --> plus
plus --> share_y
end
nullifier --> proof(ZKP)
root --> proof
share_y --> proof
end
```

3
src/sss.md Normal file
View File

@@ -0,0 +1,3 @@
# Shamirs Secret Sharing Scheme
[Sharmir's Secret Sharing wikipedia](https://en.wikipedia.org/wiki/Shamir%27s_Secret_Sharing) is a good reference to understand the concept.

16
src/terminology.md Normal file
View File

@@ -0,0 +1,16 @@
# Terminology
Term | Description
---- | -----------
ZK-SNARK | [z.cash/technology/zksnarks/](https://z.cash/technology/zksnarks/)
Stake | Financial or social stake required for registering in the RLN applications. Common stake examples are: locking cryptocurrency (financial), linking reputable social identity.
Identity secret | An array of two unique random components (identity nullifier and identity trapdoor), which must be kept private by the user. Secret hash and identity commitment are derived from this array.
Identity nullifier | Random 32 byte value used as component for identity secret generation.
Identity trapdoor | Random 32 byte value used as component for identity secret generation.
Identity secret hash | The hash of the identity secret, obtained using the Poseidon hash function. It is used for deriving the identity commitment of the user, and as a private input for zk proof generation. The secret hash should be kept private by the user.
Identity commitment | Hash obtained from the Identity secret hash by using the poseidon hash function. It is used by the users for registering in the protocol.
Signal | The message generated by a user. It is an arbitrary bit string that may represent a chat message, a URL request, protobuf message, etc.
Signal hash | Keccak hash of the signal, used as an input in the RLN circuit.
RLN Identifier | Random finite field value unique per RLN app. It is used for additional cross-application security. The role of the RLN identifier is protection of the user secrets being compromised if signals are being generated with the same credentials at different apps.
RLN membership tree | Merkle tree data structure, filled with identity commitments of the users. Serves as a data structure that ensures user registrations.
Merkle proof | Proof that a user is member of the RLN membership tree.

1
src/theory.md Normal file
View File

@@ -0,0 +1 @@
# Theory

1
src/under_the_hood.md Normal file
View File

@@ -0,0 +1 @@
# Under the hood

1
src/uses.md Normal file
View File

@@ -0,0 +1 @@
# Uses

9
src/what_is_rln.md Normal file
View File

@@ -0,0 +1,9 @@
# What is Rate-Limiting Nullifier?
[Idea was proposed by Barry WhiteHat](https://ethresear.ch/t/semaphore-rln-rate-limiting-nullifier-for-spam-prevention-in-anonymous-p2p-setting/5009)
[RLN Overview](https://medium.com/privacy-scaling-explorations/rate-limiting-nullifier-a-spam-protection-mechanism-for-anonymous-environments-bbe4006a57d)
[RLN Spec](https://hackmd.io/@aeAuSD7mSCKofwwx445eAQ/BJcfDByNF)
[VAC RLN Spec](https://rfc.vac.dev/spec/32/)