opeq Docs

SDK

@opeqlabs/sdk 0.1.0. Beta, not yet externally audited: start with small amounts.

Overview

The OPEQ SDK puts quantum-resistant accounts into your own code. An OPEQ account is controlled by one-time hash-based keys (WOTS+ in a Merkle tree of 1024 keys) instead of an elliptic-curve key, so a quantum computer that breaks Ed25519 or secp256k1 does not break it.

It is the same code the OPEQ wallet runs. The library is copied byte for byte from the wallet, and the test suite fails if the two ever differ. It has no dependencies and is open source under the Apache 2.0 license.

Networks
Solana, Ethereum, Base, Arbitrum, Robinhood Chain and Elysium
Accounts
Create, recover from 24 words, activate or set up, send, run any transaction, rekey
Verification
Check any OPEQ signature offline, with no network calls
Runs in
Node.js 20 or later, and any current browser
Source
github.com/Sercan0x/opeq/tree/main/sdk
Package
npmjs.com/package/@opeqlabs/sdk

Install

npm install @opeqlabs/sdk

In Node, keep the wallet in a FileStore. In a browser, use IdbStore. Both refuse to move a key counter backwards.

The npm scope is @opeqlabs. Packages under any other name are not ours.

The one rule

A one-time key must never sign twice. The SDK enforces this for you:

The SDK cannot see a second copy somewhere else. If the same 24 words are used on another device, that device must call useHere() first. It moves the account to a fresh key tree, and the old copy stops signing. Never restore a store from a backup to keep signing: recover from the words and call useHere() instead.

Solana

import { Vault } from "@opeqlabs/sdk";
import { FileStore } from "@opeqlabs/sdk/filestore";

const store = await FileStore.open("./opeq-wallet");
const vault = new Vault({
  rpcUrl: "https://your-solana-rpc",
  checkRpcUrl: "https://a-second-provider",
  network: "mainnet",
  store,
});

const { id, words } = await vault.create(password);
const acct = await vault.open(id, password);

await acct.feeKey();
await acct.activate();
await acct.send(to, 1_000_000n);
await acct.execute([instruction]);
await acct.rekey();

acct.close();
await store.close();

EVM

const acct = await vault.open(id, password);
const base = await acct.evm(8453, {
  rpcUrl: "https://your-base-rpc",
  checkUrl: "https://a-second-base-rpc",
});

await base.setup();
await base.send(to, 10n ** 16n);
await base.execute([{ to: token, value: 0n, data: "0xa9059cbb..." }]);

acct.close();
1
Ethereum
8453
Base
42161
Arbitrum
4663
Robinhood Chain
99901
Elysium, gas in HYPE

Verify offline

import { verifySolanaInstruction, verifyEvmExecute } from "@opeqlabs/sdk";

verifySolanaInstruction(data, accountKeys, { pubSeed, root, aid, epoch });
verifyEvmExecute(calldata, { chainId, account, epoch, pubSeed, root });

Both return the one-time key index, or null if the signature does not match or the input is malformed. They make no network calls, so anyone can check that a transaction was signed by an OPEQ account without trusting OPEQ, an RPC or a block explorer.

Speed

Building a key tree takes about 2 seconds on Solana and about 10 seconds on EVM in Node on a laptop. Signing takes under a second. EVM setup() builds three trees, so it takes about a minute. In a browser, hand the work to a Web Worker with @opeqlabs/sdk/compute so the page does not freeze.

RPC

Bring your own: two per network, from different providers, over https. rpc.opeq.io only serves the OPEQ apps.

Status

Tests

The JavaScript code is checked against vectors from an independent Python implementation, and every result must be byte-identical. End-to-end tests run full accounts on a local EVM chain and on Solana devnet, and an attack suite replays the issues found in the security review before release. The commands are in the README.