Installation
Installation
Section titled “Installation”This guide will walk you through installing and setting up the Hyra Network SDKs for different programming languages.
Prerequisites
Section titled “Prerequisites”Before installing Hyra Network SDKs, ensure you have:
- Python 3.8+ (for Python SDK)
- Node.js 16+ (for Node.js SDK)
- A compatible wallet with HYRA tokens
- Private key for your wallet
Python SDK Installation
Section titled “Python SDK Installation”1. Install the SDK
Section titled “1. Install the SDK”pip install hyra-sdk2. Set up your private key
Section titled “2. Set up your private key”# Option 1: Environment variable (recommended)export PRIVATE_KEY=your_private_key_here
# Option 2: .env fileecho "PRIVATE_KEY=your_private_key_here" > .env
# Option 3: Inline environment variablePRIVATE_KEY=your_private_key_here python your_script.py3. Verify Installation
Section titled “3. Verify Installation”from hyra_sdk import HyraClient
# Initialize clientclient = HyraClient()
# Check if you can connectprint("Hyra SDK installed successfully!")Node.js SDK Installation
Section titled “Node.js SDK Installation”1. Install the SDK
Section titled “1. Install the SDK”npm install @hyra-network/sdk2. Set up your private key
Section titled “2. Set up your private key”# Option 1: Environment variable (recommended)export PRIVATE_KEY=your_private_key_here
# Option 2: .env fileecho "PRIVATE_KEY=your_private_key_here" > .env3. Verify Installation
Section titled “3. Verify Installation”const { HyraClient } = require("@hyra-network/sdk");
// Initialize clientconst client = new HyraClient();
// Check if you can connectconsole.log("Hyra SDK installed successfully!");ZKP (Zero-Knowledge Proof) Setup
Section titled “ZKP (Zero-Knowledge Proof) Setup”Hyra Network uses Zero-Knowledge Proofs for task verification. The ZKP system is automatically handled by the SDKs, but you can also install the standalone ZKP library:
Python ZKP Library
Section titled “Python ZKP Library”# Install the ZKP Rust client for Pythonpip install zkp-rust-clientNode.js ZKP Library
Section titled “Node.js ZKP Library”# Install the ZKP Rust client for Node.jsnpm install zkp-rust-clientWebAssembly ZKP Library
Section titled “WebAssembly ZKP Library”# For web applicationsnpm install zkp-rust-client-wasmConfiguration Options
Section titled “Configuration Options”Environment Variables
Section titled “Environment Variables”The SDKs support multiple environment variable names for your private key:
# Primary optionsexport PRIVATE_KEY=your_private_key_hereexport WALLET_PRIVATE_KEY=your_private_key_hereexport HYRA_PRIVATE_KEY=your_private_key_hereCustom RPC Endpoints
Section titled “Custom RPC Endpoints”# Python SDKfrom hyra_sdk import HyraClient
client = HyraClient(rpc_url="https://your-custom-rpc-endpoint.com")// Node.js SDKconst { HyraClient } = require("@hyra-network/sdk");
const client = new HyraClient({ rpcUrl: "https://your-custom-rpc-endpoint.com",});Network Configuration
Section titled “Network Configuration”Testnet (Default)
Section titled “Testnet (Default)”- RPC URL:
https://rpc-testnet.hyra.network - Chain ID: TBD
- Native Token: HYRA (testnet)
Mainnet (Coming Soon)
Section titled “Mainnet (Coming Soon)”- RPC URL:
https://rpc.hyra.network - Chain ID: TBD
- Native Token: HYRA
Security Best Practices
Section titled “Security Best Practices”Private Key Security
Section titled “Private Key Security”- Never commit private keys to version control
- Use environment variables for production deployments
- Store keys securely in production environments
- Use hardware wallets when possible
Development vs Production
Section titled “Development vs Production”# Developmentexport PRIVATE_KEY=your_development_private_key
# Production (use secure key management)export PRIVATE_KEY=your_production_private_keyQuick Start Examples
Section titled “Quick Start Examples”Python Quick Start
Section titled “Python Quick Start”from hyra_sdk import HyraClient
# Initialize clientclient = HyraClient()
# Claim a tasktask = client.claim_task()print(f"Task ID: {task['task_id']}")print(f"Model: {task['model_name']}")print(f"Input: {task['input_data']}")
# Submit the task resultresult = "Your AI-generated response here"submit_hash = client.submit_task( task['task_id'], result, task['pool_address'])print(f"Submission hash: {submit_hash}")Node.js Quick Start
Section titled “Node.js Quick Start”const { HyraClient } = require("@hyra-network/sdk");
// Initialize clientconst client = new HyraClient();
// Claim a taskconst task = await client.claimTask();console.log(`Task ID: ${task.taskId}`);console.log(`Model: ${task.modelName}`);console.log(`Input: ${task.inputData}`);
// Submit the task resultconst result = "Your AI-generated response here";const submitHash = await client.submitTask( task.taskId, result, task.poolAddress);console.log(`Submission hash: ${submitHash}`);Troubleshooting
Section titled “Troubleshooting”Common Issues
Section titled “Common Issues”-
“No Available Task” Error
- Wait for new tasks to be created
- Check if you have an active task already
-
“Insufficient Balance” Error
- Ensure you have HYRA tokens in your wallet
- Check your wallet balance
-
“Task Deadline Passed” Error
- Claim a new task
- Check task deadlines before processing
-
Connection Issues
- Verify your RPC endpoint
- Check your internet connection
- Ensure the network is accessible
Getting Help
Section titled “Getting Help”- Documentation: Check the API Reference for detailed information
- Discord: Join our Discord community
- GitHub Issues: Report bugs on GitHub
Next Steps
Section titled “Next Steps”Once installation is complete, you can start:
- AI Workers: Learn how to claim tasks and start earning
- AI End Users: Learn how to process tasks with AI models
- Developers: Check out our Python SDK or Node.js SDK documentation