generated from scaffold-eth/scaffold-eth-2
-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
188 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,10 @@ | ||
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)] | ||
return [Output(new_int, "my_output", party1)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
.env | ||
.env | ||
__pycache__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/usr/bin/env bash | ||
|
||
function create_venv () { | ||
if [[ ! -z "${VIRTUAL_ENV:-}" ]]; then | ||
echo "Virtualenv is already active! Run 'deactivate' to deactivate the virtualenv." | ||
return 0 | ||
fi | ||
|
||
echo "Creating virtualenv" | ||
python3.11 -m pip install install --user virtualenv==20.24.6 | ||
|
||
NILLION_VENV=".venv" | ||
mkdir -p "$NILLION_VENV" | ||
python3.11 -m virtualenv -p python3.11 "$NILLION_VENV" | ||
source "$NILLION_VENV/bin/activate" | ||
python3.11 -m pip install -r requirements.txt | ||
|
||
echo "Virtualenv: $NILLION_VENV" | ||
echo "Check the $NILLION_VENV/lib/python3.11/site-packages folder to make sure you have py_nillion_client and nada_dsl packages" | ||
} | ||
|
||
create_venv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
name = "next-project-programs" | ||
version = "0.1.0" | ||
authors = [""] | ||
|
||
[[programs]] | ||
path = "src/main.py" | ||
name = "main" | ||
prime_size = 128 | ||
|
||
[[programs]] | ||
path = "src/addition_simple.py" | ||
name = "addition_simple" | ||
prime_size = 128 |
10 changes: 10 additions & 0 deletions
10
packages/nillion/next-project-programs/src/addition_simple.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
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)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
from nada_dsl import * | ||
|
||
def nada_main(): | ||
party1 = Party(name="Party1") | ||
party2 = Party(name="Party2") | ||
party3 = Party(name="Party3") | ||
a = SecretInteger(Input(name="A", party=party1)) | ||
b = SecretInteger(Input(name="B", party=party2)) | ||
|
||
result = a + b | ||
|
||
return [Output(result, "my_output", party3)] |
Binary file added
BIN
+821 Bytes
packages/nillion/next-project-programs/target/addition_simple.nada.bin
Binary file not shown.
Binary file not shown.
12 changes: 12 additions & 0 deletions
12
packages/nillion/next-project-programs/tests/addition_simple.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--- | ||
program: addition_simple | ||
inputs: | ||
secrets: | ||
my_int1: | ||
SecretInteger: '30' | ||
my_int2: | ||
SecretInteger: '3' | ||
public_variables: {} | ||
expected_outputs: | ||
my_output: | ||
SecretInteger: '33' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
nada-dsl |