
@lmprk/sdk
A dependency-light verifier for the LMPRK light client. Bring a StateProof and verifyProof re-derives the merkle root and checks it against the signed slot snapshot -- locally, with no RPC trusted. The same code runs in Node, Deno, Bun, and the browser.
import { verifyProof, type StateProof } from "@lmprk/sdk";
// A StateProof carries a signed slot snapshot + the merkle
// path for one account. You bring it from any transport.
const proof: StateProof = {
protocol: "lmprk/v1",
version: 1,
snapshot: {
head: { slot, blockhash, parentSlot, signerCount },
stateRoot,
validatorSetSize,
threshold,
},
address,
accountData, // hex-encoded account bytes
path: { steps: [] }, // merkle siblings, leaf -> root
};
const { valid, reason, computedRoot } = verifyProof(proof);
if (!valid) {
throw new Error("LMPRK: proof rejected -- " + reason);
}
const res = await fetch(
"https://api.lmprk.fun/verify/balance",
{
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ address }),
}
);
const { verified, balance_lamports, slot, proof } =
await res.json();
if (!verified) throw new Error("LMPRK: proof rejected");
The service emits the packed proof and self-verifies its aggregator signature server-side. The SDK is the portable verifier you embed when you want to re-check a StateProof yourself.
- verifyProof(proof: StateProof): VerifyResult
- hashLeaf(bytes) . hashNode(left, right)
- computeRoot(path, leaf) . foldStep(acc, step)
- pathDepth(path) . emptyPath() . proofByteSize(proof)
- hexToBytes(hex) . bytesToHex(bytes)
- StateProof . SlotSnapshot . SlotInfo . VerifyResult
- MerklePath . MerkleStep . HexString . Base58
- PROTOCOL_NAME = "lmprk/v1" . PROTOCOL_VERSION = 1
Full request/response reference at /docs.
verifyProof rejects unless the snapshot has enough signers and the recomputed root matches. Helius and QuickNode are accelerators behind the service, never authorities.
A proof is a slot snapshot plus a short merkle path. Cheap to push to mobile, browser extensions, or embedded clients.
Pure TypeScript with a portable hash fallback -- the same verifier runs in Node, Deno, Bun, and the browser. No extra service call to verify.