Privacy-powered coding: mastering Aleo SDK and zkML tech tutorials

HEORHII YABLONSKYI
3 min readJan 29, 2024

Greetings, tech aficionados! Heorhii here, and today, we’re strapping in for a deep dive into the tech underworld where Aleo SDK and zkML rule. Brace yourselves for a code-filled journey where privacy isn’t just a feature; it’s the essence. Ready? Let’s tech-talk!

Aleo SDK: your gateway to privacy in Python

GitHub Aleo SDK repository:

Aleo on PyPI:

The Aleo SDK is like the guardian of privacy in Python. Built with PyO3 and Maturin, it binds seamlessly to snarkVM Rust functionalities. Currently, it’s spreading its magic on Mac OS 11 or newer, with promises of expanding support. This early-stage project brings crucial functionalities to your fingertips:

  1. Private Key generation:
  • Crucial for authorizing transactions.
  • A backstage pass to cryptographic wonders.

Installation:

pip3 install aleo

Example Use:

import aleo

private_key = aleo.PrivateKey()
print(private_key.to_string())

Build Instructions:

bash build.sh

zkML: where machine learning meets zero-knowledge

GitHub zkml repository:

zkml on PyPI:

zkML, the Aleo transpiler for zero-knowledge machine learning, is your go-to for infusing privacy into ML models. Currently, it’s rocking the foundations with support for decision tree classifiers and multilayer perceptron neural network regressors. Here’s your guide to unlocking its potential:

Prerequisites:

  • Python 3.9.6 or newer

Check by running:

python3 - version

If not installed, follow the instructions here.

  • Leo: ensure Leo version 1.9.3 or newer

Check by running:

leo - version

If necessary, update:

leo update

Installation guide: Leo Installation

Confirm you’re on the master branch of GitHub (you should be by default).

Installation:

Through PyPI:

  • Install using the following command:
pip3 install zkml

Through the GitHub repository:

  1. Clone the repository, or download the .whl or .tar.gz file from the dist folder.
  2. Navigate to the dist directory containing the .whl or .tar.gz file:
cd dist

Install using pip:

pip3 install zkml-0.0.1b1-py3-none-any.whl

OR

pip3 install zkml-0.0.1b1.tar.gz

Usage:

import zkml

# Step 1: Receive zkml.LeoTranspiler object
transpiler = zkml.LeoTranspiler(model, validation_data)

# Step 2: Start transpilation process
transpiler.to_leo(path, project_name, model_as_input, fixed_point_scaling_factor)

# Step 3: Run computation of the Leo project
leo_computation = transpiler.run(input_data)

# Step 4: Execute the Leo project
zk_proof = transpiler.execute(input_data)

Learn more:

Advantages of the Aleo Python library:

  1. Privacy first: enables building zero-knowledge applications in Python. Keeps your data private and secure.
  2. Seamless integration: smooth integration with Python’s ecosystem. Python developers can now dive into the world of privacy-preserving apps.
  3. Early-stage versatility: even in its early stage, Aleo SDK showcases key functionalities. Promises to support various operating systems soon.

Conclusion: and there you have it, a journey through the privacy-centric realms of Aleo SDK and zkML. Whether you’re safeguarding cryptographic keys or transpiling ML models, these tools are your allies in the mission for privacy. Keep coding, keep exploring, and let privacy reign!

To know more, join now!

Aleo Twitter
Aleo Discord
Aleo Website
List of Aleo and Leo code and resourses

Prepared by Colliseum

--

--