-
Hello, I am putting together a Python notebook to test some Nillion features using https://github.com/NillionNetwork/nillion-python-starter/blob/main/quickstart_complete/client_code/secret_addition_complete.py as an an example. However, running this line.. client = create_nillion_client(userkey, nodekey) ..produces this error:
Here's a link to the problem line in the notebook: https://colab.research.google.com/drive/1fL8RczszbpTuut2l4Q8J84zlmhW-fq07#scrollTo=u0s-46uqQue0&line=3&uniqifier=1 This specific function assumes
Thank you. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Hey. I do not think the docs for this are public atm we should probably just open source the repo. I’ll see if we can do that. And you are right about the function. My suggestion is to just re write it in your code. The source is copied below (sorry, I am on my old phone right now - hence the bad formatting below) import os import py_nillion_client as nillion def create_nillion_client(userkey, nodekey):
|
Beta Was this translation helpful? Give feedback.
-
Thanks, @Davetbutler. TBH, I prefer to work with your libraries in the most out of the box manner possible. For now, I am just doing this in my notebook: import os
def set_environment_from_string(env_string):
# Split the string into lines
lines = env_string.strip().split('\n')
# Process each line
for line in lines:
# Split each line into key and value
if '=' in line:
key, value = line.split('=', 1)
# Strip any whitespace
key = key.strip()
value = value.strip()
# Set the environment variable
os.environ[key] = value
print("Environment variables have been set.")
env_string = """
NILLION_CLUSTER_ID=9e68173f-9c23-4acc-ba81-4f079b639964
NILLION_BOOTNODE_MULTIADDRESS=/ip4/127.0.0.1/tcp/37939/p2p/12D3KooWMvw1hEqm7EWSDEyqTb6pNetUVkepahKY6hixuAuMZfJS
NILLION_BOOTNODE_WEBSOCKET=/ip4/127.0.0.1/tcp/54936/ws/p2p/12D3KooWMvw1hEqm7EWSDEyqTb6pNetUVkepahKY6hixuAuMZfJS
NILLION_NILCHAIN_CHAIN_ID=nillion-chain-devnet
NILLION_NILCHAIN_JSON_RPC=http://127.0.0.1:48102
NILLION_NILCHAIN_REST_API=http://localhost:26650
NILLION_NILCHAIN_GRPC=localhost:26649
NILLION_NILCHAIN_PRIVATE_KEY_0=9a975f567428d054f2bf3092812e6c42f901ce07d9711bc77ee2cd81101f42c5
NILLION_NILCHAIN_PRIVATE_KEY_1=1e491133b9408b39572a29f91644873decea554224b20e2b0b923aeb860a1c18
NILLION_NILCHAIN_PRIVATE_KEY_2=980488572f235316cdb330191f8bafe4e635efbe88b3a40f5bee9bd21047c059
NILLION_NILCHAIN_PRIVATE_KEY_3=612bb5173dc60d9e91404fcc0d1f1847fb4459a7d5160d63d84e91aacbf2ab2f
NILLION_NILCHAIN_PRIVATE_KEY_4=04f5a984eeea9dce4e5e907da69c01a61568e3071b1a91cbed89225f9fd913b5
NILLION_NILCHAIN_PRIVATE_KEY_5=5f992c58921f4af83b4c6b650c4914626664cd02020577b0ada49cfa00d2c8a4
NILLION_NILCHAIN_PRIVATE_KEY_6=8f0297d3bb647eb59b95b29550b2aebbedd9be2c954b000e772efe8c9318a42d
NILLION_NILCHAIN_PRIVATE_KEY_7=c395243df9bb68dc809668efe4125f0eb017771ed8e3747b8d6860551913fecb
NILLION_NILCHAIN_PRIVATE_KEY_8=4bb5eaa799e24ae2b48545c41331921afe7e6a8dd7a850f5fbeb20a8226664ec
NILLION_NILCHAIN_PRIVATE_KEY_9=ef4b944d4fdb0077057925fe2dde365dfa2c83cf320463b14589feccd1b2b938
"""
set_environment_from_string(env_string) Let me know how open sourcing the repo goes. It will help a lot with writing production-quality code. |
Beta Was this translation helpful? Give feedback.
Hey @vishakh! We've open sourced the python helpers repo. Check it out: https://github.com/NillionNetwork/nillion-python-helpers