Scan your whole stack
From OX Research Newsroom
Are you using @molpha/sdk?
Find out what’s in your code.
Scan your apps free in minutes (opens in a new tab)Latest version: v0.3.0-dev-20261124114841
@molpha/sdk was last scanned on 24 Nov 2026 at version 0.3.0-dev-20261124114841. Risk score 0 of 100. No malicious behavior was detected.
| Version | Published | Status |
|---|---|---|
| 0.3.0-dev-20261124114841 LATEST | 24 Nov 2026 | No rules fired |
| 0.3.0-dev-20261124085658 | 24 Nov 2026 | No rules fired |
| 0.3.0-dev-20261119125845 | 19 Nov 2026 | No rules fired |
| 0.3.0-dev-20261119103714 | 19 Nov 2026 | Not shown |
| 0.3.0-dev-20261118084512 | 18 Nov 2026 | Not shown |
Findings for v0.3.0-dev-20261124114841. The score is a capped sum of the weights of the rules that fired — not CVSS, not exploitability, and not a probability. It is not comparable across packages with different scan coverage.
The score describes 0.3.0-dev-20261124114841; other versions have their own rules, not their own score.
The publisher’s own README, as collected from the registry.
TypeScript SDK for Molpha, a pull-based oracle protocol. Molpha nodes fetch an API result, sign it once with a threshold signature, and the same signed attestation can be verified on Solana, EVM and Starknet. This SDK is for data consumers and feed owners, and runs in the browser and in Node.js.
Links: molpha.io · GitHub · npm
Use it to:
submit_attestation);Runtime: Node.js >=20.19.0 (ESM).
Molpha turns off-chain API responses into verified on-chain data.
At a high level:
Consumer
└─ subscribes (USDC) on Solana
└─ derives sourceId = keccak256(canonical apiConfig)
└─ signs a RequestAuth bound to (programId, gateway, sourceId, signaturesRequired, authTimestamp)
Gateway
└─ assigns the round's timestamp (unix ms) from its own clock and coordinates a signing round
Verifier nodes
└─ fetch/recompute the API result independently
└─ sign the canonical result if valid
Solana / EVM / Starknet verifiers
└─ verify quorum, registry version, signer bitmap, timestamp, and aggregate signature
└─ finalize or expose the verified value
The gateway is a coordination layer, not a trusted oracle. A result is trusted only if it carries a valid threshold signature from the selected verifier nodes for the current registry version.
Molpha uses Solana as the canonical protocol chain for subscriptions, registry snapshots, node accounts, and feed state. EVM and Starknet verifier contracts are stateless verification surfaces: they verify signed Molpha attestations without managing subscriptions or source configuration locally.
Every signed attestation commits to the same message across chains:
message = keccak256(
keccak256("MOLPHA_MESSAGE_V1") || value || sourceId || u32be(registryVersion) ||
u8(signaturesRequired) || u64be(timestamp) || signersBitmap
)
The preimage is 141 bytes (32 + 32 + 32 + 4 + 1 + 8 + 32).
attestationMessageHash / attestationMessageHashFromAttestation recompute it client-side.
npm install @molpha/sdk @anchor-lang/core bn.js
# or: pnpm add @molpha/sdk @anchor-lang/core bn.js
# or: yarn add @molpha/sdk @anchor-lang/core bn.js
@anchor-lang/core and bn.js are optional peer dependencies. Install them if you use the Solana / Anchor path (as in the examples below). Gateway-only or EVM/Starknet-only apps can skip them. Runtime dependencies installed automatically are @solana/kit, @noble/* and canonicalize.
For the pre-release channel (the dev gateway and the matching dev Solana program; may change without notice):
npm install @molpha/sdk@dev
Defaults are baked at publish time from config/deployments.json (MOLPHA_SDK_PROFILE). Override at runtime with endpoints, programId, and idl.
| npm dist-tag | Profile | Default gateway | Solana program | EVM / Starknet |
|---|---|---|---|---|
latest |
stable |
https://gateway.molpha.io/ |
MoLF3pgVA9MENSuEujxNNSMaTo71aLyewaH5nrWfUZs |
Documented CREATE2 / Sepolia addresses |
dev |
dev |
https://dev-gateway.molpha.io/ |
chivcFQgxzwkpLvW41PV431HQ4dYpaW3povQH3AdpQt |
Provisional until redeploy (MOLPHA_DEV_VERIFIERS_PROVISIONAL); falls back to stable addresses |
Inspect the active profile via MOLPHA_SDK_PROFILE and MOLPHA_DEV_VERIFIERS_PROVISIONAL. Local builds: MOLPHA_SDK_PROFILE=stable pnpm build or MOLPHA_SDK_PROFILE=dev pnpm build (default dev).
| Import | Use |
|---|---|
@molpha/sdk |
Facade (MolphaSDK), MolphaGateway, MolphaSolanaClient, core hashing (deriveSourceId, attestationMessageHash, hashRequestAuth, timestampSeconds), EVM/Starknet helpers. Browser-safe; no fs in the main entry. |
@molpha/sdk/utils |
walletFromKeypairFile, loadKeypair — load a Solana CLI keypair as an Anchor Wallet. Node.js only. |
The package is ESM with "sideEffects": false, so gateway-only or read-only apps can tree-shake unused paths.
import { web3 } from "@anchor-lang/core";
import { MolphaSDK, PlanType, deriveSourceIdString } from "@molpha/sdk";
import { walletFromKeypairFile } from "@molpha/sdk/utils";
const wallet = walletFromKeypairFile("~/.config/solana/id.json");
const sdk = new MolphaSDK({
connection: new web3.Connection("https://api.devnet.solana.com", "confirmed"),
wallet,
// endpoints: [{ url: "https://gateway.example.com", gatewayAuthority: "<base58>" }],
});
// Subscribe if needed (USDC on Solana)
const plan = await sdk.solana.getPlan(PlanType.Basic);
await sdk.solana.subscribe(PlanType.Basic, {
maxPriceUsdc: plan.subscriptionPrice,
});
const apiConfig = {
url: "https://api.example.com/price",
responseParser: "$.price",
};
const signaturesRequired = 3;
const { result, signature, feed } = await sdk.requestAndSubmit({
apiConfig,
signaturesRequired,
});
// The round's identity, for reads and cross-chain verification.
const sourceId = deriveSourceIdString(apiConfig); // === result.payload.sourceId
requestAndSubmit requests a threshold-signed attestation from the gateway (against the current on-chain registry version) and submits it to Solana via submit_attestation in one call. The first successful submit creates the feed account for (sourceId, signaturesRequired, submitter) if it does not already exist.
| Option | Description |
|---|---|
connection |
Anchor-compatible Solana RPC connection. |
wallet |
MolphaWallet. Used for Solana transactions and gateway authentication when available. |
| Option | Default |
|---|---|
endpoints |
DEFAULT_GATEWAY_ENDPOINT — URL, { url, gatewayAuthority }, or an array of either for failover (see Gateway identity) |
programId |
MOLPHA_PROGRAM_ADDRESS from the vendored IDL; also bound into gateway request auth |
idl |
MOLPHA_IDL from idl/molpha.json |
commitment |
"confirmed" |
import {
DEFAULT_GATEWAY_ENDPOINT,
MOLPHA_IDL,
MOLPHA_PROGRAM_ADDRESS,
} from "@molpha/sdk";
const sdk = new MolphaSDK({
connection,
wallet,
endpoints: [
DEFAULT_GATEWAY_ENDPOINT,
{ url: "https://backup.example.com", gatewayAuthority: "<gateway base58 pubkey>" },
],
// programId: "YourProgramAddress...",
// idl: MOLPHA_IDL,
});
Gateway request authorization binds the gateway's on-chain account, so the client must know which gateway it is talking to:
requestAuthHash = keccak256(
"MOLPHA_REQAUTH_V1" || programId || gatewayPda || sourceId || u8(signaturesRequired) || u64le(authTimestamp)
)
gatewayPda = PDA(["molpha_gateway", gatewayAuthority], programId)
authTimestamp is the caller's unix seconds at signing: a freshness stamp for the authorization only (the gateway rejects stamps outside its request_auth.window_seconds, 60 s by default). It is read from the SDK clock for every attempt, so a retry after a 409 signs a fresh one. It has nothing to do with the round's timestamp.
Pass gatewayAuthority (the gateway's base58 signing pubkey) per endpoint to pin it. When omitted, the SDK calls GET {url}/v1/info once per endpoint and reads:
{ "status": "ok", "data": { "gatewayAuthority": "<base58>", "programId": "<base58>" } }
A programId that differs from the client's is rejected. Because the hash differs per gateway, the auth signature is recomputed for every endpoint actually tried during failover — with a browser wallet that means one signing prompt per endpoint tried. /v1/info is never contacted when no signer is configured (dev zero-signature path).
The request body carries authSig and authTimestamp but no round timestamp. The gateway stamps the
round with its own clock, in unix milliseconds, floored to a fixed 100 ms tick
(floor(nowMs / 100) * 100), and the result carries the stamp in payload.timestamp. The tick is a
protocol constant, exported as ROUND_TICK_MS: it is the same on every gateway and node, it is not
configurable, and GET /v1/info does not report it. Stamping does not wait for a tick boundary, so
it adds no latency. Committee selection reads only the timestamp's one-second window (ten ticks), so
nobody can pick a committee by picking a time.
keccak256(MOLPHA_MESSAGE_V1 || value || sourceId || u32be(registryVersion) || u8(quorum) || u64be(timestamp) || signersBitmap).maxAge/staleness are in seconds: compare with
timestampSeconds(payload.timestamp) (floored ts / 1000). timestampAgeSeconds(ts, nowSeconds) saturates at 0.payload.timestamp exactly as the gateway gave it. Nodes enforce the grid when
they sign; the on-chain verifiers do not check it.requestSignedData makes up to maxRetries attempts (default 6) and chooses the wait before each by why the last one failed (retryDelayMs). Every wait carries jitter so clients that failed together do not retry together. The backoff step is a capped exponential: 250 ms, 500 ms, up to 5 s.
| Last attempt | Wait before the next |
|---|---|
| 409 (this consumer already has a round for the source and quorum in the current tick) | one tick (ROUND_TICK_MS, 100 ms), plus up to 20 ms |
| 503 or 429 (gateway at capacity, or too few nodes accepted the round) | the later of the gateway's Retry-After and the backoff step, plus up to one more step |
| timeout, network error, other 5xx | the backoff step, half of it randomized |
| 400, 401, 402, 403 | none: terminal. 403 means the subscription is inactive or its round quota for the term is spent |
A 400 saying the registryVersion is not the current one (a cached context, or a registry roll between your read and the request) is the exception: the SDK reads the registry afresh and retries once, without spending an attempt.
The wait after a 409 is a full tick rather than the time left to the next boundary: a full tick puts the retry in a later tick whatever the offset between the client's clock and the gateway's, so the SDK never computes a boundary from the local clock. A caller polling one feed gains nothing by asking more often than once per tick: space the requests at least ROUND_TICK_MS apart.
A retry is a new request, and the gateway stamps it anew, so it is a new round: it spends another unit of round quota or needs another payment, and with a paywalled source another set of payment authorizations. Nothing ties a retry to the attempt before it; there is no idempotency key. Set maxRetries: 1 to make a single attempt and decide about a retry yourself.
The gateway limits the total load: at capacity it answers HTTP 503 with a Retry-After, and a consumer over its request rate gets HTTP 429. It also answers 503 when too few nodes accept a round. The SDK treats them alike: it backs off and retries, and throws a GatewayError with the status when the attempts run out.
timeoutMs defaults to 35 s, above the gateway's own wait for a round (roundTimeoutSeconds in /v1/info, 30 s by default). A shorter timeout abandons a round the gateway is still running, and the retry then starts another. A source that cannot be fetched is reported as soon as enough nodes have failed (usually well under a second), not after the wait.
wallet is a single MolphaWallet used across both protocol surfaces:
| Layer | What it signs |
|---|---|
| Solana client | Transactions such as subscribe, extendSubscription, submitAttestation |
| Gateway client | hashRequestAuth({ programId, gateway, sourceId, signaturesRequired, authTimestamp }) for authenticated gateway requests |
Gateway auth is resolved automatically when you use MolphaSDK:
wallet.signAuthMessage if provided.Wallet.payer when the secret key is available, such as with walletFromKeypairFile.authSig.MolphaSDK passes the resolved signer to sdk.gateway as its default, so
sdk.gateway.requestSignedData({ apiConfig, signaturesRequired }) authenticates without an
explicit signer. Standalone new MolphaGateway(...) omits auth unless you pass
a defaultSigner (third constructor arg) or per-call signer.
The all-zero authSig path is for development only: a gateway rejects it with 401. Production jobs should authenticate gateway requests.
import { walletFromKeypairFile } from "@molpha/sdk/utils";
const wallet = walletFromKeypairFile("~/.config/solana/id.json");
Find threats in your stack.
OX Radar can check high-priority threats, like critical package CVEs, against your context.
Each incident is marked Detected or Not Detected with a remediation plan and proof all tracked in the Response Center.
The probe returned only these fields for this server — auth requirement, protocol and tool list weren’t observed, so they’re not shown (never guessed).
The publisher’s own links, as the registry reports them. These are not sources for the assessment on this page.