Open
Description
Thank you for taking the time to be a part of the Create Blind App Challenge! 🎉 🥳 🎉
We are looking for contributors for the Examples (Community) Section in Awesome Nillion.
🚨 First things first 🚨
If you ever get stuck, feel free to ask any questions in our Github Discussion.
Quickstart Guide
CNA_quickstart.mp4
CLI
- Star this repository
- Use the npm package in your terminal -
npx @nillion/create-nillion-app
and then follow the CLI instructions - Follow the prompts and you should have your boilerplate setup -- ask for help if you ever get stuck: this sets up a Next.js app + Nada
cd
into your folder and runnpm run dev
to start your dev server + your app should appear onlocalhost:3000
- Run
nillion-devnet
in another terminal window - Reload your Next.js app and you should be able to login, store a value and retrieve a value
Creating a Simple Nada app
Now let's get started with the magic of Nada! 🧙♂️ First, let's set it up our environment.
- In a new terminal window, go into your root, then
cd nada
to go into your nada folder and runsource .venv/bin/activate
- Run
pip install --upgrade nada-dsl
to install Nada DSL
Now that our Python environment is ready, we will create a secret_addition
Nada Program -- you may also follow along this section.
- Create a new file with
touch src/secret_addition.py
- Copy and paste the Nada Program code:
from nada_dsl import *
def nada_main():
party1 = Party(name="Party1")
my_int1 = SecretInteger(Input(name="my_int1", party=party1))
my_int2 = SecretInteger(Input(name="my_int2", party=party1))
new_int = my_int1 + my_int2
return [Output(new_int, "my_output", party1)]
- Add your program to
nada-project.toml
config file
[[programs]]
path = "src/secret_addition.py"
name = "secret_addition"
prime_size = 128
It should end up looking like:
name = "nada"
version = "0.1.0"
authors = [""]
[[programs]]
path = "src/secret_addition.py"
name = "secret_addition"
prime_size = 128
nada build
to build your programnada generate-test --test-name secret_addition_test secret_addition
to generate testsnada run secret_addition_test
to run the programnada test secret_addition_test
to run the tests
Connecting the Next.js app <> Nada Program
- Upload your program from your
nada/src/target/secret_addition.nada.bin
- Copy the
programID
and use it in the Compute section - Copy the
computeOutputID
and use it in the Compute Output section - Congratulations! You have run the Nada Program via your frontend 🎉
Wrapping up
- Host your github on a public repository
- Once you are finished, create a PR on this repo (awesome-nillion) to be added to the community page -- see this example + answer the questions from the example