{"_id":"0g-nexus-sdk","name":"0g-nexus-sdk","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"0g-nexus-sdk","version":"0.1.0","description":"Verifiable AI agents on 0G — TEE-sealed inference, 0G Storage-anchored traces, on-chain receipts, deterministic replay, offline proof bundles, and ERC-8004 Trustless Agents.","keywords":["0g","0g-labs","ai-agents","erc-8004","erc-7857","tee","verifiable-ai","trustless-agents","sealed-inference","web3","ethers","proofs"],"license":"Apache-2.0","author":{"name":"Kumar Harsh"},"homepage":"https://nexus-alpha-five-26.vercel.app","repository":{"type":"git","url":"git+https://github.com/harsh11067/NEXUS.git","directory":"packages/sdk"},"bugs":{"url":"https://github.com/harsh11067/NEXUS/issues"},"type":"module","sideEffects":false,"engines":{"node":">=20"},"main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"},"./*":{"types":"./dist/*.d.ts","import":"./dist/*.js","default":"./dist/*.js"},"./package.json":"./package.json"},"publishConfig":{"access":"public"},"dependencies":{"@0gfoundation/0g-storage-ts-sdk":"^1.2.10","@0gfoundation/0g-compute-ts-sdk":"^0.8.4","eciesjs":"^0.4.13","ethers":"^6.13.4"},"devDependencies":{"@types/node":"^22.10.2","typescript":"^5.7.2"},"scripts":{"typecheck":"tsc --noEmit","build":"tsc -p tsconfig.build.json"},"_id":"0g-nexus-sdk@0.1.0","_integrity":"sha512-6Cv1TknaOlqTHiXsiVRiuYusei7ycKckgTqT38WB4/8vPcLyobq6zNuKjb5mTiT+FKOTKKQxXQTY7z8UxYtfwA==","_resolved":"/tmp/a14a145cf95aaeb86dbff755c1af4586/0g-nexus-sdk-0.1.0.tgz","_from":"file:0g-nexus-sdk-0.1.0.tgz","_nodeVersion":"24.14.0","_npmVersion":"11.12.0","dist":{"integrity":"sha512-6Cv1TknaOlqTHiXsiVRiuYusei7ycKckgTqT38WB4/8vPcLyobq6zNuKjb5mTiT+FKOTKKQxXQTY7z8UxYtfwA==","shasum":"112787d2f42cdd10383a2100e7200c1e5570de5b","tarball":"https://registry.npmjs.org/0g-nexus-sdk/-/0g-nexus-sdk-0.1.0.tgz","fileCount":64,"unpackedSize":431568,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCID5qBwEMJHwV3WW1+07AUMmh2Sn6W1EPJtI0uV9C3GHcAiEAsAuZNbcK4lO6xyfiCw0YwZFKAshSH/XaieK4L+Lxtyg="}]},"_npmUser":{"name":"k_harsh021","email":"kumarharsh61911518@gmail.com"},"directories":{},"maintainers":[{"name":"k_harsh021","email":"kumarharsh61911518@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/0g-nexus-sdk_0.1.0_1788284773010_0.07747447906876515"},"_hasShrinkwrap":false}},"time":{"created":"2026-09-01T17:46:12.804Z","0.1.0":"2026-09-01T17:46:13.151Z","modified":"2026-09-01T17:46:13.434Z"},"maintainers":[{"name":"k_harsh021","email":"kumarharsh61911518@gmail.com"}],"description":"Verifiable AI agents on 0G — TEE-sealed inference, 0G Storage-anchored traces, on-chain receipts, deterministic replay, offline proof bundles, and ERC-8004 Trustless Agents.","homepage":"https://nexus-alpha-five-26.vercel.app","keywords":["0g","0g-labs","ai-agents","erc-8004","erc-7857","tee","verifiable-ai","trustless-agents","sealed-inference","web3","ethers","proofs"],"repository":{"type":"git","url":"git+https://github.com/harsh11067/NEXUS.git","directory":"packages/sdk"},"author":{"name":"Kumar Harsh"},"bugs":{"url":"https://github.com/harsh11067/NEXUS/issues"},"license":"Apache-2.0","readme":"# NEXUS SDK\n\nTypeScript SDK for **NEXUS** — the verifiable AI-agent trust layer on [0G](https://0g.ai).\n\nEvery agent run produces a proof anyone can re-check: the inference happens inside a\n**0G Sealed Inference (TEE)** enclave, the trace is anchored in **0G Storage**, and the\nreceipt is committed on the **0G chain**. This SDK is the client for all of it — plus the\n**ERC-8004 Trustless Agents** adapter that makes a NEXUS agent portable to any\nERC-8004-aware platform.\n\n> Live on 0G mainnet (chain id **16661**). Nothing here is mocked — every call hits the\n> real network, and every verdict is recomputed rather than read back.\n\n## Install\n\n```bash\nnpm install 0g-nexus-sdk\n```\n\n## Verify a receipt (read-only — no key needed)\n\n```ts\nprocess.env.OG_NETWORK = \"mainnet\";\nconst { verifyReceipt } = await import(\"0g-nexus-sdk\");\n\nconst proof = await verifyReceipt(\"2\");\n\nconsole.log(proof.valid);   // every hard check re-verified and nothing failed\nfor (const c of proof.checks) console.log(c.status ? \"PASS\" : \"FAIL\", c.claim);\n```\n\nEach check is computed at call time — the chain session, the 0G Storage Merkle root, the\nreceipt hash, the trusted signer, and an **independent** re-verification of the enclave\nattestation. Anything that cannot be verified is labelled as such and never upgraded to\na pass.\n\n## Re-run a past proof (deterministic replay)\n\n```ts\nimport { replayReceipt } from \"0g-nexus-sdk\";\n\nconst r = await replayReceipt(\"2\");\nconsole.log(r.replayable, r.match);      // re-executed; outputs byte-identical\nconsole.log(r.replay?.teeVerified);      // the fresh run, attested in the enclave\nconsole.log(r.original?.teeReVerified);  // the original run, re-checked now\n```\n\nReplays pin `temperature: 0`, a fixed seed, and the original attested provider. TEE\nsignatures carry a nonce, so signatures differ between runs — the **output** matches and\neach run is independently verified. Receipts written before trace schema v2 report\n`replayable: false` with a reason instead of failing.\n\n## Offline proof bundles\n\nExport everything a third party needs to verify a receipt with **no network at all**:\n\n```ts\nimport { exportProofBundle, verifyProofBundleOffline } from \"0g-nexus-sdk\";\n\nconst bundle = await exportProofBundle(\"2\");\nconst { valid, checks } = await verifyProofBundleOffline(bundle);\n// B1 re-derive the receipt hash · B2 CID matches the anchor · B3 0G Merkle root\n```\n\n`verifyProofBundleOnline` adds a fresh enclave check and a live chain read. Flip one byte\nof the embedded trace and the bundle fails.\n\n## ERC-8004 Trustless Agents\n\nThe canonical **Identity** and **Reputation** registries are live on 0G; the\n**Validation** registry has no canonical deployment on any chain yet (that section of the\nspec is still under revision with the TEE community), so NEXUS ships an interface-faithful\nreference plus its own TEE validator. The whole standard sits behind one module —\n`erc8004.ts` — so a spec revision touches one file.\n\n```ts\nimport { registerIdentity, requestValidation, verifyValidation, giveFeedback } from \"0g-nexus-sdk\";\n\n// register NEXUS agent #1 — card to 0G Storage, content hash + link metadata on-chain\nconst { erc8004AgentId } = await registerIdentity(\"1\");\n\n// ask the NEXUS TEE validator to attest a task, then re-check the answer yourself\nconst { requestHash } = await requestValidation(erc8004AgentId, spec);\nconst { valid, status, teeReVerified } = await verifyValidation(requestHash);\n\n// portable, receipt-anchored reputation in the canonical Reputation Registry\nawait giveFeedback(erc8004AgentId, receiptId);\n```\n\nNEXUS validates **external** agents too — ones never minted in NEXUS — which is what\nmakes it infrastructure rather than a walled garden.\n\n## Configuration\n\nSet `OG_NETWORK` to `mainnet` or `galileo` (default `galileo`). Reads need no key. Writes\nneed an operator key: `OG_MAINNET_KEY` on mainnet, `PRIVATE_KEY` on testnet — mainnet\ndeliberately refuses to fall back to a testnet key.\n\n| Variable | Purpose |\n| --- | --- |\n| `OG_NETWORK` | `mainnet` \\| `galileo` |\n| `OG_MAINNET_KEY` | operator key for mainnet writes |\n| `PRIVATE_KEY` | operator key for testnet writes |\n| `OG_COMPUTE_API_KEY` / `OG_COMPUTE_PROVIDER` | 0G Compute (sealed inference) |\n| `NEXUS_NO_DOTENV=1` | ignore `.env` files, use real env vars only |\n\nContract addresses ship embedded per network — you do not configure them. If a `.env`\nsits above your working directory it is read for defaults; real env vars always win.\n\n### Deployed contracts (0G mainnet, 16661)\n\n| Contract | Address |\n| --- | --- |\n| NexusAgent (ERC-7857) | `0x7D4eD6c120E41a241973760D8aD244f2f9Ec6793` |\n| ProofMeshReceipts | `0x709D50F09527b7a3AdC041dFA387f39151535A36` |\n| NexusEscrow | `0xB93c13b4Dbe322dF7B8051501A8E753f1A4Cd703` |\n| ReputationRegistry | `0xc04012c6586eaF48726D37206502682375e63137` |\n| CompositeReceiptMinter | `0x8Ecb868cFF8B9B809bB5318467b0C20d1d518c58` |\n| ERC8004ValidationRegistry | `0x47FF84cA19FB8899E3866c7A6767157AD9fF38AC` |\n| NexusTEEValidator | `0x7954e03CB645c8519F8b8Fd880720228ec09D9ae` |\n\nAll seven are source-verified on chainscan. The Galileo testnet mirrors the full set.\n\n## Modules\n\n`config` (networks, provider, wallet) · `crypto` · `persona` (encrypted agent state) ·\n`storage` (0G Storage upload/download + Merkle verify) · `inference` (sealed inference) ·\n`contracts` (typed contract handles) · `runtime` (run an agent, mint a receipt) ·\n`verify` · `erc8004` · `replay` · `bundle` · `leaderboard`.\n\nEverything is re-exported from the package root; deep imports also work\n(`0g-nexus-sdk/verify`).\n\n## Requirements\n\nNode.js ≥ 20. ESM only.\n\n## Links\n\n- Live app — https://nexus-alpha-five-26.vercel.app\n- Source, docs, and the reproducible proof index — https://github.com/harsh11067/NEXUS\n\n## License\n\nApache-2.0 © NEXUS contributors. The NEXUS contracts are CC0; the wider repository is GPL-3.0 — this SDK package is Apache-2.0 so anyone can build on it.\n","readmeFilename":"README.md","_rev":"1-a29e95a98e5eb1656dbe2c607401baca"}