Mint your DAT in Python
This guide walks through the process of setting up your local environment, connecting your wallet, and minting your first Data Anchoring Token (DAT) using the LazAI Python SDK.
It assumes familiarity with Python, basic blockchain interactions, and access to the LazAI Pre-Testnet. For a guided walkthrough of the entire setup and minting process, watch the official tutorial: ➡️ https://youtu.be/YawyZ3aziRE?si=2i104Js04nxJ-oez
Prerequisites
Ensure the following tools and credentials are available before starting:
Requirement
Description
Python
Version 3.10 or later
pip
Latest package manager version
Wallet
Funded Pre-Testnet wallet for gas fees
Credentials
PRIVATE_KEY — your wallet private key (must start with 0x) IPFS_JWT — Pinata (or compatible) IPFS JWT token
Step 1. Project Setup
Create a new working directory and (optionally) set up a virtual environment.
mkdir lazai-contribution-py
cd lazai-contribution-py
# Optional: create a Python virtual environment
python3 -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activateStep 2. Install Dependencies
Install the LazAI SDK and required libraries.
If you prefer to load environment variables from a .env file instead of exporting them directly, install:
Step 3. Configure Environment Variables
Set your credentials in the shell environment:
If you are using a .env file, include:
at the top of your Python script.
Step 4. Create the Minting Script
Create a file named mint.py and paste the following code.
Step 5. Run the Script
Execute the minting process.
Expected Output:
Troubleshooting
Issue
Cause
Resolution
eth_keys or signing errors
Invalid private key format
Ensure PRIVATE_KEY starts with 0x and Python version ≥ 3.10
401 / 403 IPFS errors
Invalid or expired JWT
Verify your IPFS_JWT and permissions in Pinata
Request or connection failures
Node busy or network timeout
Wait a minute and retry; confirm your Pre-Testnet RPC configuration
StorageError
Invalid token or transient network issue
Retry the upload or reinitialize IPFS connection
Summary
This tutorial demonstrated how to:
Set up a local LazAI development environment.
Encrypt and upload data to IPFS.
Register and anchor it on the LazAI Network.
Generate verifiable proof and mint a DAT.
Request tokenized rewards on-chain.
Once this is running successfully, you can integrate the same workflow into your agent or service pipeline using the Alith SDK for automated data anchoring and reward management.
Last updated

