Skip to main content

Python client for FoundryNet - Universal DePIN Protocol for Work Settlement

Project description

FoundryNet Earn MINT tokens for verified manufacturing work. FoundryNet rewards 3D printers, CNC machines, robots, and production equipment with cryptocurrency for completing jobs. No staking, no capital required—just connect your machine and start earning.

Quick Start Installation bashnpm install tweetnacl bs58 uuid Download foundry-client.js from the GitHub repository. Basic Usage javascriptimport { FoundryClient } from './foundry-client.js';

// Initialize client const client = new FoundryClient({ apiUrl: 'https://lsijwmklicmqtuqxhgnu.supabase.co/functions/v1/main-ts', debug: true });

// Register machine (first time only - saves credentials locally) await client.init({ type: '3d-printer', model: 'Ender 3' });

// Start a job const jobHash = client.generateJobHash('benchy.gcode'); await client.submitJob(jobHash, { job_type: 'print', filename: 'benchy.gcode' });

// Complete job and earn MINT const result = await client.completeJob( jobHash, 'YOUR_SOLANA_WALLET_ADDRESS' );

console.log(Earned ${result.reward} MINT!); console.log(View transaction: ${result.solscan}); That's it. Your machine is now earning.

How It Works

  1. Register Your Machine Connect any machine that can make HTTP requests and sign messages (ed25519). Supported:

3D Printers (OctoPrint, Klipper, Marlin) CNC Mills/Routers (GRBL, LinuxCNC) Laser Cutters Pick-and-Place Robots Custom DIY machines

  1. Submit Jobs When your machine starts productive work: javascriptconst jobHash = client.generateJobHash('my_part.gcode'); await client.submitJob(jobHash, { job_type: 'print', filename: 'benchy.gcode' });
  2. Earn MINT When work completes successfully: javascriptawait client.completeJob(jobHash, yourSolanaWallet); // Instant payout: 3 MINT per job Current Rewards:

3 MINT per completed job Maximum 400 MINT per machine per 24 hours Jobs must run minimum 60 seconds

Integration Examples OctoPrint Plugin pythonfrom foundrynet import FoundryClient

In plugin initialization

client = FoundryClient(api_url='https://lsijwmklicmqtuqxhgnu.supabase.co/functions/v1/main-ts') client.init(metadata={'type': 'printer', 'model': 'Prusa MK3'})

On print start

def on_print_started(filename): job_hash = client.generate_job_hash(filename) client.submit_job(job_hash, {'filename': filename})

On print complete

def on_print_done(job_hash): client.complete_job(job_hash, user_wallet) Klipper/Moonraker python# Listen to Moonraker webhooks def on_print_started(data): job_hash = client.generate_job_hash(data['filename']) client.submit_job(job_hash, {'filename': data['filename']})

def on_print_complete(data): client.complete_job(current_job_hash, user_wallet) GRBL/CNC javascript// On program start const jobHash = client.generateJobHash(programName); await client.submitJob(jobHash, { job_type: 'cnc', program: programName });

// On program complete (M2/M30) await client.completeJob(jobHash, wallet); Custom/DIY javascript// Your machine, your rules const client = new FoundryClient({ apiUrl: 'https://lsijwmklicmqtuqxhgnu.supabase.co/functions/v1/main-ts' });

await client.init({ type: 'custom', model: 'Pick and Place Robot' });

// When task starts const jobHash = client.generateJobHash(taskId); await client.submitJob(jobHash, { job_type: 'robot', task_id: taskId });

// When task completes await client.completeJob(jobHash, wallet);

API Reference FoundryClient(config) javascriptconst client = new FoundryClient({ apiUrl: 'https://lsijwmklicmqtuqxhgnu.supabase.co/functions/v1/main-ts', retryAttempts: 3, // Network retry count retryDelay: 2000, // ms between retries debug: false // Enable verbose logging }); client.init(metadata) Initialize machine. Loads existing credentials or generates new ones. javascriptawait client.init({ type: 'printer', // printer|cnc|robot|laser|custom model: 'Ender 3 V2', firmware: 'Klipper' }); // Saves credentials to .foundry_credentials.json Returns: javascript{ existing: true, // Whether credentials already existed machineUuid: "abc-123", // Your machine ID identity: {...} // New credentials (if first time) } client.submitJob(jobHash, payload) Register job start. javascriptawait client.submitJob('job_unique_hash', { job_type: 'print', filename: 'part.gcode', estimated_time: 3600 }); Returns: javascript{ success: true, job_hash: "job_unique_hash" } client.completeJob(jobHash, recipientWallet) Complete job and earn MINT. javascriptconst result = await client.completeJob( 'job_unique_hash', 'YOUR_SOLANA_WALLET_ADDRESS' ); Returns: javascript{ success: true, reward: 3, tx_signature: "5x7y...", solscan: "https://solscan.io/tx/..." } client.generateJobHash(filename, additionalData) Generate deterministic job hash. javascriptconst jobHash = client.generateJobHash('benchy.gcode'); // Returns: "job_abc123_1234567890"

Rules & Limits

3 MINT per completed job 400 MINT maximum per machine per 24 hours Jobs must run minimum 60 seconds Each job hash must be unique (no replays) Signature timestamp must be within 5 minutes

What Counts as a Job? Any discrete unit of productive work:

One 3D print from start to finish One CNC machining operation One robot task cycle One laser cut/engrave job

What Doesn't Count?

Machine idle time Calibration/homing Test runs Failed or cancelled jobs

Security Proof of Productivity (PoP) Every job completion requires:

Unique job hash (prevents replay attacks) Ed25519 signature from registered machine keypair Recent timestamp (within 5 minutes) Minimum duration (60 seconds) Rate limiting (400 MINT/24hrs per machine)

Your Machine Keys

Generated locally on first init() Stored in .foundry_credentials.json Never leave your machine Back them up securely

Anti-Fraud

Job hash uniqueness enforced Signature verification prevents impersonation Rate limits prevent spam Duration checks prevent instant gaming

Troubleshooting "Job completion failed"

Check your machine credentials are loaded (client.init()) Verify job was submitted before completing Ensure wallet address is valid Solana address

"Rate limit exceeded"

You've earned 400 MINT in the last 24 hours Wait for the rolling window to reset Check dashboard for current limits

"Signature verification failed"

Machine credentials may be corrupted Delete .foundry_credentials.json and re-run init() Ensure system time is accurate (for timestamps)

"Job duration too short"

Jobs must run minimum 60 seconds Ensure you're measuring actual work time Don't complete jobs immediately after starting

"Treasury depleted"

System maintenance in progress Jobs are queued and will process when treasury refills Check status updates

Getting a Wallet? New to crypto? Here's how to receive MINT:

Install Phantom Wallet (browser extension) Create new wallet Copy your Solana address Use that address in completeJob()

MINT tokens appear instantly in your wallet after job completion.

Vision FoundryNet is building payment infrastructure for autonomous industry. We're starting simple: machines prove work happened, get paid instantly. The protocol handles identity, verification, and settlement. Everything else such as quality systems, marketplaces, reputation—gets built on top. This is infrastructure for when AI agents coordinate supply chains and manufacturing capacity becomes programmable.

Tokenomics Token: MINT (Solana SPL token) Contract: 84hLMyG9cnC3Pd9LrWn4NtKMEhQHh4AvxbkcDMQtgem

Initial treasury funded by protocol creator Rewards distributed for completed jobs LP available on Raydium (MINT/SOL)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

foundry_client-1.0.0.tar.gz (8.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

foundry_client-1.0.0-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

Details for the file foundry_client-1.0.0.tar.gz.

File metadata

  • Download URL: foundry_client-1.0.0.tar.gz
  • Upload date:
  • Size: 8.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.4

File hashes

Hashes for foundry_client-1.0.0.tar.gz
Algorithm Hash digest
SHA256 131e58b9a3a0f59f0464e1385d7aa841dc72682d9653e9eb374e950215e1fe13
MD5 c0f8893131a0f9176fd56c544fa9dcd2
BLAKE2b-256 5dce65fc7b18328eec208f5b275d2ef2d4a569b48d388ee8fe744438524bc43f

See more details on using hashes here.

File details

Details for the file foundry_client-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: foundry_client-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 8.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.4

File hashes

Hashes for foundry_client-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7642e0d74ad6a627c7edd7e888db87c91d3ac34949a3e5a4fe380a8280062be8
MD5 fdfedb39fee2c4ebc79d77709611ba1d
BLAKE2b-256 a77180cb8dc45c697a597bcbcdf8e63913c0830dafe905c794e4cb69b5b96848

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page