Admin Tools Tutorial

Configure, test, and manage your BizNode network in 6 steps — from environment setup to wallet verification.

1

Configure admin.env

The admin.env file contains all credentials and configuration for your admin tools. Create it in your admin tools directory and fill in each section.

# === Database (MySQL) ===
ADMIN_DB_HOST=localhost
ADMIN_DB_PORT=3306
ADMIN_DB_NAME=biznode_admin
ADMIN_DB_USER=biznode
ADMIN_DB_PASS=your-secure-password

# === Stripe ===
STRIPE_SECRET_KEY=sk_live_...
STRIPE_WEBHOOK_SECRET=whsec_...
STRIPE_PUBLISHABLE_KEY=pk_live_...

# === Polygon / Crypto ===
BIZNODE_WALLET_ADDRESS=0x...
POLYGON_RPC_URL=https://polygon-rpc.com
BZEUSD_CONTRACT=0x...

# === Admin API ===
ADMIN_API_KEY=your-admin-api-key-here
ADMIN_API_URL=https://your-mainnode.com

# === Node Identity ===
NODE_NAME=MyBizNode
NODE_ENDPOINT=https://your-node.com

Security Notes

🔒

Never Commit Secrets

Add admin.env to your .gitignore. Stripe keys and database passwords must never appear in version control.

🛡

API Key Header

Every admin request must include X-Admin-Key: your-admin-api-key in the header. Requests without a valid key receive a 403 response.

2

Test Connectivity

Before monitoring anything, verify that your admin tools can reach the MainNode API.

Check Admin Status

curl -s -H "X-Admin-Key: YOUR_KEY" \
  https://your-mainnode.com/api/admin/status

Expected response:

{
  "status": "ok",
  "version": "2.1.0",
  "uptime_hours": 742,
  "nodes_registered": 12,
  "db_connected": true,
  "stripe_connected": true
}

Check Payment Pipeline

curl -s -H "X-Admin-Key: YOUR_KEY" \
  https://your-mainnode.com/api/admin/payments?limit=1

Expected response:

{
  "payments": [
    {
      "id": 847,
      "stripe_session": "cs_live_...",
      "email": "customer@example.com",
      "amount": 25.00,
      "currency": "usd",
      "category": "DZITPACKAGE",
      "status": "completed",
      "created_at": "2026-03-08T19:45:00Z"
    }
  ],
  "total": 847
}

Check Node Health

curl -s -H "X-Admin-Key: YOUR_KEY" \
  https://your-mainnode.com/api/admin/nodes/health

Expected response:

{
  "nodes": [
    {
      "node_id": "biz_node_0a3f",
      "name": "Acme Consulting",
      "status": "online",
      "latency_ms": 142,
      "uptime_pct": 99.7
    }
  ]
}
3

Monitor Payments

Three endpoints give you full visibility into the Stripe payment pipeline.

List All Payments

curl -s -H "X-Admin-Key: YOUR_KEY" \
  "https://your-mainnode.com/api/admin/payments?limit=20&offset=0"

Returns paginated list of all processed payments with session ID, amount, category, and status.

Payment Statistics

curl -s -H "X-Admin-Key: YOUR_KEY" \
  https://your-mainnode.com/api/admin/payments/stats

Expected response:

{
  "total_payments": 847,
  "total_revenue_usd": 21175.00,
  "by_category": {
    "DZITPACKAGE": { "count": 612, "total": 15300.00 },
    "TOPUP": { "count": 198, "total": 4950.00 },
    "BOOKS": { "count": 37, "total": 925.00 }
  },
  "last_24h": { "count": 14, "total": 350.00 },
  "last_7d": { "count": 89, "total": 2225.00 }
}

Active Stripe Links

curl -s -H "X-Admin-Key: YOUR_KEY" \
  https://your-mainnode.com/api/admin/stripe-links

Expected response:

{
  "links": [
    {
      "id": "plink_1abc...",
      "name": "DZIT 100 Pack",
      "price_usd": 25.00,
      "category": "DZITPACKAGE",
      "active": true,
      "url": "https://buy.stripe.com/..."
    }
  ]
}
4

Manage DZIT Credits

DZIT is the internal credit currency. These endpoints let you check balances, add credits, and deduct credits for any user.

Check Balance

curl -s -H "X-Admin-Key: YOUR_KEY" \
  "https://your-mainnode.com/api/admin/dzit/balance/customer@example.com"

Expected response:

{
  "email": "customer@example.com",
  "balance": 75,
  "last_transaction": "2026-03-08T19:45:00Z"
}

Add Credits

curl -s -X POST -H "X-Admin-Key: YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"email": "customer@example.com", "amount": 50, "reason": "Promotional bonus"}' \
  https://your-mainnode.com/api/admin/dzit/add

Expected response:

{
  "success": true,
  "email": "customer@example.com",
  "credited": 50,
  "new_balance": 125,
  "reason": "Promotional bonus",
  "transaction_id": "dzit_txn_8a4f2b"
}

Deduct Credits

curl -s -X POST -H "X-Admin-Key: YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"email": "customer@example.com", "amount": 10, "reason": "Service: Legal Review"}' \
  https://your-mainnode.com/api/admin/dzit/deduct

Expected response:

{
  "success": true,
  "email": "customer@example.com",
  "debited": 10,
  "new_balance": 115,
  "reason": "Service: Legal Review",
  "transaction_id": "dzit_txn_9c5e3d"
}

Note: Deductions fail with a 400 error if the user's balance is insufficient. The response includes "error": "insufficient_balance" and the current balance.

5

Monitor Nodes

Track every node in your network — their status, services offered, and connection health.

List All Nodes

curl -s -H "X-Admin-Key: YOUR_KEY" \
  https://your-mainnode.com/api/admin/nodes

Expected response:

{
  "nodes": [
    {
      "node_id": "biz_node_0a3f",
      "name": "Acme Consulting",
      "endpoint": "https://acme-node.example.com",
      "owner_email": "owner@acme.com",
      "services": ["consulting", "market-research"],
      "registered_at": "2026-01-15T10:00:00Z",
      "status": "online"
    },
    {
      "node_id": "biz_node_7b2e",
      "name": "LegalBot Pro",
      "endpoint": "https://legal-node.example.com",
      "owner_email": "admin@legalbot.io",
      "services": ["legal-review", "contract-drafting"],
      "registered_at": "2026-02-20T14:30:00Z",
      "status": "online"
    }
  ],
  "total": 12
}

Node Health Check

curl -s -H "X-Admin-Key: YOUR_KEY" \
  https://your-mainnode.com/api/admin/nodes/health

Expected response:

{
  "checked_at": "2026-03-09T14:00:00Z",
  "nodes": [
    {
      "node_id": "biz_node_0a3f",
      "name": "Acme Consulting",
      "status": "online",
      "latency_ms": 142,
      "uptime_pct": 99.7,
      "last_seen": "2026-03-09T13:58:00Z",
      "version": "2.1.0"
    },
    {
      "node_id": "biz_node_7b2e",
      "name": "LegalBot Pro",
      "status": "offline",
      "latency_ms": null,
      "uptime_pct": 94.2,
      "last_seen": "2026-03-09T11:22:00Z",
      "version": "2.0.8"
    }
  ],
  "summary": {
    "total": 12,
    "online": 10,
    "offline": 2,
    "avg_latency_ms": 186
  }
}
6

Verify Wallet

Check on-chain balances and transaction history for the network's Polygon wallet.

Wallet Balance

curl -s -H "X-Admin-Key: YOUR_KEY" \
  https://your-mainnode.com/api/admin/wallet/balance

Expected response:

{
  "wallet": "0x1a2b3c4d5e6f...",
  "chain": "polygon",
  "balances": {
    "MATIC": 12.45,
    "BZeUSD": 3420.00,
    "USDT": 150.00
  },
  "last_updated": "2026-03-09T14:05:00Z"
}

Wallet Transactions

curl -s -H "X-Admin-Key: YOUR_KEY" \
  "https://your-mainnode.com/api/admin/wallet/transactions?limit=5"

Expected response:

{
  "transactions": [
    {
      "tx_hash": "0xabc123...",
      "type": "BZeUSD_transfer",
      "direction": "outgoing",
      "amount": 50.00,
      "token": "BZeUSD",
      "to": "0x7e8f9a...",
      "node_name": "Acme Consulting",
      "reason": "Service settlement: market-research",
      "confirmed": true,
      "block": 54832901,
      "timestamp": "2026-03-08T16:30:00Z"
    },
    {
      "tx_hash": "0xdef456...",
      "type": "MATIC_verification",
      "direction": "incoming",
      "amount": 0.01,
      "token": "MATIC",
      "from": "0x3c4d5e...",
      "node_name": null,
      "reason": "Wallet verification",
      "confirmed": true,
      "block": 54831200,
      "timestamp": "2026-03-08T14:12:00Z"
    }
  ],
  "total": 234
}

Quick Reference

EndpointMethodDescription
/api/admin/statusGETSystem status and connectivity
/api/admin/paymentsGETList Stripe payments
/api/admin/payments/statsGETRevenue statistics by category
/api/admin/stripe-linksGETActive payment links
/api/admin/dzit/balance/{email}GETUser DZIT balance
/api/admin/dzit/addPOSTCredit DZIT tokens
/api/admin/dzit/deductPOSTDebit DZIT tokens
/api/admin/nodesGETList all registered nodes
/api/admin/nodes/healthGETNode health + latency
/api/admin/wallet/balanceGETPolygon wallet balances
/api/admin/wallet/transactionsGETOn-chain transaction history

Download BizNode

Get the full BizNode package and start managing your decentralized business network.

Download BizNode Node Network