Install
PQ-402 is four packages on npm. All four are ES modules, need Node.js 22 or later, and move together: install the same version of each.
| Package | You need it to |
|---|---|
@pq402/server |
charge for routes: PaymentGate and the node:http adapter |
@pq402/client |
pay: createPq402Fetch, a fetch that answers 402s |
@pq402/scheme-qorechain |
talk to QoreChain: chain reader, settler, facilitators, the in-memory chain |
@pq402/core |
the signed bytes, ML-DSA-87, sealing, receipts and error codes |
A server
Section titled “A server”The server also imports x402Facilitator from @x402/core, the x402 package PQ-402 is built on.
pnpm add @pq402/server @pq402/scheme-qorechain @pq402/core @x402/core@2.31.0 viemnpm install @pq402/server @pq402/scheme-qorechain @pq402/core @x402/core@2.31.0 viemyarn add @pq402/server @pq402/scheme-qorechain @pq402/core @x402/core@2.31.0 viemA client
Section titled “A client”pnpm add @pq402/client @pq402/scheme-qorechain @pq402/corenpm install @pq402/client @pq402/scheme-qorechain @pq402/coreyarn add @pq402/client @pq402/scheme-qorechain @pq402/coreKeys from a phrase
Section titled “Keys from a phrase”On the testnet, derive an account’s keys from its phrase with QoreChain’s SDK and QoreSeal:
pnpm add @qorechain/sdk@0.14.0 @qorechain/qoreseal@0.1.0npm install @qorechain/sdk@0.14.0 @qorechain/qoreseal@0.1.0yarn add @qorechain/sdk@0.14.0 @qorechain/qoreseal@0.1.0The guides use a small helper for this, account.ts.
Running TypeScript
Section titled “Running TypeScript”The samples are TypeScript with top-level await. Run them with tsx: npx tsx file.ts. Your
package.json needs "type": "module".