npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

compute-chain-sdk

v1.3.0

Published

Build decentralized GPU marketplaces in 3 commands

Readme

ComputeChain SDK

Build decentralized GPU marketplaces in 3 commands.

npm install @compute-chain/sdk
node sdk/example.js
# Your GPU marketplace is live!

npm version Docker Pulls License: MIT


⚡ Quick Start

# Install SDK
npm install @compute-chain/sdk

# Run example
cd node_modules/@compute-chain/sdk
node example.js

# Output:
# ✅ Job 1 submitted (CPU)
# ✅ Job 2 submitted (GPU)
# ✅ Provider registered
# 🎉 Your marketplace is running!

Or use Docker:

docker run -d -p 9944:9944 skills003/substrate-ipfs-node:v1.1.0 --dev

🎯 What You Get

  • Full Substrate blockchain - Production-ready consensus
  • Docker execution engine - Run any containerized workload
  • Payment & escrow - Automatic token escrow and release
  • Fraud detection - Challenge period for verification
  • Provider network - Register GPU/CPU providers
  • React frontend - User dashboard included
  • CLI tools - Command-line interface

📖 API Usage

Submit a Job

const ComputeChain = require('@compute-chain/sdk');
const chain = new ComputeChain('ws://localhost:9944');

const jobId = await chain.submitJob({
  image: 'pytorch/pytorch:2.0.1-gpu',
  command: 'python train.py',
  ram: 16,      // GB
  cpu: 8,       // cores
  gpus: 2,      // count
  duration: 120 // minutes
});

console.log(`Job ${jobId} submitted`);

Register as Provider

await chain.registerProvider({
  name: 'my-gpu-farm',
  ram: 128,
  cpu: 64,
  gpus: 8,
  endpointUrl: 'http://your-server:7682'
});

Check Status

const job = await chain.getJob(jobId);
console.log(`Status: ${job.status}`);
console.log(`Cost: ${job.escrowed} tokens`);

List Providers

const providers = await chain.getProviders();
providers.forEach(p => {
  console.log(`${p.peerId}: ${p.resources.gpus} GPUs available`);
});

🛠️ CLI Commands

# Submit job
node compute-chain.js submit ubuntu:22.04 "echo hello" 0

# Register provider
node compute-chain.js register my-provider 1

# Check status
node compute-chain.js status 0

# List providers
node compute-chain.js providers

💰 Pricing

Default rates:

  • RAM: 10 tokens/GB/hour
  • CPU: 5 tokens/core/hour
  • GPU: 50 tokens/GPU/hour

Example:

  • 16GB RAM + 4 CPU + 1 GPU for 2 hours
  • Cost: (16×10 + 4×5 + 1×50) × 2 = 500 tokens

Customize pricing in your chain config!


🏗️ Architecture

┌─────────────┐
│   Client    │  Submit job + escrow tokens
└──────┬──────┘
       │
┌──────▼──────────┐
│   Blockchain    │  Substrate chain with payment logic
└──────┬──────────┘
       │
┌──────▼──────────┐
│    Provider     │  Claim job, execute container
└──────┬──────────┘
       │
┌──────▼──────────┐
│ Docker + GPU    │  Return results + proof
└─────────────────┘

📂 Templates

Pre-configured chains for specific use cases:

AI Training

# Optimized for ML workloads
# - GPU: 30 tokens/hr (cheap)
# - Max duration: 7 days
# - Max RAM: 256GB

Render Farm

# For 3D rendering and video
# - GPU: 80 tokens/hr (premium)
# - Blender, Maya support

Scientific Compute

# Long-running simulations
# - Max duration: 14 days
# - High CPU allocation

See /templates/ for configurations.


🚀 Full Deployment

Deploy complete marketplace with all services:

git clone https://github.com/your-org/compute-chain-sdk
cd compute-chain-sdk
./deploy.sh

# Starts:
# - Blockchain (port 9944)
# - Docker service (port 7682)
# - Provider service
# - Frontend (port 3000)

Production setup:

# 1. Get Ubuntu server with GPU
# 2. Install Docker + NVIDIA runtime
# 3. Clone and deploy
docker-compose up -d

📊 Cost Comparison

| Workload | Duration | Your Chain | AWS p3.2xlarge | Savings | |----------|----------|------------|----------------|---------| | GPT Fine-tune | 8hr | 3,232 tokens (~$32) | ~$240 | 87% | | Stable Diffusion | 1hr | 202 tokens (~$2) | ~$8 | 75% | | Video Render | 4hr | 1,664 tokens (~$17) | ~$32 | 48% |

At $0.01/token vs AWS on-demand pricing


🔒 Security Features

  • Payment escrow - Funds locked until job verified
  • Challenge period - 100 blocks for disputes
  • Fraud detection - Validators re-execute suspicious jobs
  • Reputation system - Track provider quality
  • Slashing - Penalties for malicious providers

🧪 Testing

Tested and verified:

npm test

# Output:
# ✅ Test 1: Connection (Substrate IPFS Compute Network)
# ✅ Test 2: Submit CPU job (Job 15)
# ✅ Test 3: Submit GPU job (Job 16)
# ✅ Test 4: Get job status
# ✅ Test 5: List providers
# ✅ Test 6: Register provider
# ✅ Test 7: Verify registration
# 🎉 All tests passed!

See /SDK_TEST_REPORT.md for detailed test results.


🎓 Examples

AI Training:

await chain.submitJob({
  image: 'huggingface/transformers-pytorch-gpu',
  command: 'python train_gpt.py --epochs 100',
  ram: 64, cpu: 16, gpus: 4, duration: 480
});

Stable Diffusion:

await chain.submitJob({
  image: 'stability-ai/stable-diffusion',
  command: 'python generate.py --prompt "blockchain GPU"',
  ram: 16, cpu: 4, gpus: 1, duration: 30
});

Batch Processing:

for (let i = 0; i < 100; i++) {
  await chain.submitJob({
    image: 'my-processor',
    command: `process.py --input data-${i}.csv`,
    ram: 4, cpu: 2
  });
}

More examples in /sdk/ai-training-testnet/test-ai-workloads.js


📚 Documentation

  • API Reference: See code comments in compute-chain.js
  • Templates: Configuration examples in /templates/
  • Deployment: Instructions in deploy.sh
  • Architecture: Details in README.md

🤝 Contributing

Built with progressive enhancement:

  1. Make it work ✅
  2. Ship it ✅
  3. Enhance later ← We are here

Contributions welcome! Please:

  1. Fork the repo
  2. Create a feature branch
  3. Submit a pull request

🐛 Troubleshooting

Blockchain won't start:

rm -rf /tmp/substrate-*
./deploy.sh

Jobs not executing:

# Check provider is registered
node compute-chain.js providers

# Check Docker service
curl http://localhost:7682/health

Out of tokens:

# Use pre-funded dev accounts
account: '//Alice'   # Has 1M tokens

📜 License

MIT - Build whatever you want!


🔗 Links


⭐ Star History

If this helps you build your GPU marketplace, please star the repo!


Built with: Substrate · Docker · Polkadot.js · React · NVIDIA CUDA

Tested on: Ubuntu 22.04 · NVIDIA GPUs · Docker 24+ · Node.js 18+