Skip to content

Commit

Permalink
update deps
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuafernandes committed Mar 25, 2024
1 parent 9c5332c commit 14b29bd
Show file tree
Hide file tree
Showing 7 changed files with 12,507 additions and 11,176 deletions.
13 changes: 8 additions & 5 deletions docs/HowTo/prove.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ title: Create and verify proofs
description: How to create and verify proofs
sidebar_position: 5
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

# Create and verify a `Proof`

Expand All @@ -22,9 +24,8 @@ Supported zk-SNARK backends are under `gnark/backend`. `gnark` currently impleme

:::info Use a zk-SNARK back end

<!--tabs-->

# Groth16
<Tabs>
<TabItem value="Groth16" label="Groth16" >

```go
// 1. One time setup
Expand All @@ -38,7 +39,8 @@ err := groth16.Verify(proof, vk, publicWitness)

```

# PlonK
</TabItem>
<TabItem value="PlonK" label="PlonK" >

```go
// 1. One time setup
Expand All @@ -52,7 +54,8 @@ err := plonk.Verify(proof, publicData, publicWitness)

```

<!--/tabs-->
</TabItem>
</Tabs>

:::

Expand Down
19 changes: 12 additions & 7 deletions docs/HowTo/write/standard_library.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ title: Standard library
description: gnark standard library
sidebar_position: 4
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

# `gnark` standard library

We provide the following functions in `gnark/std`:

<!--tabs-->

# MiMC hash
<Tabs>
<TabItem value="MiMC hash" label="MiMC hash" >

```go
func (circuit *mimcCircuit) Define(api frontend.API) error {
Expand All @@ -21,7 +22,8 @@ func (circuit *mimcCircuit) Define(api frontend.API) error {
}
```

# EdDSA signature verification
</TabItem>
<TabItem value="EdDSA signature verification" label="EdDSA signature verification" >

```go
type eddsaCircuit struct {
Expand All @@ -39,7 +41,8 @@ func (circuit *eddsaCircuit) Define(api frontend.API) error {
}
```

# Merkle proof verification
</TabItem>
<TabItem value="Merkle proof verification" label="Merkle proof verification" >

```go
type merkleCircuit struct {
Expand All @@ -54,7 +57,8 @@ func (circuit *merkleCircuit) Define(api frontend.API) error {
}
```

# zk-SNARK verifier
</TabItem>
<TabItem value="zk-SNARK verifier" label="zk-SNARK verifier" >

Enables verifying a _BLS12_377_ Groth16 `Proof` inside a _BW6_761_ circuit

Expand All @@ -73,4 +77,5 @@ func (circuit *verifierCircuit) Define(api frontend.API) error {
}
```

<!--/tabs-->
</TabItem>
</Tabs>
19 changes: 12 additions & 7 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ title: gnark
description: gnark is a fast, open-source zk-SNARK library written in Go
slug: overview
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

# gnark

Expand Down Expand Up @@ -41,9 +43,8 @@ Users write their zk-SNARK circuits in plain Go. `gnark` uses Go because:

:::info Example of how to prove knowledge of a pre-image

<!--tabs-->

# 1. define circuit
<Tabs>
<TabItem value="define circuit" label="define circuit" >

```go
// Circuit defines a pre-image knowledge proof
Expand All @@ -66,14 +67,16 @@ func (circuit *Circuit) Define(api frontend.API) error {
}
```

# 2. compile circuit
</TabItem>
<TabItem value="compile circuit" label="compile circuit" >

```go
var mimcCircuit Circuit
r1cs, err := frontend.Compile(ecc.BN254, r1cs.NewBuilder, &mimcCircuit)
```

# 3. create proof
</TabItem>
<TabItem value="create proof" label="create proof" >

```go
// witness
Expand All @@ -88,7 +91,8 @@ proof, err := groth16.Prove(r1cs, pk, witness)
err := groth16.Verify(proof, vk, publicWitness)
```

# 4. unit test
</TabItem>
<TabItem value="unit test" label="unit test" >

```go
assert := groth16.NewAssert(t)
Expand All @@ -111,7 +115,8 @@ var mimcCircuit Circuit

```

<!--/tabs-->
</TabItem>
</Tabs>

:::

Expand Down
6 changes: 3 additions & 3 deletions docusaurus.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const lightCodeTheme = require("prism-react-renderer/themes/github");
const darkCodeTheme = require("prism-react-renderer/themes/dracula");
const fs = require("fs");
const lightCodeTheme = require("prism-react-renderer").themes.github;
const darkCodeTheme = require("prism-react-renderer").themes.dracula;

const math = require("remark-math");
const katex = require("rehype-katex");
Expand Down Expand Up @@ -45,7 +46,6 @@ const config = {
path: "docs",
// @ts-ignore
// eslint-disable-next-line global-require
remarkPlugins: [require("remark-docusaurus-tabs"), math],
rehypePlugins: [katex],
include: ["**/*.md", "**/*.mdx"],
exclude: [
Expand Down
Loading

0 comments on commit 14b29bd

Please sign in to comment.