diff --git a/docs/_data-types-table.mdx b/docs/_data-types-table.mdx new file mode 100644 index 0000000..e65e331 --- /dev/null +++ b/docs/_data-types-table.mdx @@ -0,0 +1,4 @@ +| [Secret](/nada-by-example/secret-data-type) | [Public](/nada-by-example/public-data-type) | [Literals](/nada-by-example/literal-data-type) | +| ----------------------- | ----------------------- | ----------------- | +| `SecretInteger` | `PublicInteger` | `Integer` | +| `SecretUnsignedInteger` | `PublicUnsignedInteger` | `UnsignedInteger` | \ No newline at end of file diff --git a/docs/_operations-table.mdx b/docs/_operations-table.mdx new file mode 100644 index 0000000..31bf079 --- /dev/null +++ b/docs/_operations-table.mdx @@ -0,0 +1,17 @@ + +| Operation with linked example | Syntax | Supported Types
(`P: Public`, `S: Secret`) | +| ----------------------------------------------------------------------- | --------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | +| [Addition](/nada-by-example/addition) | `x + y` | `P ← P + P`,
`S ← P + S`,
`S ← S + P`,
`S ← S + S` | +| [Subtraction](/nada-by-example/subtraction) | `x - y` | `P ← P - P`,
`S ← P - S`,
`S ← S - P`,
`S ← S - S` | +| [Multiplication](/nada-by-example/multiplication) | `x * y` | `P ← P * P`,
`S ← P * S`,
`S ← S * P`,
`S ← S * S` | +| [Power](/nada-by-example/power) | `x ** y` | `P ← P ** P` | +| [Division](/nada-by-example/division) | `x / y` | `P ← P / P`,
`S ← P / S`,
`S ← S / P`,
`S ← S / S` | +| [Modulo](/nada-by-example/modulo) | `x % y` | `P ← P % P`,
`S ← P % S`,
`S ← S % P`,
`S ← S % S` | +| [Left shift](/nada-by-example/shift-left) and [Right shift](/nada-by-example/shift-right) | `x << y`,
`x >> y` | `P ← P << P`,
`S ← S << P` | +| [Probabilistic truncation](/nada-by-example/probabilistic-truncation) | `x.trunc_pr(y)` | `S ← S.trunc_pr(P)` | +| [Comparisons](/nada-by-example/comparison) | `x < y`,
`x <= y`,
`x > y`,
`x >= y` | `P ← P < P`,
`S ← P < S`,
`S ← S < P`,
`S ← S < S` | +| [Ternary](/nada-by-example/if-else) _"if else"_
(public condition) | `cond.if_else(x, y)` | `P ← P.if_else(P, P)`,
`S ← P.if_else(P, S)`,
`S ← P.if_else(S, P)`,
`S ← P.if_else(S, S)` | +| [Ternary](/nada-by-example/if-else) _"if else"_
(secret condition) | `cond.if_else(x, y)` | `S ← S.if_else(P, P)`,
`S ← S.if_else(P, S)`,
`S ← S.if_else(S, P)`,
`S ← S.if_else(S, S)` | +| [Reveal](/nada-by-example/reveal)
(convert a private
value into a public value) | `x.reveal()` | `P ← S.reveal()` | +| [Equality](/nada-by-example/equality) | `x == y` | `S ← S == S`,
`S ← S == P`,
`S ← P == S`,
`P ← P == P` | +| [Public Output Equality](/nada-by-example/equality)
(publicly output if two secrets are equal) | `x.public_equals(y)` | `P ← S.public_equals(S)` | diff --git a/docs/_python-version-info.mdx b/docs/_python-version-info.mdx new file mode 100644 index 0000000..5e6bd9b --- /dev/null +++ b/docs/_python-version-info.mdx @@ -0,0 +1,10 @@ +:::info + +You'll need [python3](https://www.python.org/downloads/) version 3.11 or higher with a working [pip](https://pip.pypa.io/en/stable/getting-started/) installed to import the nada_dsl dependency. Before setting up your Python virtual environment, confirm that you have python3 (version >=3.11) and pip installed + +``` +python3 --version +python3 -m pip --version +``` + +::: \ No newline at end of file diff --git a/docs/nada-by-example-quickstart.md b/docs/nada-by-example-quickstart.md new file mode 100644 index 0000000..98d0470 --- /dev/null +++ b/docs/nada-by-example-quickstart.md @@ -0,0 +1,227 @@ +--- +displayed_sidebar: nadaByExampleSidebar +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; +import PythonVersionInfo from './\_python-version-info.mdx'; + +# Nada by Example Local Setup Guide + +All examples for "Nada by Example" live in the [nada-by-example](https://github.com/NillionNetwork/nada-by-example) Github repo. Nada programs are in [`nada-by-example/src/`](https://github.com/NillionNetwork/nada-by-example/tree/main/src) and tests are in [`nada-by-example/tests`](https://github.com/NillionNetwork/nada-by-example/tree/main/tests). After you complete local repo setup following the instructions below, you can run an example from the repo locally. + +:::tip + +The [nada-by-example](https://github.com/NillionNetwork/nada-by-example) repo is a Nada project created with Nillion's [nada](/nada) tool. You can run all existing `nada` commands found in the [nada tool docs](/nada) to compile programs, get program requirements, run a program, and test a program. +::: + + +## Repo setup instructions + +Install Nillion, clone the nada-by-example repo, and set up a developer environment for your local nada-by-example repo. + +#### 1. Install Nillion globally + +Check to see if you have `nilup`, the Nillion installer installed + +``` +nilup -V +``` + +If you don't have nilup, install nilup + +``` +curl https://nilup.nilogy.xyz/install.sh | bash +``` + +#### 2. Use the latest version of the Nillion SDK + +Install and use the `latest` version of the Nillion SDK and tools. + +``` +nilup install latest +nilup use latest +``` + +#### 3. Optionally enable nilup telemetry, providing your Ethereum wallet address + +``` +nilup instrumentation enable --wallet +``` + +#### 4. Clone the nada-by-example repo + +Star [nada-by-example](https://github.com/NillionNetwork/nada-by-example) on Github so you have it for future reference. Then clone the repo + +``` +git clone https://github.com/NillionNetwork/nada-by-example.git +``` + +#### 5. Create a Python virtual environment and install Nada in nada-by-example + + + +``` +cd nada-by-example +python3 -m venv .venv +source .venv/bin/activate +pip install -r requirements.txt +``` + +#### 6. Build (compile) all Nada programs in the repo + +``` +nada build +``` + +`nada build` is a [nada tool command](/nada#build-compile-a-program) that compiles programs to create one compiled binary (.nada.bin) file per program listed in the [nada-project.toml file](https://github.com/NillionNetwork/nada-by-example/blob/main/nada-project.toml) in the target/ directory. + + +✅ Great work! Now that you've set up the nada-by-example repo, you can run any example. + +## How to run and test an example program + +Every Nada program example has a corresponding test file. Programs are in [`nada-by-example/src/`](https://github.com/NillionNetwork/nada-by-example/tree/main/src) and test files are in [`nada-by-example/tests`](https://github.com/NillionNetwork/nada-by-example/tree/main/tests). Running a program uses the inputs specified in the test file. Testing a program uses the inputs specified in the test file and also checks the outputs against the `expected_outputs` specified in the test file. + + +Run any program with the inputs specified in the test file with [`nada run`](/nada#run-a-program) + +``` +nada run +``` + +Test any program with the inputs and outputs specified in the test file with [`nada test`](/nada#test-a-program) + +``` +nada test +``` + + +### Run the addition example + +Here is the Nada program and test file for the addition example. The program is [src/addition.py](https://github.com/NillionNetwork/nada-by-example/blob/main/src/addition.py) and the test file is [tests/addition_test.yaml](https://github.com/NillionNetwork/nada-by-example/blob/main/tests/addition_test.yaml) + + + + +```python reference showGithubLink +https://github.com/NillionNetwork/nada-by-example/blob/main/src/addition.py +``` + + + +```yaml reference showGithubLink +https://github.com/NillionNetwork/nada-by-example/blob/main/tests/addition_test.yaml +``` + + + +Run the addition program with `addition_test` test inputs: + +``` +nada run addition_test +``` + +The result of running this program is + +``` +(.venv) ➜ nada-by-example git:(main) nada run addition_test +Running program 'addition' with inputs from test file addition_test +Building ... +Running ... +Program ran! +Outputs: { + "sum": SecretInteger( + NadaInt( + 40, + ), + ), +} +``` + +### Test the addition example + +Here is the Nada program and test file for the addition example. The program is [src/addition.py](https://github.com/NillionNetwork/nada-by-example/blob/main/src/addition.py) and the test file is [tests/addition_test.yaml](https://github.com/NillionNetwork/nada-by-example/blob/main/tests/addition_test.yaml) + + + + +```python reference showGithubLink +https://github.com/NillionNetwork/nada-by-example/blob/main/src/addition.py +``` + + + +```yaml reference showGithubLink +https://github.com/NillionNetwork/nada-by-example/blob/main/tests/addition_test.yaml +``` + + + +Test the addition program with `addition_test` test inputs and expected outputs: + +``` +nada test addition_test +``` + +The result of testing this program is + +``` +(.venv) ➜ nada-by-example git:(main) nada test addition_test +Running test: addition_test +Building ... +Running ... +addition_test: PASS +``` + +Testing the addition program with `addition_test` results in a PASS because the expected_outputs `sum` output matches the run result. + +### Add a new test for the addition example + +Use the [nada tool](/nada#generate-a-test-file) to add a new test file named "addition_test_2" for the addition example. + +``` +nada generate-test --test-name addition_test_2 addition +``` + +This results in a new test file: `/tests/addition_test_2.yaml` + +``` +(.venv) ➜ nada-by-example git:(main) nada generate-test --test-name addition_test_2 addition +Generating test 'addition_test_2' for +Building ... +Generating test file ... +Test generated! +``` + +Update the values in the test file to anything you want, for example: + +```yaml +--- +program: addition +inputs: + num_1: + SecretInteger: "100" + num_2: + SecretInteger: "10" +expected_outputs: + sum: + SecretInteger: "110" + +``` + +#### Run addition with your new test + +``` +nada run addition_test_2 +``` + +#### Test addition with your new test + +``` +nada test addition_test_2 +``` + +## Keep exploring examples + +🥳 You're all set up to run and test any example in [nada-by-example](https://github.com/NillionNetwork/nada-by-example). Keep exploring what's possible with Nada by running the rest of the programs in the repo. \ No newline at end of file diff --git a/docs/nada-by-example.md b/docs/nada-by-example.md new file mode 100644 index 0000000..bc887f2 --- /dev/null +++ b/docs/nada-by-example.md @@ -0,0 +1,11 @@ +--- +displayed_sidebar: nadaByExampleSidebar +--- + +# Nada by Example + +Welcome to **Nada by Example**, an introduction to the Nada language with reference examples from the [nada-by-example](https://github.com/NillionNetwork/nada-by-example) repo. [Nada DSL](https://pypi.org/project/nada-dsl) is a Python-based language for defining MPC (Multi-Party Compute) programs on the [Nillion Network](/network). + +Developers can use Nada to write programs that handle secret inputs from multiple parties (i.e., multiple users). These programs compute in a way that ensures they are “blind” to the underlying data, meaning they cannot access or view the secret inputs. This concept is known as “blind computation.” + +To learn more about Nada, check out the full [Nada language docs here](/nada-lang). \ No newline at end of file diff --git a/docs/nada-by-example/addition.md b/docs/nada-by-example/addition.md new file mode 100644 index 0000000..c2e0797 --- /dev/null +++ b/docs/nada-by-example/addition.md @@ -0,0 +1,20 @@ +# Addition + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + + + + + +```python reference showGithubLink +https://github.com/NillionNetwork/nada-by-example/blob/main/src/addition.py +``` + + + +```yaml reference showGithubLink +https://github.com/NillionNetwork/nada-by-example/blob/main/tests/addition_test.yaml +``` + + \ No newline at end of file diff --git a/docs/nada-by-example/comparison.md b/docs/nada-by-example/comparison.md new file mode 100644 index 0000000..ec8b25c --- /dev/null +++ b/docs/nada-by-example/comparison.md @@ -0,0 +1,75 @@ +# Comparison + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +## Less than `<` + + + + +```python reference showGithubLink +https://github.com/NillionNetwork/nada-by-example/blob/main/src/comparison_lt.py +``` + + + +```yaml reference showGithubLink +https://github.com/NillionNetwork/nada-by-example/blob/main/tests/comparison_lt_test.yaml +``` + + + +## Less than or equal to `<=` + + + + +```python reference showGithubLink +https://github.com/NillionNetwork/nada-by-example/blob/main/src/comparison_lte.py +``` + + + +```yaml reference showGithubLink +https://github.com/NillionNetwork/nada-by-example/blob/main/tests/comparison_lte_test.yaml +``` + + + +## Greater than `>` + + + + +```python reference showGithubLink +https://github.com/NillionNetwork/nada-by-example/blob/main/src/comparison_gt.py +``` + + + +```yaml reference showGithubLink +https://github.com/NillionNetwork/nada-by-example/blob/main/tests/comparison_gt_test.yaml +``` + + + +## Greater than or equal to `>=` + + + + +```python reference showGithubLink +https://github.com/NillionNetwork/nada-by-example/blob/main/src/comparison_gte.py +``` + + + +```yaml reference showGithubLink +https://github.com/NillionNetwork/nada-by-example/blob/main/tests/comparison_gte_test.yaml +``` + + + + + diff --git a/docs/nada-by-example/debugging.md b/docs/nada-by-example/debugging.md new file mode 100644 index 0000000..43494c1 --- /dev/null +++ b/docs/nada-by-example/debugging.md @@ -0,0 +1,87 @@ +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# Debugging + +When programming in Nada, keep this phrase in mind: Think Big, Code Small. Read about the "Think Big, Code Small" philosophy with [Nada best practices and more debugging tips here](/nada-debugging). + +## Debugging with print() + +When developing and debugging Nada programs, it can be helpful to inspect the values and types of variables at various points in your code. You can do this by adding Python `print()` statements, then running the file directly. + + +### 1. Include a Python main block + +To use print statements for debugging in a Nada program, you can add the following Python main block to the end of your Nada program file. This block ensures that the `nada_main()` function runs standalone as the main program when the script is executed directly. + +```python +if __name__ == "__main__": + nada_main() +``` + +### 2. Add print() statements + +Add print() statements within the Nada program to print variables or types of variables. + +### 3. Run the program with Python + +Run the program with Python to print any print() statements to the terminal. + +``` +python3 src/[program_name].py +``` + +### 4. Remove print() statments before compiling a Nada program + +Make sure to comment out or remove all print statements before compiling Nada programs, as Nada compilation will fail if any print statements are included. + +The Python main block can be left in for Nada program compilation. + +## Debugging example + + + + + +```python reference showGithubLink +https://github.com/NillionNetwork/nada-by-example/blob/main/src/debug.py +``` + + + +```yaml reference showGithubLink +https://github.com/NillionNetwork/nada-by-example/blob/main/tests/debug_test.yaml +``` + + + +### Print type of variable + +Printing the type of a variable prints the Nada data type to your terminal as a class. When debugging with `type()`, double check that your Nada operation supports the type printed by looking at the [Nada Operations](/nada-by-example/nada-operations) Supported Types column. + +``` +print(type(sum)) +``` + +``` +(.venv) ➜ nada-by-example git:(main) ✗ python3 src/debug.py + +``` + +### Print variable + +Printing a variable prints the Nada data type of the variable and any applicable operation types to your terminal. When debugging with operation types, check that the Nada operation type and syntax are correct by looking at the [Nada Operations](/nada-by-example/nada-operations) Syntax and Supported Types columns. + + +``` +print(sum) +``` + +``` +(.venv) ➜ nada-by-example git:(main) ✗ python3 src/debug.py +SecretInteger(inner=) +``` + +## Next steps + +🐛 Now that you've learned to debug, you're ready play with Nada programs. Move on to the next section where you will set up a local environment and run and test Nada programs locally following the [Nada by Example Local Setup Guide](/nada-by-example-quickstart). \ No newline at end of file diff --git a/docs/nada-by-example/division.md b/docs/nada-by-example/division.md new file mode 100644 index 0000000..98a1d2e --- /dev/null +++ b/docs/nada-by-example/division.md @@ -0,0 +1,22 @@ +# Division + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + + + + + +```python reference showGithubLink +https://github.com/NillionNetwork/nada-by-example/blob/main/src/division.py +``` + + + +```yaml reference showGithubLink +https://github.com/NillionNetwork/nada-by-example/blob/main/tests/division_test.yaml +``` + + + + diff --git a/docs/nada-by-example/equality.md b/docs/nada-by-example/equality.md new file mode 100644 index 0000000..a946e03 --- /dev/null +++ b/docs/nada-by-example/equality.md @@ -0,0 +1,38 @@ +# Equality (Equals) + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +## Private equality `==` + + + + +```python reference showGithubLink +https://github.com/NillionNetwork/nada-by-example/blob/main/src/equality.py +``` + + + +```yaml reference showGithubLink +https://github.com/NillionNetwork/nada-by-example/blob/main/tests/equality_test.yaml +``` + + + +## Public output equality `==` + + + + +```python reference showGithubLink +https://github.com/NillionNetwork/nada-by-example/blob/main/src/equality_public.py +``` + + + +```yaml reference showGithubLink +https://github.com/NillionNetwork/nada-by-example/blob/main/tests/equality_public_test.yaml +``` + + \ No newline at end of file diff --git a/docs/nada-by-example/first-program.md b/docs/nada-by-example/first-program.md new file mode 100644 index 0000000..44716c0 --- /dev/null +++ b/docs/nada-by-example/first-program.md @@ -0,0 +1,89 @@ +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# Your First Nada Program + +Welcome to your first Nada program example! This example is an addition program that is meant to help you understand the basics of writing a Nada program and introduce key concepts such as a `Party`, `Input`, `SecretInteger`, `Operation`, and `Output`. + +This addition program in Nada demonstrates how to handle secret inputs from multiple parties, perform a computation (addition), and produce an output for another party. + +## Nada program and test file + + + + + +The `addition` Nada program takes in a secret input from Alice and a secret input from Bob. It runs an addition operation to get the sum of the two secret inputs. The Nada program returns an output, the sum, to Charlie who never sees the values of Alice or Bob's secret inputs. + +```python reference showGithubLink +https://github.com/NillionNetwork/nada-by-example/blob/main/src/addition.py +``` + + + + +You can auto-generate a test file like this one for any nada program with the [nada tool](/nada#generate-a-test-file). A test file verifies that the program works as expected. It provides test inputs and defines the expected outputs given the inputs. You'll learn how to run programs and test programs as part of the [Local Setup Guide](/nada-by-example-quickstart) + +```yaml reference showGithubLink +https://github.com/NillionNetwork/nada-by-example/blob/main/tests/addition_test.yaml +``` + + + + + +## Nada Program Key Concepts + +### Parties + +A `Party` represents a user or entity participating in the computation. A party can provide inputs and/or receive outputs. The addition program has 3 parties named Alice, Bob, and Charlie. Alice and Bob provide inputs to the program. Charlie receives the output of the program. + +```python reference showGithubLink +https://github.com/NillionNetwork/nada-by-example/blob/main/src/addition.py#L4-L6 +``` + +### Inputs + +An `Input` is a value provided to a Nada program by a specific party. Inputs are wrapped with one of the following `Public` or `Secret` data types: + +| `Public` | `Secret` | +| ----------------------- | ----------------------- | +| `PublicInteger` | `SecretInteger` | +| `PublicUnsignedInteger` | `SecretUnsignedInteger` | + +The addition program has two `SecretInteger` typed `Input`: + +1. `num_1` input by Alice +2. `num_2` input by Bob. + +```python reference showGithubLink +https://github.com/NillionNetwork/nada-by-example/blob/main/src/addition.py#L7-L8 +``` + +### Operations + +An operation is a computation performed on inputs to produce a result. In Nada, operations can be performed on both public and secret data types. Check out the full list of available [Nada operations here](/nada-by-example/nada-operations). + +The addition program involves one operation, addition, to sum the 2 secret inputs. + +```python reference showGithubLink +https://github.com/NillionNetwork/nada-by-example/blob/main/src/addition.py#L9 +``` + +### Outputs + +An `Output` defines how the result of the computation is shared with the parties. It ensures that the result of blind computation is properly revealed only to the intended party or parties. + +```python reference showGithubLink +https://github.com/NillionNetwork/nada-by-example/blob/main/src/addition.py#L10 +``` + +The addition program returns one output, the sum to Charlie. Charlie can see the resulting sum, but never sees the values of Alice or Bob's secret inputs that were added together to get the sum. This shows the power of blind computation! + +## Wrap up + +In this example, you learned how to use Nada to create a multiplication program that performs blind computation. By defining Party, Input, SecretInteger, performing an Operation, and specifying Output, you can compute on secret inputs from multiple users. This ensures that sensitive data remains confidential throughout the computation process. + +The power of Nada lies in its ability to compute on secret inputs without revealing the underlying data to any party involved. This makes Nada programs perfect for applications requiring high levels of privacy and security. + +Continue learning and experimenting with Nada by **learning how to debug a Nada program** in the next section. \ No newline at end of file diff --git a/docs/nada-by-example/for-loop.md b/docs/nada-by-example/for-loop.md new file mode 100644 index 0000000..4459ff0 --- /dev/null +++ b/docs/nada-by-example/for-loop.md @@ -0,0 +1,22 @@ +# For Loop + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + + + + + +```python reference showGithubLink +https://github.com/NillionNetwork/nada-by-example/blob/main/src/for_loop.py +``` + + + +```yaml reference showGithubLink +https://github.com/NillionNetwork/nada-by-example/blob/main/tests/for_loop_test.yaml +``` + + + + diff --git a/docs/nada-by-example/helper-function.md b/docs/nada-by-example/helper-function.md new file mode 100644 index 0000000..a530412 --- /dev/null +++ b/docs/nada-by-example/helper-function.md @@ -0,0 +1,22 @@ +# Helper Functions + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + + + + + +```python reference showGithubLink +https://github.com/NillionNetwork/nada-by-example/blob/main/src/list_comprehensions_with_helper.py +``` + + + +```yaml reference showGithubLink +https://github.com/NillionNetwork/nada-by-example/blob/main/tests/list_comprehensions_with_helper_test.yaml +``` + + + + diff --git a/docs/nada-by-example/if-else.md b/docs/nada-by-example/if-else.md new file mode 100644 index 0000000..773797b --- /dev/null +++ b/docs/nada-by-example/if-else.md @@ -0,0 +1,38 @@ +# If / Else (Ternary) + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +## If / Else with a public condition + + + + +```python reference showGithubLink +https://github.com/NillionNetwork/nada-by-example/blob/main/src/if_else_public.py +``` + + + +```yaml reference showGithubLink +https://github.com/NillionNetwork/nada-by-example/blob/main/tests/if_else_public_test.yaml +``` + + + +## If / Else with a private condition + + + + +```python reference showGithubLink +https://github.com/NillionNetwork/nada-by-example/blob/main/src/if_else_private.py +``` + + + +```yaml reference showGithubLink +https://github.com/NillionNetwork/nada-by-example/blob/main/tests/if_else_private_test.yaml +``` + + \ No newline at end of file diff --git a/docs/nada-by-example/list-comprehensions.md b/docs/nada-by-example/list-comprehensions.md new file mode 100644 index 0000000..801556f --- /dev/null +++ b/docs/nada-by-example/list-comprehensions.md @@ -0,0 +1,22 @@ +# List Comprehensions + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + + + + + +```python reference showGithubLink +https://github.com/NillionNetwork/nada-by-example/blob/main/src/list_comprehensions.py +``` + + + +```yaml reference showGithubLink +https://github.com/NillionNetwork/nada-by-example/blob/main/tests/list_comprehensions_test.yaml +``` + + + + diff --git a/docs/nada-by-example/literal-data-type.md b/docs/nada-by-example/literal-data-type.md new file mode 100644 index 0000000..d738b51 --- /dev/null +++ b/docs/nada-by-example/literal-data-type.md @@ -0,0 +1,44 @@ +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# Literals + +Literals are constant values defined within the program rather than provided by a party. + +## Integer + +`Integer` represents a literal integer value. This value can be a negative integer, a positive integer, or zero. + + + + +```python reference showGithubLink +https://github.com/NillionNetwork/nada-by-example/blob/main/src/addition_literal.py +``` + + + +```yaml reference showGithubLink +https://github.com/NillionNetwork/nada-by-example/blob/main/tests/addition_literal_test.yaml +``` + + + +## UnsignedInteger + +`UnsignedInteger` represents a literal unsigned integer value. This value can be zero or a positive integer. + + + + +```python reference showGithubLink +https://github.com/NillionNetwork/nada-by-example/blob/main/src/addition_literal_unsigned.py +``` + + + +```yaml reference showGithubLink +https://github.com/NillionNetwork/nada-by-example/blob/main/tests/addition_literal_unsigned_test.yaml +``` + + \ No newline at end of file diff --git a/docs/nada-by-example/modulo.md b/docs/nada-by-example/modulo.md new file mode 100644 index 0000000..cf994c9 --- /dev/null +++ b/docs/nada-by-example/modulo.md @@ -0,0 +1,22 @@ +# Modulo + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + + + + + +```python reference showGithubLink +https://github.com/NillionNetwork/nada-by-example/blob/main/src/modulo.py +``` + + + +```yaml reference showGithubLink +https://github.com/NillionNetwork/nada-by-example/blob/main/tests/modulo_test.yaml +``` + + + + diff --git a/docs/nada-by-example/multiplication.md b/docs/nada-by-example/multiplication.md new file mode 100644 index 0000000..a47f3bb --- /dev/null +++ b/docs/nada-by-example/multiplication.md @@ -0,0 +1,22 @@ +# Multiplication + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + + + + + +```python reference showGithubLink +https://github.com/NillionNetwork/nada-by-example/blob/main/src/multiplication.py +``` + + + +```yaml reference showGithubLink +https://github.com/NillionNetwork/nada-by-example/blob/main/tests/multiplication_test.yaml +``` + + + + diff --git a/docs/nada-by-example/nada-ai.md b/docs/nada-by-example/nada-ai.md new file mode 100644 index 0000000..9061c4d --- /dev/null +++ b/docs/nada-by-example/nada-ai.md @@ -0,0 +1,21 @@ +import DocCardList from '@theme/DocCardList'; + +# Nada AI + +Nada-AI is a Python library designed for AI/ML on top of Nada DSL and Nillion Network. + +To learn more about the library, check out the full [Nada-AI docs here](/nada-ai-introduction). + +:::info +## Nada AI Limitations + +The choice for blind computing implies certain trade-offs in comparison to conventional computing. What you gain in privacy, you pay in extra computational overhead & capacity constraints. + +Therefore, you will notice that large-scale computational workloads may lead to long compilation and/or execution times or hitting network capacity guardrails. Each example lists model limitations or the number of input elements it has been tested with. + +That said, the Nillion team is working around the clock to push the boundaries of this technology and bring the potential of blind computing to reality. 🚀 +::: + +## Nada AI Examples with Google Colab Links + + \ No newline at end of file diff --git a/docs/nada-by-example/nada-data-types.md b/docs/nada-by-example/nada-data-types.md new file mode 100644 index 0000000..69ba5ca --- /dev/null +++ b/docs/nada-by-example/nada-data-types.md @@ -0,0 +1,11 @@ +import NadaDataTypesTable from '../\_data-types-table.mdx'; + +# Primitive Data Types + +This chart shows the primitive data types available in Nada. Each data type links to example Nada programs. + + + +[Secret](/nada-by-example/secret-data-type) and [Public](/nada-by-example/public-data-type) data types are used to specify user inputs to a Nada program. + +[Literals](/nada-by-example/literal-data-type) can only be used within a Nada program. \ No newline at end of file diff --git a/docs/nada-by-example/nada-numpy.md b/docs/nada-by-example/nada-numpy.md new file mode 100644 index 0000000..314772e --- /dev/null +++ b/docs/nada-by-example/nada-numpy.md @@ -0,0 +1,11 @@ +import DocCardList from '@theme/DocCardList'; + +# Nada Numpy + +Nada Numpy is a Python library designed for algebraic operations on NumPy-like array objects on top of Nada DSL and Nillion Network. + +To learn more about the library, check out the full [Nada-Numpy docs here](/nada-numpy-introduction). + +## Nada Numpy Examples with Google Colab Links + + \ No newline at end of file diff --git a/docs/nada-by-example/nada-operations.md b/docs/nada-by-example/nada-operations.md new file mode 100644 index 0000000..330f256 --- /dev/null +++ b/docs/nada-by-example/nada-operations.md @@ -0,0 +1,7 @@ +import NadaOperationsTable from '../\_operations-table.mdx'; + +# Nada Operations + +This chart shows all supported Nada operations, their syntax, and supported data types. Each operation has a linked example Nada program. + + \ No newline at end of file diff --git a/docs/nada-by-example/power.md b/docs/nada-by-example/power.md new file mode 100644 index 0000000..274cad9 --- /dev/null +++ b/docs/nada-by-example/power.md @@ -0,0 +1,22 @@ +# Power + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + + + + + +```python reference showGithubLink +https://github.com/NillionNetwork/nada-by-example/blob/main/src/power.py +``` + + + +```yaml reference showGithubLink +https://github.com/NillionNetwork/nada-by-example/blob/main/tests/power_test.yaml +``` + + + + diff --git a/docs/nada-by-example/probabilistic-truncation.md b/docs/nada-by-example/probabilistic-truncation.md new file mode 100644 index 0000000..07017d5 --- /dev/null +++ b/docs/nada-by-example/probabilistic-truncation.md @@ -0,0 +1,22 @@ +# Probabilistic Truncation + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + + + + + +```python reference showGithubLink +https://github.com/NillionNetwork/nada-by-example/blob/main/src/probabilistic_truncation.py +``` + + + +```yaml reference showGithubLink +https://github.com/NillionNetwork/nada-by-example/blob/main/tests/probabilistic_truncation_test.yaml +``` + + + + diff --git a/docs/nada-by-example/public-data-type.md b/docs/nada-by-example/public-data-type.md new file mode 100644 index 0000000..57d4a1b --- /dev/null +++ b/docs/nada-by-example/public-data-type.md @@ -0,0 +1,44 @@ +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# Public + +The Public data type is used for inputs that are not sensitive and can be shown in the clear during computation. These input values are visible to the program. + +## PublicInteger + +`PublicInteger` represents a user input public integer value. This value can be a negative integer, a positive integer, or zero. + + + + +```python reference showGithubLink +https://github.com/NillionNetwork/nada-by-example/blob/main/src/addition_public.py +``` + + + +```yaml reference showGithubLink +https://github.com/NillionNetwork/nada-by-example/blob/main/tests/addition_public_test.yaml +``` + + + +## PublicUnsignedInteger + +`PublicUnsignedInteger` represents a user input public unsigned integer value. This value can be zero or a positive integer. + + + + +```python reference showGithubLink +https://github.com/NillionNetwork/nada-by-example/blob/main/src/addition_public_unsigned.py +``` + + + +```yaml reference showGithubLink +https://github.com/NillionNetwork/nada-by-example/blob/main/tests/addition_public_unsigned_test.yaml +``` + + \ No newline at end of file diff --git a/docs/nada-by-example/r-p-s.md b/docs/nada-by-example/r-p-s.md new file mode 100644 index 0000000..4fda7ca --- /dev/null +++ b/docs/nada-by-example/r-p-s.md @@ -0,0 +1,35 @@ +# Rock Paper Scissors + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + + + + + +```python reference showGithubLink +https://github.com/NillionNetwork/nada-by-example/blob/main/src/rock_paper_scissors.py +``` + + + +```yaml reference showGithubLink +https://github.com/NillionNetwork/nada-by-example/blob/main/tests/rock_paper_scissors_tie.yaml +``` + + +```yaml reference showGithubLink +https://github.com/NillionNetwork/nada-by-example/blob/main/tests/rock_paper_scissors_rock.yaml +``` + + +```yaml reference showGithubLink +https://github.com/NillionNetwork/nada-by-example/blob/main/tests/rock_paper_scissors_paper.yaml +``` + + +```yaml reference showGithubLink +https://github.com/NillionNetwork/nada-by-example/blob/main/tests/rock_paper_scissors_scissors.yaml +``` + + \ No newline at end of file diff --git a/docs/nada-by-example/reduce.md b/docs/nada-by-example/reduce.md new file mode 100644 index 0000000..2f14d7b --- /dev/null +++ b/docs/nada-by-example/reduce.md @@ -0,0 +1,20 @@ +# Reduce + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + + + + + +```python reference showGithubLink +https://github.com/NillionNetwork/nada-by-example/blob/main/src/reduce.py +``` + + + +```yaml reference showGithubLink +https://github.com/NillionNetwork/nada-by-example/blob/main/tests/reduce_test.yaml +``` + + \ No newline at end of file diff --git a/docs/nada-by-example/reveal.md b/docs/nada-by-example/reveal.md new file mode 100644 index 0000000..fec2cec --- /dev/null +++ b/docs/nada-by-example/reveal.md @@ -0,0 +1,22 @@ +# Reveal + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + + + + + +```python reference showGithubLink +https://github.com/NillionNetwork/nada-by-example/blob/main/src/reveal.py +``` + + + +```yaml reference showGithubLink +https://github.com/NillionNetwork/nada-by-example/blob/main/tests/reveal_test.yaml +``` + + + + diff --git a/docs/nada-by-example/secret-data-type.md b/docs/nada-by-example/secret-data-type.md new file mode 100644 index 0000000..7d0377d --- /dev/null +++ b/docs/nada-by-example/secret-data-type.md @@ -0,0 +1,44 @@ +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# Secret + +The Secret data type is used for inputs that need to be kept confidential during computation. These input values are not visible to the program. + +## SecretInteger + +`SecretInteger` represents a user input secret integer value. This value can be a negative integer, a positive integer, or zero. + + + + +```python reference showGithubLink +https://github.com/NillionNetwork/nada-by-example/blob/main/src/multiplication.py +``` + + + +```yaml reference showGithubLink +https://github.com/NillionNetwork/nada-by-example/blob/main/tests/multiplication_test.yaml +``` + + + +## SecretUnsignedInteger + +`SecretUnsignedInteger` represents a user input secret unsigned integer value. This value can be zero or a positive integer. + + + + +```python reference showGithubLink +https://github.com/NillionNetwork/nada-by-example/blob/main/src/addition_unsigned.py +``` + + + +```yaml reference showGithubLink +https://github.com/NillionNetwork/nada-by-example/blob/main/tests/addition_unsigned_test.yaml +``` + + \ No newline at end of file diff --git a/docs/nada-by-example/shift-left.md b/docs/nada-by-example/shift-left.md new file mode 100644 index 0000000..33c9c85 --- /dev/null +++ b/docs/nada-by-example/shift-left.md @@ -0,0 +1,22 @@ +# Left Shift + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + + + + + +```python reference showGithubLink +https://github.com/NillionNetwork/nada-by-example/blob/main/src/shift_left.py +``` + + + +```yaml reference showGithubLink +https://github.com/NillionNetwork/nada-by-example/blob/main/tests/shift_left_test.yaml +``` + + + + diff --git a/docs/nada-by-example/shift-right.md b/docs/nada-by-example/shift-right.md new file mode 100644 index 0000000..60dd772 --- /dev/null +++ b/docs/nada-by-example/shift-right.md @@ -0,0 +1,22 @@ +# Right Shift + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + + + + + +```python reference showGithubLink +https://github.com/NillionNetwork/nada-by-example/blob/main/src/shift_right.py +``` + + + +```yaml reference showGithubLink +https://github.com/NillionNetwork/nada-by-example/blob/main/tests/shift_right_test.yaml +``` + + + + diff --git a/docs/nada-by-example/subtraction.md b/docs/nada-by-example/subtraction.md new file mode 100644 index 0000000..73c2577 --- /dev/null +++ b/docs/nada-by-example/subtraction.md @@ -0,0 +1,22 @@ +# Subtraction + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + + + + + +```python reference showGithubLink +https://github.com/NillionNetwork/nada-by-example/blob/main/src/subtraction.py +``` + + + +```yaml reference showGithubLink +https://github.com/NillionNetwork/nada-by-example/blob/main/tests/subtraction_test.yaml +``` + + + + diff --git a/docs/nada-by-example/voting.md b/docs/nada-by-example/voting.md new file mode 100644 index 0000000..967548c --- /dev/null +++ b/docs/nada-by-example/voting.md @@ -0,0 +1,19 @@ +# Voting + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + + + + +```python reference showGithubLink +https://github.com/NillionNetwork/nada-by-example/blob/main/src/voting.py +``` + + + +```yaml reference showGithubLink +https://github.com/NillionNetwork/nada-by-example/blob/main/tests/voting_test.yaml +``` + + \ No newline at end of file diff --git a/docs/nada-lang-operators.md b/docs/nada-lang-operators.md index d9c9b1e..5c9fcc7 100644 --- a/docs/nada-lang-operators.md +++ b/docs/nada-lang-operators.md @@ -1,22 +1,9 @@ +import NadaOperationsTable from './\_operations-table.mdx'; + # Built-In Operations Overview of the primitive and the array Nada operations. ## Primitive Operations -| Name | Syntax | Supported Types
(`P: Public`, `S: Secret`) | -| ----------------------------------------------------------------------- | --------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | -| Addition | `x + y` | `P ← P + P`,
`S ← P + S`,
`S ← S + P`,
`S ← S + S` | -| Subtraction | `x - y` | `P ← P - P`,
`S ← P - S`,
`S ← S - P`,
`S ← S - S` | -| Multiplication | `x * y` | `P ← P * P`,
`S ← P * S`,
`S ← S * P`,
`S ← S * S` | -| Power | `x ** y` | `P ← P ** P` | -| Division | `x / y` | `P ← P / P`,
`S ← P / S`,
`S ← S / P`,
`S ← S / S` | -| Modulo | `x % y` | `P ← P % P`,
`S ← P % S`,
`S ← S % P`,
`S ← S % S` | -| Shifts | `x << y`,
`x >> y` | `P ← P << P`,
`S ← S << P` | -| Probabilistic truncation | `x.trunc_pr(y)` | `S ← S.trunc_pr(P)` | -| Comparisons | `x < y`,
`x <= y`,
`x > y`,
`x >= y` | `P ← P < P`,
`S ← P < S`,
`S ← S < P`,
`S ← S < S` | -| Ternary _"if else"_
(public condition) | `cond.if_else(x, y)` | `P ← P.if_else(P, P)`,
`S ← P.if_else(P, S)`,
`S ← P.if_else(S, P)`,
`S ← P.if_else(S, S)` | -| Ternary _"if else"_
(secret condition) | `cond.if_else(x, y)` | `S ← S.if_else(P, P)`,
`S ← S.if_else(P, S)`,
`S ← S.if_else(S, P)`,
`S ← S.if_else(S, S)` | -| Reveal
(convert a private
value into a public value) | `x.reveal()` | `P ← S.reveal()` | -| Equality | `x == y` | `S ← S == S`,
`S ← S == P`,
`S ← P == S`,
`P ← P == P` | -| Public Output Equality
(publicly output if two secrets are equal) | `x.public_equals(y)` | `P ← S.public_equals(S)` | + \ No newline at end of file diff --git a/docs/nada-lang-types.md b/docs/nada-lang-types.md index f0e3425..e9bb0dd 100644 --- a/docs/nada-lang-types.md +++ b/docs/nada-lang-types.md @@ -1,15 +1,14 @@ +import NadaDataTypesTable from './\_data-types-table.mdx'; + # Data Types Overview of the primitive and the compound Nada data types. ## Primitive Data Types -| `Public` | `Secret` | `Literals` | -| ----------------------- | ----------------------- | ----------------- | -| `PublicInteger` | `SecretInteger` | `Integer` | -| `PublicUnsignedInteger` | `SecretUnsignedInteger` | `UnsignedInteger` | + -`Public` and `Secret` data types can be used to specify user inputs as: +`Secret` and `Public` data types can be used to specify user inputs as: ```python a = SecretInteger(Input(name="a", party=party1)) diff --git a/docs/python-client-reference.md b/docs/python-client-reference.md index d0db75d..091d564 100644 --- a/docs/python-client-reference.md +++ b/docs/python-client-reference.md @@ -1116,7 +1116,7 @@ Returns the SDK client’s instance party ID, which can be used by the client to create program bindings (`ProgramBindings`, check examples). -Effectively, the party ID is equivalent to the the Peer ID +Effectively, the party ID is equivalent to the Peer ID used within libp2p for inter-node communication. It is a hash generated from the public key of the node’s key-pair (`NodeKey`). Not to be confused with the `user_id()` which is generated from the @@ -1362,7 +1362,7 @@ Store values in the Nillion Network. str * **Raises:** **TypeError** – When using bindings, the input party name provided (e.g. “InputPartyName”) must - match the input party name in the Nada program. Otherwise, we get a TypeError. + match the input party name in the Nada program. Otherwise, we get a TypeError. ### Example diff --git a/docs/quickstart-nada.md b/docs/quickstart-nada.md index 736600d..2abccba 100644 --- a/docs/quickstart-nada.md +++ b/docs/quickstart-nada.md @@ -1,11 +1,25 @@ import VenvSetup from './\_nada-venv-setup.mdx'; import UnderstandingProgram from './\_understanding-first-nada-program.mdx'; import CompileRunTest from './\_quickstart-compile-run-test.mdx'; +import PythonVersionInfo from './\_python-version-info.mdx'; # Create a Nada project and write your first Nada program The [`nada`](/nada) tool is used to create a new Nada project, compile all programs in the project, run Nada programs, and generate tests for Nada programs. +:::info + +Before starting this guide, [Install the Nillion SDK](/installation) + +Confirm installation: + +``` +nillion -V +``` + +::: + + ## Create a new Nada project Create a `quickstart` directory. Inside of `quickstart`, use the [`nada`](/nada) tool to create a new nada project named "nada_quickstart_programs" by running @@ -20,16 +34,7 @@ nada init nada_quickstart_programs The Nillion Network leverages Nada, our MPC language, for defining MPC programs. Our initial implementation of Nada comes in the form of Nada, a Python DSL (Domain Specific Language). -:::info - -You'll need [python3](https://www.python.org/downloads/) version 3.11 or higher with a working [pip](https://pip.pypa.io/en/stable/getting-started/) installed to import the nada_dsl dependency. Before setting up your Python virtual environment, confirm that you have python3 (version >=3.11) and pip installed - -``` -python3 --version -python3 -m pip --version -``` - -::: + 0. Change directories into your new nada project directory diff --git a/docs/start-building.md b/docs/start-building.md new file mode 100644 index 0000000..1c29a49 --- /dev/null +++ b/docs/start-building.md @@ -0,0 +1,20 @@ +# Start Building + +Start building on Nillion with one of our developer quickstart guides. + +## Write a Nada Program + +The [Nada Quickstart](/quickstart-nada) will teach you how to create a Nada project and write your first privacy-preserving Nada program. The [Nada by Example Portal](/nada-by-example) is an introduction to Nada with lots of example programs for your reference. + +## Build a Blind App + +This [Blind App Quickstart](/quickstart) is ideal for developers interested in **building frontends or fullstack web apps** on Nillion. This quickstart will guide you through writing a Nada program, storing the program on the Nillion Netowrk, and creating a blind web app lets you store secrets and run your Nada program in the browser. + +## Connect a backend to Nillion + +If you want to **connect a backend** to Nillion, check out the Nillion [Python Quickstart](/python-quickstart). + + +## Write a privacy-preserving Blind AI Nada program + +To write privacy-preserving AI programs, check out our [Nada AI](/nada-by-example/nada-ai) examples, tutorials, and Google Colab links. \ No newline at end of file diff --git a/docusaurus.config.js b/docusaurus.config.js index ff899b4..55de9ac 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -78,6 +78,18 @@ const config = { src: 'img/logo.svg', }, items: [ + { + type: 'doc', + position: 'left', + docId: 'welcome', + label: 'Docs', + }, + { + type: 'doc', + position: 'left', + docId: 'nada-by-example', + label: 'Nada by Example', + }, { href: 'https://github.com/NillionNetwork', label: 'GitHub', diff --git a/sidebars.js b/sidebars.js index 6c064d2..2ac808a 100644 --- a/sidebars.js +++ b/sidebars.js @@ -54,7 +54,7 @@ const sidebars = { { type: 'html', className: 'sidebar-title', - value: 'About', + value: 'Learn', defaultStyle: true, }, 'what-is-nillion', @@ -62,13 +62,14 @@ const sidebars = { 'multi-party-computation', 'nillions-mpc-protocol', 'network', + 'concepts', { type: 'html', className: 'sidebar-title', value: 'Build', defaultStyle: true, }, - 'concepts', + 'start-building', 'network-configuration', { type: 'category', @@ -232,11 +233,6 @@ const sidebars = { label: 'Lists and Iteration', id: 'nada-lang-tutorial-lists-and-iteration', }, - { - type: 'link', - label: 'More Example Programs', - href: 'https://github.com/NillionNetwork/nillion-python-starter/tree/main/programs', - }, { type: 'doc', label: 'Debugging', @@ -334,6 +330,11 @@ const sidebars = { }, ], }, + { + type: 'link', + label: 'Nada by Example', + href: '/nada-by-example', + }, ], }, 'limitations', @@ -409,6 +410,164 @@ const sidebars = { href: 'https://nillion.com/news', }, ], + nadaByExampleSidebar: [ + { + type: 'html', + className: 'sidebar-title', + value: 'Nada by Example', + defaultStyle: true, + }, + { + type: 'doc', + label: 'Introduction', + id: 'nada-by-example', + }, + 'nada-by-example/first-program', + 'nada-by-example/debugging', + { + type: 'doc', + label: 'Local Setup Guide', + id: 'nada-by-example-quickstart', + }, + { + type: 'link', + label: 'Ask a Nada Question', + href: 'https://github.com/orgs/NillionNetwork/discussions/categories/q-a', + }, + { + type: 'html', + className: 'sidebar-title', + value: 'Nada Program Examples', + defaultStyle: true, + }, + { + type: 'category', + label: 'Primitive Data Types', + link: { + type: 'doc', + id: 'nada-by-example/nada-data-types', + }, + items: [ + 'nada-by-example/secret-data-type', + 'nada-by-example/public-data-type', + 'nada-by-example/literal-data-type', + ] + }, + { + type: 'category', + label: 'Nada Operations', + link: { + type: 'doc', + id: 'nada-by-example/nada-operations', + }, + items: [ + 'nada-by-example/addition', + 'nada-by-example/subtraction', + 'nada-by-example/multiplication', + 'nada-by-example/division', + 'nada-by-example/power', + 'nada-by-example/modulo', + 'nada-by-example/shift-left', + 'nada-by-example/shift-right', + 'nada-by-example/probabilistic-truncation', + 'nada-by-example/comparison', + 'nada-by-example/equality', + 'nada-by-example/if-else', + 'nada-by-example/reveal', + ] + }, + 'nada-by-example/list-comprehensions', + 'nada-by-example/helper-function', + 'nada-by-example/for-loop', + 'nada-by-example/reduce', + 'nada-by-example/voting', + 'nada-by-example/r-p-s', + { + type: 'link', + label: 'Request an Example', + href: 'https://github.com/NillionNetwork/nada-by-example/issues/new/choose', + }, + { + type: 'html', + className: 'sidebar-title', + value: 'Examples with Nada Libraries', + defaultStyle: true, + }, + { + type: 'category', + label: 'Nada AI', + collapsible: true, + collapsed: false, + link: { + type: 'doc', + id: 'nada-by-example/nada-ai', + }, + items: [ + { + type: 'link', + label: 'Linear Regression', + href: 'https://github.com/NillionNetwork/nada-ai/tree/main/examples/linear_regression', + }, + { + type: 'link', + label: 'Neural Network', + href: 'https://github.com/NillionNetwork/nada-ai/tree/main/examples/neural_net', + }, + { + type: 'link', + label: 'Complex Model', + href: 'https://github.com/NillionNetwork/nada-ai/tree/main/examples/complex_model', + }, + { + type: 'link', + label: 'Time Series', + href: 'https://github.com/NillionNetwork/nada-ai/tree/main/examples/time_series', + }, + { + type: 'link', + label: 'Spam Detection', + href: 'https://github.com/NillionNetwork/nada-ai/tree/main/examples/spam_detection', + }, + { + type: 'link', + label: 'Convolutional Neural Network', + href: 'https://github.com/NillionNetwork/nada-ai/tree/main/examples/conv_net', + } + ], + }, + { + type: 'category', + label: 'Nada Numpy', + collapsible: true, + collapsed: false, + link: { + type: 'doc', + id: 'nada-by-example/nada-numpy', + }, + items: [ + { + type: 'link', + label: 'Dot Product', + href: 'https://github.com/NillionNetwork/nada-numpy/tree/main/examples/dot_product', + }, + { + type: 'link', + label: 'Matrix Multiplication', + href: 'https://github.com/NillionNetwork/nada-numpy/tree/main/examples/matrix_multiplication', + }, + { + type: 'link', + label: 'Broadcasting', + href: 'https://github.com/NillionNetwork/nada-numpy/tree/main/examples/broadcasting', + }, + { + type: 'link', + label: 'Rational Numbers', + href: 'https://github.com/NillionNetwork/nada-numpy/tree/main/examples/rational_numbers', + }, + ], + }, + ] }; export default sidebars;