Giter VIP home page Giter VIP logo

nillion-python-starter's People

Contributors

cmacrae avatar davetbutler avatar jcabrero avatar jimouris avatar jmgr avatar manel1874 avatar nilmemo avatar oceans404 avatar wwwehr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nillion-python-starter's Issues

[BUG] Millionaire Demo Project error 01_store_secret_party1.py: "storing program: program is not valid: ["io error: "]"

Describe the bug
When trying to follow the Millionaire demo project on the Nillion.Docs, I came across the error: "storing program: program is not valid: ["io error: "]" when trying to run the command: python3 01_store_secret_party_1.py

How to reproduce
Follow the exact Nillion docs guide:

  1. Start the Nillion .venv
  2. Run ./bootstrap-local-environment.sh
  3. Run nillion-python-starter/examples_and_tutorials/millionaires_problem_example$ python3 01_store_secret_party1.py
  4. See error

Expected behavior
Expected output is the following:
Storing program in the network: millionaires
[2024-06-11T21:11:30Z ERROR node::managers::compute::handlers::compute] Failed to process message: task StoreProgramCompute<71d3259f-b042-4273-9736-b2ad0cf82161> not found
[2024-06-11T21:11:30Z ERROR node::managers::compute::handlers::compute] Failed to process message: task StoreProgramCompute<71d3259f-b042-4273-9736-b2ad0cf82161> not found
Alice stores millionaires program at program_id: 3PYSzv55jRS4k6nuiF8YgLgruUdgqtobnsnA1oJrTEu21bGdpeBPfGmjw57GRCwXQ5YEbQFaMjS5MjSquF9p7Ynf/millionaires
Alice tells Bob and Charlie her user_id and the millionaires program_id

📋⬇️ Copy and run the following command to store Bob and Charlie's salaries in the network

python3 02_store_secret_party_n.py --user_id_1 3PYSzv55jRS4k6nuiF8YgLgruUdgqtobnsnA1oJrTEu21bGdpeBPfGmjw57GRCwXQ5YEbQFaMjS5MjSquF9p7Ynf --program_id 3PYSzv55jRS4k6nuiF8YgLgruUdgqtobnsnA1oJrTEu21bGdpeBPfGmjw57GRCwXQ5YEbQFaMjS5MjSquF9p7Ynf/millionaires
(.venv) Vladzor-PC:~/nillion-python-starter/examples_and_tutorials/mi

Screenshots
https://cdn.discordapp.com/attachments/1204182804817121334/1250185046774775869/image.png?ex=666a050e&is=6668b38e&hm=619b610b20f35cd65e3ab87593f3e932a9de8f8eaa3372cb1758f90f6f74c2e7&)
Code links
https://github.com/NillionNetwork/nillion-python-starter/tree/main/examples_and_tutorials/millionaires_problem_example

Desktop (please complete the following information):

  • OS: Ubuntu 24.04 LTS
  • Browser: Firefox

Smartphone (please complete the following information):

Additional context
Managed to fix it by:

  1. Opening the 01_store_secret_party1.py file and finding the "program_mir_path = "millionaires.nada.bin"
  2. Replacing the variable with the following path: program_mir_path = f"../../programs-compiled/millionaires.nada.bin"

I noticed that this pathing is handled differently in the nillion-python-starter/examples_and_tutorials/core_concept_multi_party_compute
Here, the problem is fixed by adding the nada.bin path to the Config file. I will make a PR with this fix.

Optional - ETH Address
Optionally add your ETH Address here.
0x8Ed084fe1502dAF70A1085e1AD6941DbE52D08c8

[BUG] quick description of bug

pip install nillion.crypto
ERROR: Could not find a version that satisfies the requirement nillion.crypto (from versions: none)
ERROR: No matching distribution found for nillion.crypto

Add explanatory inline comments to Python example programs [DOCS]

**What section of the docs could be improved? **
The entire collection of the Nillion Python Starter programs.

What part(s) of the docs would you like to see updated?
Comments which explain which parts of the outputs and bits of information are available to which parties based on the definitions. Adding some inline comments to, for example, the honest voting program in the form of # result_c0 stores y information, and can be viewed by x party would be really helpful.

Additional context
I was trying to explore what is possible currently with Nillion, and the Python examples were my go to as I assume they will be for many others. Unfortunately it's still confusing at the moment to understand what exactly the examples are accomplishing without switching back and forth between the python client reference

[DOCS] - install packages

**What section of the docs could be improved? **

I went through the steps in the docs. But it seemed that the py_client was not installed when I ran bootstrap-local-cluster and then the dovtenv was not installed (or requirements.txt was not installed) at any point.

I may have gone through the steps in a wrong order, or made a mistake. But perhaps we can check this when we get a few user testers going through the flow

Is it correct that:

  • py_client is installed on bootstrap-local-cluster?
  • requirements.txt is installed when I setup virtual env?

[BUG] "state unavailable: state is taken" errors

Describe the bug

I'm trying to follow a quickstart guide with SDK v2024-03-12-d2d0a82c8 for x86_64-unknown-linux-musl and nada_dsl-0.1.0-py3-none-any.whl, py_nillion_client-0.1.1-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl. OS: Ubuntu 22.04.3 (amd64).

Rigth after start, the following errors start appearing in the terminal:

(.venv) lexx@lexx-ubuntu:~/code/nillion/nillion-python-starter$ ./bootstrap-local-environment.sh
NILLION_SDK_ROOT is set to: '/home/lexx/code/nillion/nillion-binaries/v2024-03-12-d2d0a82c8/x86_64-unknown-linux-musl'
/home/lexx/code/nillion/nillion-binaries/v2024-03-12-d2d0a82c8/x86_64-unknown-linux-musl/run-local-cluster
ℹ️ found bin RUN_LOCAL_CLUSTER  -> [/home/lexx/code/nillion/nillion-binaries/v2024-03-12-d2d0a82c8/x86_64-unknown-linux-musl/run-local-cluster]
ℹ️ found bin USER_KEYGEN        -> [/home/lexx/code/nillion/nillion-binaries/v2024-03-12-d2d0a82c8/x86_64-unknown-linux-musl/user-keygen]
ℹ️ found bin NODE_KEYGEN        -> [/home/lexx/code/nillion/nillion-binaries/v2024-03-12-d2d0a82c8/x86_64-unknown-linux-musl/node-keygen]
/tmp/tmp.PFIOJq5Zve
Bootstrapping environment and updating your .env file...
✔️cluster is running, bootnode is at /ip4/127.0.0.1/tcp/44245/p2p/12D3KooWESg6ku4GJLzRYbcSUinGYbosqyZnWxgxga9eijMdQk51
ℹ️ Cluster has been STARTED (see /tmp/tmp.PFIOJq5Zve)
ℹ️cluster id is 8fc1e6ca-fbb7-4200-bbaa-c5e944abb1a8
ℹ️using 256 bit prime
ℹ️storing state in /tmp/.tmpvU0jRt
⛓️starting blockchain node...
✔️blockchain node running on endpoint http://localhost:45685
🏃starting node 12D3KooWESg6ku4GJLzRYbcSUinGYbosqyZnWxgxga9eijMdQk51
⏳waiting until bootnode is up...
🏃starting node 12D3KooWRTrWjncVzQtcmiwqYTAMaBsT2ktjjXEGhbPfq7z862YS
🏃starting node 12D3KooWGeQ28g4dHfeiHPyzsiPjVM5QDd5N29P5PYHZZcvCw6Fz
🏃starting node 12D3KooWDG8b72yXfTMmTmbHKSyu2n2UtKPrkKTTxwLfopvJMWmu
🏃starting node 12D3KooWKRn6RhmHfTEMFDSQDskHFfDQFEpbx49bJK3QG9BF4xAP
🎁wallet keys written to /tmp/.tmpvU0jRt/private-keys.txt
📝payments configuration written to /tmp/.tmpvU0jRt/payments-config.yaml
🥾bootnode config written to /tmp/.tmpvU0jRt/bootnode.yaml
📝configuration written to /home/lexx/.config/nil-cli/config.yaml
✔️cluster is running, bootnode is at /ip4/127.0.0.1/tcp/44245/p2p/12D3KooWESg6ku4GJLzRYbcSUinGYbosqyZnWxgxga9eijMdQk51
🔗websocket: /ip4/127.0.0.1/tcp/42765/ws/p2p/12D3KooWESg6ku4GJLzRYbcSUinGYbosqyZnWxgxga9eijMdQk51
🔑 Generating a node key and user keys (reader key and writer key)
🔑 Node key and user keys have been generated
--------------------
💻 Your Nillion local cluster is still running - process pid: 21511
22522
ℹ️  Updated your .env file configuration variables: bootnode, cluster id, keys, blockchain info
📋 Compile all Nada programs './compile_programs.sh'
(.venv) lexx@lexx-ubuntu:~/code/nillion/nillion-python-starter$ [2024-03-21T11:42:38Z ERROR node::managers::preprocessing::handlers::preprocessing] Failed to process pre-processing message: send failed because receiver is gone
(.venv) lexx@lexx-ubuntu:~/code/nillion/nillion-python-starter$ [2024-03-21T11:42:48Z ERROR node::managers::preprocessing::actions::preprocessing::handlers::action_message] Action 5363f407-a20e-9ef0-b59e-a689181f30de batch 0 message handling failed: adding shares
[2024-03-21T11:42:49Z ERROR node::managers::preprocessing::actions::preprocessing::handlers::action_message] Action 5363f407-a20e-9ef0-b59e-a689181f30de batch 0 message handling failed: adding shares
[2024-03-21T11:42:49Z ERROR node::managers::preprocessing::actions::preprocessing::handlers::action_message] Action 5363f407-a20e-9ef0-b59e-a689181f30de batch 0 message handling failed: state unavailable: state is taken
[2024-03-21T11:42:49Z ERROR node::managers::preprocessing::actions::preprocessing::handlers::action_message] Action 5363f407-a20e-9ef0-b59e-a689181f30de batch 0 message handling failed: state unavailable: state is taken
[2024-03-21T11:42:49Z ERROR node::managers::preprocessing::actions::preprocessing::handlers::action_message] Action 5363f407-a20e-9ef0-b59e-a689181f30de batch 0 message handling failed: adding shares
[2024-03-21T11:42:49Z ERROR node::managers::preprocessing::actions::preprocessing::handlers::action_message] Action 5363f407-a20e-9ef0-b59e-a689181f30de batch 0 message handling failed: state unavailable: state is taken
[2024-03-21T11:42:49Z ERROR node::managers::preprocessing::actions::preprocessing::handlers::action_message] Action 5363f407-a20e-9ef0-b59e-a689181f30de batch 0 message handling failed: state unavailable: state is taken
[2024-03-21T11:42:49Z ERROR node::managers::preprocessing::actions::preprocessing::handlers::action_message] Action 5363f407-a20e-9ef0-b59e-a689181f30de batch 0 message handling failed: state unavailable: state is taken
[2024-03-21T11:42:49Z ERROR node::managers::preprocessing::actions::preprocessing::handlers::action_message] Action 5363f407-a20e-9ef0-b59e-a689181f30de batch 0 message handling failed: state unavailable: state is taken
[2024-03-21T11:42:49Z ERROR node::managers::preprocessing::actions::preprocessing::handlers::action_message] Action 5363f407-a20e-9ef0-b59e-a689181f30de batch 0 message handling failed: state unavailable: state is taken
[2024-03-21T11:42:49Z ERROR node::managers::preprocessing::actions::preprocessing::handlers::action_message] Action 5363f407-a20e-9ef0-b59e-a689181f30de batch 0 message handling failed: state unavailable: state is taken
[2024-03-21T11:42:49Z ERROR node::managers::preprocessing::actions::preprocessing::handlers::action_message] Action 5363f407-a20e-9ef0-b59e-a689181f30de batch 0 message handling failed: adding shares
[2024-03-21T11:42:49Z ERROR node::managers::preprocessing::actions::preprocessing::handlers::action_message] Action 5363f407-a20e-9ef0-b59e-a689181f30de batch 0 message handling failed: state unavailable: state is taken
[2024-03-21T11:42:49Z ERROR node::managers::preprocessing::actions::preprocessing::handlers::action_message] Action 5363f407-a20e-9ef0-b59e-a689181f30de batch 0 message handling failed: state unavailable: state is taken
[2024-03-21T11:42:49Z ERROR node::managers::preprocessing::actions::preprocessing::handlers::action_message] Action 5363f407-a20e-9ef0-b59e-a689181f30de batch 0 message handling failed: state unavailable: state is taken
[2024-03-21T11:42:49Z ERROR node::managers::preprocessing::actions::preprocessing::handlers::action_message] Action 5363f407-a20e-9ef0-b59e-a689181f30de batch 0 message handling failed: state unavailable: state is taken
[2024-03-21T11:42:50Z ERROR node::managers::preprocessing::actions::preprocessing::handlers::action_message] Action 5363f407-a20e-9ef0-b59e-a689181f30de batch 0 message handling failed: state unavailable: state is taken
[2024-03-21T11:42:50Z ERROR node::managers::preprocessing::actions::preprocessing::handlers::action_message] Action 5363f407-a20e-9ef0-b59e-a689181f30de batch 0 message handling failed: state unavailable: state is taken
[2024-03-21T11:42:50Z ERROR node::managers::preprocessing::actions::preprocessing::handlers::action_message] Action 5363f407-a20e-9ef0-b59e-a689181f30de batch 0 message handling failed: state unavailable: state is taken
[2024-03-21T11:42:50Z ERROR node::managers::preprocessing::actions::preprocessing::handlers::action_message] Action 5363f407-a20e-9ef0-b59e-a689181f30de batch 0 message handling failed: state unavailable: state is taken
[2024-03-21T11:42:50Z ERROR node::managers::preprocessing::actions::preprocessing::handlers::action_message] Action 5363f407-a20e-9ef0-b59e-a689181f30de batch 0 message handling failed: state unavailable: state is taken
[2024-03-21T11:42:50Z ERROR node::managers::preprocessing::actions::preprocessing::handlers::action_message] Action 5363f407-a20e-9ef0-b59e-a689181f30de batch 0 message handling failed: state unavailable: state is taken
[2024-03-21T11:42:50Z ERROR node::managers::preprocessing::actions::preprocessing::handlers::action_message] Action 5363f407-a20e-9ef0-b59e-a689181f30de batch 0 message handling failed: state unavailable: state is taken
[2024-03-21T11:42:50Z ERROR node::managers::preprocessing::actions::preprocessing::handlers::action_message] Action 5363f407-a20e-9ef0-b59e-a689181f30de batch 0 message handling failed: state unavailable: state is taken
[2024-03-21T11:42:53Z ERROR node::managers::preprocessing::actions::preprocessing::handlers::action_message] Action c0c5af72-249a-757c-401d-647a6ce89626 batch 0 message handling failed: adding shares
[2024-03-21T11:42:53Z ERROR node::managers::preprocessing::actions::preprocessing::handlers::action_message] Action c0c5af72-249a-757c-401d-647a6ce89626 batch 0 message handling failed: state unavailable: state is taken
[2024-03-21T11:42:53Z ERROR node::managers::preprocessing::actions::preprocessing::handlers::action_message] Action c0c5af72-249a-757c-401d-647a6ce89626 batch 0 message handling failed: state unavailable: state is taken
[2024-03-21T11:42:53Z ERROR node::managers::preprocessing::actions::preprocessing::handlers::action_message] Action c0c5af72-249a-757c-401d-647a6ce89626 batch 0 message handling failed: state unavailable: state is taken
[2024-03-21T11:42:53Z ERROR node::managers::preprocessing::actions::preprocessing::handlers::action_message] Action c0c5af72-249a-757c-401d-647a6ce89626 batch 0 message handling failed: state unavailable: state is taken
[2024-03-21T11:42:53Z ERROR node::managers::preprocessing::actions::preprocessing::handlers::action_message] Action c0c5af72-249a-757c-401d-647a6ce89626 batch 0 message handling failed: state unavailable: state is taken
(.venv) lexx@lexx-ubuntu:~/code/nillion/nillion-python-starter$ [2024-03-21T11:43:15Z ERROR node::managers::preprocessing::actions::preprocessing::handlers::action_message] Action 357c889a-bada-0ab9-b18d-d22a5fc8ba7e batch 0 message handling failed: failed to compute final output: not a quadratic residue
[2024-03-21T11:43:15Z ERROR node::managers::preprocessing::actions::preprocessing::handlers::action_message] Action 357c889a-bada-0ab9-b18d-d22a5fc8ba7e batch 0 message handling failed: failed to compute final output: not a quadratic residue

How to reproduce

I was following a quick start guide from the docs.

Expected behavior
No error message

Desktop (please complete the following information):

SDK v2024-03-12-d2d0a82c8 for x86_64-unknown-linux-musl and nada_dsl-0.1.0-py3-none-any.whl, py_nillion_client-0.1.1-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

OS: Ubuntu 22.04.3 (amd64).

Python 3.10.12

[DOCS] - example programs running not storing program

I wonder if in all the files to run programs e.g. client_single_party_compute/addition_simple.py we should also add code to upload the program in the file.

Otherwise, users have to store at the cli everytime before they can actually run those files.

The docs walk the user through this step, but it may get annoying for users to always have to store the program from the cli.

However, we should avoid confusion by having the docs tell them to upload from the cli then when they run the python script, it says "storing program". Maybe we have a bit in the python script that checks to see if the program is already stored, and if not, stores it for the user

Just an idea

.env - which file?

Thank you for reading the docs and suggesting an improvement!

**What section of the docs could be improved? **
I got confused which env file to put my ROOT paths in. What is the difference between .env and .env.sample

[DOCS] Python Developer Quickstart is repeated Twice

Thank you for reading the docs and suggesting an improvement!

First things first

  • If you have questions, ask in Discussions.
  • Check Issues to make sure someone hasn't already opened a similar issue.

**What section of the docs could be improved? **
Python Developer Quickstart section

What part(s) of the docs would you like to see updated?
The entire Python Developer Quickstart section is repeated twice and the section called "Using the Python client to run your program" has been modified to directly write the program instead of letting the devs a chance for completing the programs by themselves.

Additional context
Add any other context here.

Optional - ETH Address
0x95D36a9d1C9D89c2053090C35cb98FbF0AB73e22

Some programs are not consistent across directories

Describe the bug
The following programs do not run in the client_single_party_compute directory.

Mostly it is because the equivalent programs do not exist in the programs directory.

I suggest we remove them from the client_single_party directory so not to cause confusion (or we add the relevant programs in the programs directory.

"division_simple.py", "input_array.py", "modulo_simple.py", "nada_fn_composition.py", "power_simple.py", "reuse_simple_sub.py", "simple_sub.py", "single_addition.py", "tiny_secret_addition.py"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.