Getting Started

Get up and running with ProjectZero Prompt Mining in under 10 minutes.

Prerequisites

Before you begin, ensure you have:

  • Node.js 18+ installed
  • A ProjectZero account (sign in with OAuth at pm.projectzero.io)
  • An API key created from the ProjectZero dashboard

New to ProjectZero? The onboarding process is simple:

  1. Sign in via OAuth (Google or GitHub) at pm.projectzero.io
  2. Navigate to the Dashboard and create a new API key
  3. Use that API key to configure the boilerplate (see below)

Authenticate & Create API Keys

Access is OAuth-only. Launch the sign-in modal (Google, GitHub, or email link) and you will land in the dashboard immediately—no manual registration review.

1. Authenticate

Visit pm.projectzero.io/login and choose an OAuth provider. A short-lived session cookie is created after OAuth completes.

2. Run the API key wizard

The wizard captures reward strategy (Activity Points vs custom token), permissions (MINTER_ROLE acknowledgments), network scope, and an onboarding checklist before alias/environment selection.

You can rotate keys per environment. Each key is shown once—copy it into your secret manager as soon as it appears.

Quick Setup

1. Clone

Clone the boilerplate repository

2. Configure

Set up environment variables

3. Test

Mint your first prompt

Step 1: Clone the Boilerplate

bash
git clone https://github.com/projectzero-io/prompt-mining-boilerplate.git
cd prompt-mining-boilerplate
npm install

Step 2: Configure Environment

Copy the example environment file and configure your credentials:

bash
cp .env.example .env

Edit .env with your ProjectZero credentials:

.env
# ProjectZero API Configuration
PZERO_API_URL=https://pm-gateway.projectzero.io/v1
PZERO_API_KEY=pzero_live_your_api_key_here

# Blockchain Configuration
CHAIN_ID=7358
RPC_URL=https://rpc.nexera.org
PROMPT_MINER_ADDRESS=0x...
ACTIVITY_POINTS_ADDRESS=0x...
DATA_INDEX_ADDRESS=0x...

# Your Backend Wallet (for backend-signed mode)
PRIVATE_KEY=0x...  # Keep this secret!

# Application Settings
NODE_ENV=development
PORT=3001

Security Note: Never commit your .env file or expose your API keys and private keys. Add .env to your .gitignore.

Step 3: Verify Configuration

Run the configuration test to ensure everything is set up correctly:

bash
npm run test:config

You should see output confirming all required variables are set:

bash
✓ PZERO_API_KEY is set
✓ PZERO_API_URL is set
✓ RPC_URL is set
✓ PROMPT_MINER_ADDRESS is set
✓ ACTIVITY_POINTS_ADDRESS is set
✓ All required configuration is valid!

Mint Your First Prompt

Start the development server:

bash
npm run dev

The server will start on http://localhost:3001

Test with cURL

Test the authorization endpoint:

bash
curl -X POST http://localhost:3001/api/prompts/authorize \
  -H "Content-Type: application/json" \
  -H "x-api-key: pzero_live_your_api_key_here" \
  -d '{
    "prompt": "What is quantum computing?",
    "author": "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb",
    "activityPoints": 25
  }'

Expected response:

json
{
  "success": true,
  "data": {
    "promptHash": "0x1a2b3c...",
    "author": "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb",
    "activityPoints": 25,
    "signature": "0xabcdef...",
    "nonce": 1,
    "expiresAt": "2024-12-25T12:00:00Z"
  }
}

Success! You've authorized your first prompt. This signature can now be used to mint the prompt on-chain.

Health Check

Verify your service is running correctly:

bash
curl http://localhost:3001/api/health

Expected response:

json
{
  "status": "ok",
  "timestamp": "2024-12-25T10:30:00Z",
  "version": "1.0.0",
  "services": {
    "pzeroGateway": "connected",
    "blockchain": "connected"
  }
}

Next Steps

Now that your environment is configured, you can:

Integration Guide

Learn how to integrate prompt mining into your AI service with backend-signed transactions.

Read Integration Guide →

API Reference

Complete documentation of all boilerplate endpoints and parameters.

View API Docs →

Security Best Practices

Understand the privacy-first architecture and security guarantees.

Learn About Security →

Architecture Overview

Deep dive into how the system works end-to-end.

View Architecture →