{
  "schemaVersion": "1.0",
  "item": {
    "slug": "iqdb",
    "name": "IQDB",
    "source": "tencent",
    "type": "skill",
    "category": "数据分析",
    "sourceUrl": "https://clawhub.ai/Emanz1/iqdb",
    "canonicalUrl": "https://clawhub.ai/Emanz1/iqdb",
    "targetPlatform": "OpenClaw"
  },
  "install": {
    "downloadMode": "redirect",
    "downloadUrl": "/downloads/iqdb",
    "sourceDownloadUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=iqdb",
    "sourcePlatform": "tencent",
    "targetPlatform": "OpenClaw",
    "installMethod": "Manual import",
    "extraction": "Extract archive",
    "prerequisites": [
      "OpenClaw"
    ],
    "packageFormat": "ZIP package",
    "includedAssets": [
      "references/hanlock.md",
      "references/iqdb-core.md",
      "references/setup.md",
      "references/x402-payments.md",
      "skill.md"
    ],
    "primaryDoc": "SKILL.md",
    "quickSetup": [
      "Download the package from Yavira.",
      "Extract the archive and review SKILL.md first.",
      "Import or place the package into your OpenClaw setup."
    ],
    "agentAssist": {
      "summary": "Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.",
      "steps": [
        "Download the package from Yavira.",
        "Extract it into a folder your agent can access.",
        "Paste one of the prompts below and point your agent at the extracted folder."
      ],
      "prompts": [
        {
          "label": "New install",
          "body": "I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Tell me what you changed and call out any manual steps you could not complete."
        },
        {
          "label": "Upgrade existing",
          "body": "I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Summarize what changed and any follow-up checks I should run."
        }
      ]
    },
    "sourceHealth": {
      "source": "tencent",
      "status": "healthy",
      "reason": "direct_download_ok",
      "recommendedAction": "download",
      "checkedAt": "2026-04-23T16:43:11.935Z",
      "expiresAt": "2026-04-30T16:43:11.935Z",
      "httpStatus": 200,
      "finalUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=4claw-imageboard",
      "contentType": "application/zip",
      "probeMethod": "head",
      "details": {
        "probeUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=4claw-imageboard",
        "contentDisposition": "attachment; filename=\"4claw-imageboard-1.0.1.zip\"",
        "redirectLocation": null,
        "bodySnippet": null
      },
      "scope": "source",
      "summary": "Source download looks usable.",
      "detail": "Yavira can redirect you to the upstream package for this source.",
      "primaryActionLabel": "Download for OpenClaw",
      "primaryActionHref": "/downloads/iqdb"
    },
    "validation": {
      "installChecklist": [
        "Use the Yavira download entry.",
        "Review SKILL.md after the package is downloaded.",
        "Confirm the extracted package contains the expected setup assets."
      ],
      "postInstallChecks": [
        "Confirm the extracted package includes the expected docs or setup files.",
        "Validate the skill or prompts are available in your target agent workspace.",
        "Capture any manual follow-up steps the agent could not complete."
      ]
    },
    "downloadPageUrl": "https://openagent3.xyz/downloads/iqdb",
    "agentPageUrl": "https://openagent3.xyz/skills/iqdb/agent",
    "manifestUrl": "https://openagent3.xyz/skills/iqdb/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/iqdb/agent.md"
  },
  "agentAssist": {
    "summary": "Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.",
    "steps": [
      "Download the package from Yavira.",
      "Extract it into a folder your agent can access.",
      "Paste one of the prompts below and point your agent at the extracted folder."
    ],
    "prompts": [
      {
        "label": "New install",
        "body": "I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Tell me what you changed and call out any manual steps you could not complete."
      },
      {
        "label": "Upgrade existing",
        "body": "I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Summarize what changed and any follow-up checks I should run."
      }
    ]
  },
  "documentation": {
    "source": "clawhub",
    "primaryDoc": "SKILL.md",
    "sections": [
      {
        "title": "Overview",
        "body": "Build on-chain relational databases on Solana using IQ Labs' tech stack. Three tools:\n\nIQDB — Full CRUD relational database on Solana via Anchor PDAs. Tables, rows, rolling keccak hash for tamper-evident history.\nhanLock — Password-based Hangul syllabic encoding (base-11172). Lightweight data encoding for on-chain privacy. Zero dependencies.\nx402 — HTTP 402 payment-gated file inscription to Solana. Quote → Pay (USDC/SOL) → Broadcast chunk transactions → Download."
      },
      {
        "title": "Prerequisites",
        "body": "Node.js 18+\nSolana CLI (solana --version)\nA Solana wallet with devnet SOL (solana airdrop 2)"
      },
      {
        "title": "Network Support",
        "body": "Mainnet: Fully supported. Program ID: 9KLLchQVJpGkw4jPuUmnvqESdR7mtNCYr3qS4iQLabs (via @iqlabs-official/solana-sdk).\nDevnet: Supported via legacy SDK (@iqlabsteam/iqdb). Program: 7Vk5JJDxUBAaaAkpYQpWYCZNz4SVPm3mJFSxrBzTQuAX."
      },
      {
        "title": "Install (New Official SDK — recommended)",
        "body": "npm install @iqlabs-official/solana-sdk @solana/web3.js"
      },
      {
        "title": "Install (Legacy SDK — devnet only)",
        "body": "npm install @iqlabsteam/iqdb @coral-xyz/anchor @solana/web3.js"
      },
      {
        "title": "Environment Variables (Legacy SDK)",
        "body": "ANCHOR_WALLET=/path/to/keypair.json    # Required — Solana keypair for signing\nANCHOR_PROVIDER_URL=https://api.devnet.solana.com  # Required — RPC for writes\nNETWORK_URL=https://api.devnet.solana.com  # Required — RPC for reads (must match ANCHOR_PROVIDER_URL)\n\nLegacy SDK note: Set NETWORK_URL to match ANCHOR_PROVIDER_URL. The SDK uses separate connections for reads and writes.\n\nRPC Note: Public Solana RPCs rate-limit aggressively. Add 2-3 second delays between rapid transactions on mainnet. Use a dedicated RPC provider (Helius, Alchemy, QuickNode) for production."
      },
      {
        "title": "Minimal Example — New SDK (Mainnet)",
        "body": "const { Connection, Keypair, SystemProgram, PublicKey } = require('@solana/web3.js');\nconst { writer, reader, setRpcUrl, contract } = require('@iqlabs-official/solana-sdk');\n\n// Monkey-patch for Node v24 Buffer compatibility\nconst seedModule = require('@iqlabs-official/solana-sdk/dist/sdk/utils/seed');\nconst origFn = seedModule.toSeedBytes;\nseedModule.toSeedBytes = (v) => Buffer.from(origFn(v));\n\nsetRpcUrl('https://api.mainnet-beta.solana.com');\nconst connection = new Connection('https://api.mainnet-beta.solana.com', 'confirmed');\n\n// Write a row (requires root + table initialized first — see references/iqdb-core.md)\nconst sig = await writer.writeRow(\n  connection, signer, 'my-db-root', 'players',\n  JSON.stringify({ name: 'Alice', score: '1500', level: '12' })\n);\n\n// Read rows\nconst rows = await reader.readTableRows(tablePda);"
      },
      {
        "title": "Minimal Example — Legacy SDK (Devnet)",
        "body": "// Use CommonJS — the SDK bundles CJS internally\nconst { createIQDB } = require('@iqlabsteam/iqdb');\n\nconst iqdb = createIQDB();\n\n// Ensure root PDA exists (idempotent)\nawait iqdb.ensureRoot();\n\n// Create a table (idempotent — use ensureTable over createTable)\nawait iqdb.ensureTable('players', ['name', 'score', 'level'], 'name');\n\n// Write a row — data must be a JSON STRING, not an object\nawait iqdb.writeRow('players', JSON.stringify({\n  name: 'Alice', score: '1500', level: '12'\n}));\n\n// Read all rows — requires userPubkey as string\nconst rows = await iqdb.readRowsByTable({\n  userPubkey: 'YOUR_WALLET_PUBKEY',\n  tableName: 'players'\n});\nconsole.log(rows);"
      },
      {
        "title": "Architecture",
        "body": "Root PDA (per wallet)\n  └── Table PDA (per table name)\n       └── Rows stored as transaction data\n            └── hash: keccak(domain || prev_hash || tx_data)\n\nRoot PDA — One per wallet. Initialized via ensureRoot().\nTable PDA — Created via ensureTable() or createTable(). Has column schema and ID column.\nRows — Written as JSON strings via writeRow(). Append-only — each write is a new transaction.\nRolling hash — Each write appends to an immutable hash chain. Enables tamper detection without full replication."
      },
      {
        "title": "Core Operations",
        "body": "See references/iqdb-core.md for full API.\n\nOperationMethodCostInit rootcontract.initializeDbRootInstruction() / ensureRoot()~0.01 SOL rentCreate tablecontract.createTableInstruction() / ensureTable()~0.02 SOL rentWrite rowwriter.writeRow() / iqdb.writeRow()~0.005-0.01 SOLRead rowsreader.readTableRows() / readRowsByTable()Free (RPC read)Update/DeletepushInstruction(table, txSig, before, after)TX fee onlyExtension tablecreateExtTable(base, rowId, extKey, cols, idCol?)~0.02 SOL rent\n\nCost reference (mainnet): Root + 3 tables + 5 data rows = ~0.09 SOL total."
      },
      {
        "title": "Important Constraints",
        "body": "Row data size limit: Keep row JSON under ~100 bytes. The on-chain program enforces a transaction size limit (TxTooLong error). For larger data, split across multiple rows or use hanLock sparingly (encoded output is larger than input).\nAppend-only writes: writeRow always appends. Use pushInstruction for updates/deletes.\npushInstruction writes to instruction log, not row data. readRowsByTable returns raw rows and does NOT reflect updates/deletes from pushInstruction. To see the full picture including corrections, use searchTableByName which returns both rows (raw) and instruRows/targetContent (instruction history). Your application must apply instruction corrections on top of raw rows.\nCommonJS required: The SDK uses dynamic require() internally. Use .cjs files or \"type\": \"commonjs\" in package.json. ESM imports will fail."
      },
      {
        "title": "hanLock Encoding",
        "body": "See references/hanlock.md for full API.\n\nEncode data with a password before writing on-chain for lightweight privacy:\n\nconst { encodeWithPassword, decodeWithPassword } = require('hanlock');\n\nconst encoded = encodeWithPassword('short secret', 'mypassword');\n// → Korean syllable string like \"깁닣뭡...\"\n\n// Write encoded data on-chain\nawait iqdb.writeRow('secrets', JSON.stringify({ owner: 'Alice', data: encoded }));\n\n// Later — decode\nconst decoded = decodeWithPassword(encoded, 'mypassword');\n// → 'short secret'\n\nNote: hanLock encoding expands data size (~3x). Keep input short to stay within the on-chain row size limit."
      },
      {
        "title": "x402 Payment Flow",
        "body": "See references/x402-payments.md for full API.\n\nPayment-gated file inscription to Solana:\n\nQuote — POST /quote with file metadata → get price in USDC/SOL\nPay — Send payment transaction to provided address\nInscribe — POST /inscribe with payment proof → file chunked into Solana transactions\nDownload — GET /download/:txId → reconstruct file from on-chain chunks"
      },
      {
        "title": "Use Cases",
        "body": "Discord RPG Bot — On-chain character persistence, provable item ownership, immutable game state\nGovernance — Tamper-evident proposal/vote storage with rolling hash audit trail\nCompliance logs — Verifiable edit history for call center records\nPaid storage — Monetize data inscription via x402"
      },
      {
        "title": "References",
        "body": "IQ Labs SDK — Official Solana SDK (mainnet)\n@iqlabsteam/iqdb — Legacy SDK (devnet)\nhanLock — Hangul syllabic encoding\nSolana Web3.js — Solana client library"
      }
    ],
    "body": "IQDB On-Chain Storage (Code-In Tech)\nOverview\n\nBuild on-chain relational databases on Solana using IQ Labs' tech stack. Three tools:\n\nIQDB — Full CRUD relational database on Solana via Anchor PDAs. Tables, rows, rolling keccak hash for tamper-evident history.\nhanLock — Password-based Hangul syllabic encoding (base-11172). Lightweight data encoding for on-chain privacy. Zero dependencies.\nx402 — HTTP 402 payment-gated file inscription to Solana. Quote → Pay (USDC/SOL) → Broadcast chunk transactions → Download.\nQuick Start\nPrerequisites\nNode.js 18+\nSolana CLI (solana --version)\nA Solana wallet with devnet SOL (solana airdrop 2)\nNetwork Support\nMainnet: Fully supported. Program ID: 9KLLchQVJpGkw4jPuUmnvqESdR7mtNCYr3qS4iQLabs (via @iqlabs-official/solana-sdk).\nDevnet: Supported via legacy SDK (@iqlabsteam/iqdb). Program: 7Vk5JJDxUBAaaAkpYQpWYCZNz4SVPm3mJFSxrBzTQuAX.\nInstall (New Official SDK — recommended)\nnpm install @iqlabs-official/solana-sdk @solana/web3.js\n\nInstall (Legacy SDK — devnet only)\nnpm install @iqlabsteam/iqdb @coral-xyz/anchor @solana/web3.js\n\nEnvironment Variables (Legacy SDK)\nANCHOR_WALLET=/path/to/keypair.json    # Required — Solana keypair for signing\nANCHOR_PROVIDER_URL=https://api.devnet.solana.com  # Required — RPC for writes\nNETWORK_URL=https://api.devnet.solana.com  # Required — RPC for reads (must match ANCHOR_PROVIDER_URL)\n\n\nLegacy SDK note: Set NETWORK_URL to match ANCHOR_PROVIDER_URL. The SDK uses separate connections for reads and writes.\n\nRPC Note: Public Solana RPCs rate-limit aggressively. Add 2-3 second delays between rapid transactions on mainnet. Use a dedicated RPC provider (Helius, Alchemy, QuickNode) for production.\n\nMinimal Example — New SDK (Mainnet)\nconst { Connection, Keypair, SystemProgram, PublicKey } = require('@solana/web3.js');\nconst { writer, reader, setRpcUrl, contract } = require('@iqlabs-official/solana-sdk');\n\n// Monkey-patch for Node v24 Buffer compatibility\nconst seedModule = require('@iqlabs-official/solana-sdk/dist/sdk/utils/seed');\nconst origFn = seedModule.toSeedBytes;\nseedModule.toSeedBytes = (v) => Buffer.from(origFn(v));\n\nsetRpcUrl('https://api.mainnet-beta.solana.com');\nconst connection = new Connection('https://api.mainnet-beta.solana.com', 'confirmed');\n\n// Write a row (requires root + table initialized first — see references/iqdb-core.md)\nconst sig = await writer.writeRow(\n  connection, signer, 'my-db-root', 'players',\n  JSON.stringify({ name: 'Alice', score: '1500', level: '12' })\n);\n\n// Read rows\nconst rows = await reader.readTableRows(tablePda);\n\nMinimal Example — Legacy SDK (Devnet)\n// Use CommonJS — the SDK bundles CJS internally\nconst { createIQDB } = require('@iqlabsteam/iqdb');\n\nconst iqdb = createIQDB();\n\n// Ensure root PDA exists (idempotent)\nawait iqdb.ensureRoot();\n\n// Create a table (idempotent — use ensureTable over createTable)\nawait iqdb.ensureTable('players', ['name', 'score', 'level'], 'name');\n\n// Write a row — data must be a JSON STRING, not an object\nawait iqdb.writeRow('players', JSON.stringify({\n  name: 'Alice', score: '1500', level: '12'\n}));\n\n// Read all rows — requires userPubkey as string\nconst rows = await iqdb.readRowsByTable({\n  userPubkey: 'YOUR_WALLET_PUBKEY',\n  tableName: 'players'\n});\nconsole.log(rows);\n\nArchitecture\nRoot PDA (per wallet)\n  └── Table PDA (per table name)\n       └── Rows stored as transaction data\n            └── hash: keccak(domain || prev_hash || tx_data)\n\nRoot PDA — One per wallet. Initialized via ensureRoot().\nTable PDA — Created via ensureTable() or createTable(). Has column schema and ID column.\nRows — Written as JSON strings via writeRow(). Append-only — each write is a new transaction.\nRolling hash — Each write appends to an immutable hash chain. Enables tamper detection without full replication.\nCore Operations\n\nSee references/iqdb-core.md for full API.\n\nOperation\tMethod\tCost\nInit root\tcontract.initializeDbRootInstruction() / ensureRoot()\t~0.01 SOL rent\nCreate table\tcontract.createTableInstruction() / ensureTable()\t~0.02 SOL rent\nWrite row\twriter.writeRow() / iqdb.writeRow()\t~0.005-0.01 SOL\nRead rows\treader.readTableRows() / readRowsByTable()\tFree (RPC read)\nUpdate/Delete\tpushInstruction(table, txSig, before, after)\tTX fee only\nExtension table\tcreateExtTable(base, rowId, extKey, cols, idCol?)\t~0.02 SOL rent\n\nCost reference (mainnet): Root + 3 tables + 5 data rows = ~0.09 SOL total.\n\nImportant Constraints\nRow data size limit: Keep row JSON under ~100 bytes. The on-chain program enforces a transaction size limit (TxTooLong error). For larger data, split across multiple rows or use hanLock sparingly (encoded output is larger than input).\nAppend-only writes: writeRow always appends. Use pushInstruction for updates/deletes.\npushInstruction writes to instruction log, not row data. readRowsByTable returns raw rows and does NOT reflect updates/deletes from pushInstruction. To see the full picture including corrections, use searchTableByName which returns both rows (raw) and instruRows/targetContent (instruction history). Your application must apply instruction corrections on top of raw rows.\nCommonJS required: The SDK uses dynamic require() internally. Use .cjs files or \"type\": \"commonjs\" in package.json. ESM imports will fail.\nhanLock Encoding\n\nSee references/hanlock.md for full API.\n\nEncode data with a password before writing on-chain for lightweight privacy:\n\nconst { encodeWithPassword, decodeWithPassword } = require('hanlock');\n\nconst encoded = encodeWithPassword('short secret', 'mypassword');\n// → Korean syllable string like \"깁닣뭡...\"\n\n// Write encoded data on-chain\nawait iqdb.writeRow('secrets', JSON.stringify({ owner: 'Alice', data: encoded }));\n\n// Later — decode\nconst decoded = decodeWithPassword(encoded, 'mypassword');\n// → 'short secret'\n\n\nNote: hanLock encoding expands data size (~3x). Keep input short to stay within the on-chain row size limit.\n\nx402 Payment Flow\n\nSee references/x402-payments.md for full API.\n\nPayment-gated file inscription to Solana:\n\nQuote — POST /quote with file metadata → get price in USDC/SOL\nPay — Send payment transaction to provided address\nInscribe — POST /inscribe with payment proof → file chunked into Solana transactions\nDownload — GET /download/:txId → reconstruct file from on-chain chunks\nUse Cases\nDiscord RPG Bot — On-chain character persistence, provable item ownership, immutable game state\nGovernance — Tamper-evident proposal/vote storage with rolling hash audit trail\nCompliance logs — Verifiable edit history for call center records\nPaid storage — Monetize data inscription via x402\nReferences\nIQ Labs SDK — Official Solana SDK (mainnet)\n@iqlabsteam/iqdb — Legacy SDK (devnet)\nhanLock — Hangul syllabic encoding\nSolana Web3.js — Solana client library"
  },
  "trust": {
    "sourceLabel": "tencent",
    "provenanceUrl": "https://clawhub.ai/Emanz1/iqdb",
    "publisherUrl": "https://clawhub.ai/Emanz1/iqdb",
    "owner": "Emanz1",
    "version": "1.0.0",
    "license": null,
    "verificationStatus": "Indexed source record"
  },
  "links": {
    "detailUrl": "https://openagent3.xyz/skills/iqdb",
    "downloadUrl": "https://openagent3.xyz/downloads/iqdb",
    "agentUrl": "https://openagent3.xyz/skills/iqdb/agent",
    "manifestUrl": "https://openagent3.xyz/skills/iqdb/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/iqdb/agent.md"
  }
}