Skip to content

Commit

Permalink
closing #402 in the old docs repo, references #3081
Browse files Browse the repository at this point in the history
  • Loading branch information
signorecello committed Oct 17, 2023
1 parent c4d63a2 commit 55b0c74
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docs/docs/noir_js/noir_js.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ Your only concern should be to write Noir. Noir.js will work out-of-the box and

## Barretenberg

Since Noir is backend agnostic, you can instantiate `noir_js` with supported backends through their own `js` interface.
Since Noir is backend agnostic, you can instantiate `noir_js` without any backend (i.e. to execute a function). But for proving, you should instantiate it with any of the supported backends through their own `js` interface.

Aztec Labs maintains the `barretenberg` backend. You can use it to instantiate your `Noir` class.
29 changes: 29 additions & 0 deletions docs/docs/noir_js/reference/02_noirjs.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,35 @@ This method takes no parameters
await noirInstance.init();
```

## `execute`

This async method allows to execute a circuit to get its witness and return value. [`generateFinalProof`](#generatefinalproof) calls it for you, but you can call it directly (i.e. to feed directly to a backend, or to get the return value).

### Syntax

```js
async execute(inputs)
```

### Parameters

| Parameter | Type | Description |
| --------- | ------ | ------------------------------------------------ |
| `inputs` | Object | An object containing the inputs to your circuit. |

### Returns

| Return value | Type | Description |
| ------------ | --------------------- | --------------------------------------------------- |
| `witness` | Promise <Uint8Array\> | The witness |
| `returnValue` | Promise <InputMap\> | The return value |

### Usage

```js
const { witness, returnValue } = await noir.execute(inputs)
```

## `generateFinalProof`

This async method generates a witness and a proof given an object as input.
Expand Down

0 comments on commit 55b0c74

Please sign in to comment.