Python Client
py-nillion-client is a Python client for building on top of the Nillion Network. It can be used to manage Nada programs, store and retrieve secrets, and run computations.
Installation
Install the py-nillion-client PyPi package in an existing Python application
pip install py-nillion-client
Usage
Import Python Client
import py_nillion_client as nillion
Initialize a client
Initialize an instance of the NillionClient connected to the Nillion Network using helpers from nillion-python-starter
- main.py
- nillion_client_helper.py
- nillion_keypath_helper.py
- .env
- bootstrap_script
import os
from dotenv import load_dotenv # pip install python-dotenv
from helpers.nillion_client_helper import create_nillion_client
from helpers.nillion_keypath_helper import getUserKeyFromFile, getNodeKeyFromFile
# Loads environment variables from the .env file
load_dotenv()
def main():
userkey = getUserKeyFromFile(os.getenv("NILLION_USERKEY_PATH_PARTY_1"))
nodekey = getNodeKeyFromFile(os.getenv("NILLION_NODEKEY_PATH_PARTY_1"))
# Initialize Nillion Client instance
client = create_nillion_client(userkey, nodekey)
# Print the user id
print(client.user_id)
if __name__ == "__main__":
main()
helpers/nillion_client_helper.py
loading...
helpers/nillion_keypath_helper.py
loading...
.env.sample
loading...
bootstrap-local-environment.sh
loading...
Resources
📄️ Python Developer Quickstart
Install the Nillion SDK tools
📄️ Python Client Reference
Nillion Client Python module.
🗃️ Python Client Examples
4 items