Finds Solana on-chain programs that depend on elliptic-curve and other quantum-vulnerable public-key cryptography (curve syscalls, RSA-style modular exponentiation and signature precompiles).
cargo build --release
# 1. Pull program metadata and ELFs from an RPC node (resumable: existing ELFs are skipped)
./target/release/pqready fetch --rpc https://api.mainnet.solana.com --out data/raw
# metadata only, fast first pass:
./target/release/pqready fetch --rpc https://api.mainnet.solana.com --out data/raw --skip-elfs
# 2. Scan
./target/release/pqready scan --raw data/raw --out data/scan
# Validate on a single binary
./target/release/pqready scan-one data/raw/elf/<program-id>.so
# 3. Inspect
./target/release/pqready inspect data/raw/elf/<program-id>.so 0x15e0 --before 4 --after 30
# 4. Profile
./target/release/pqready profile --raw data/raw --scan data/scan --out data/profile \
--rpc https://api.mainnet.solana.com [--labels labels.csv --sort-by authority_flagged_programs]Node requirement: --account-index program-id, otherwise getProgramAccounts on the loaders scans the whole accounts DB and may time out.
raw/programs.csv: program ID, loader version, ProgramData address, deploy slot,upgradeable, upgrade authority, status (deployed/closed/retracted/finalized), ELF length and SHA-256, fetch slot.raw/elf/<program-id>.so: the ELFs.scan/scan_summary.csv: one row per program: parse status and notes, the strongest confidence of its quantum-vulnerable and post-quantum evidence (vulnerable,post_quantum), whether it compares the Instructions sysvar, vulnerable precompile IDs present but unused (with the rule that says so), Keccak constants, unresolved static-call hashes, indirect calls, unknown imports.scan/vulnerable.csv: one row per piece of evidence for quantum-vulnerable crypto: kind (syscall,precompile_ref,inline_pieces), name, confidence (confirmed,review,weak), how it was found (relocation, static call, or the precompile rule), count, selectors (curve IDs or BN254 operations), sites the analysis couldn't decide (unknown_selector_sites,unknown_argument_sites,unreachable_sites), and the inline pieces matched.scan/pq.csv: one row per piece of evidence for a post-quantum implementation: kind (tablein data,constantas an immediate), scheme (ML-DSA, ML-KEM, FN-DSA, or the constant's name), confidence (confirmedfor tables,weakfor constants); for tables, the stored form, address, windows matched and reachable code references; for constants, the value and how often it occurs.profile/profile.csv: one row per program with confirmed or review-level vulnerable evidence, or a confirmed PQ implementation: name and source links from security.txt or the on-chain IDL,vulnerableandpost_quantumconfidence, crypto roles and coarse uses, PQ implementations found, upgrade authority and its kind (key/pda), how many programs that authority controls and how many are profiled, plus any--labels,--reviewsand--activitycolumns.profile/authorities.csv: one row per upgrade authority over all programs: kind, programs controlled, profiled programs controlled, and labels matched by authority.
labels.csv is an optional input to pqready profile. It has a label column plus either a program_id or an authority column. Any other columns are copied into profile.csv with a label_ prefix:
authority,label
<upgrade authority address>,Example Labsprogram_id,label,category
<program address>,Example DEX,dexRows are matched by program_id first, then by upgrade_authority. One row keyed by an authority therefore labels every program that authority controls, which is useful given how authorities cluster in authorities.csv. It must be filled using known team names, security.txt contacts that pqready profile has already shown, or public program registries.
-
Parsing: ELFs are parsed with goblin. When the dynamic tables lie outside the loaded segments, they are read from the section headers instead;
parse_noteinscan_summary.csvsays so. Code is taken from executable sections when section headers exist, otherwise from executable segments. -
Call sites: code is decoded into instructions and a control-flow graph per function (
sbpf.rs). Syscall calls are identified by relocation (legacy:R_BPF_64_32against an undefined symbol) or by static-syscall hash (callwith src = 0, imm = murmur3_32(name)). Unknown hash-like immediates are reported, not dropped. -
Constants (
constprop.rs): constant propagation within functions and across direct calls, so values passed through non-inlined wrappers are traced to their callers.lddwvalues are taken after relocation; additions and subtractions of constants are modelled for every SBPF version except V2, whose encodings differ. A value that is not constant on every path is unknown, never guessed. -
Selectors: for
sol_curve_*(curve ID) andsol_alt_bn128_*(operation), the set of constants r1 can hold at the call. A site where any path gives a non-constant value counts asunknown_selector_sites. -
Reachability: roots are the entry point, exported functions and functions whose address is taken (relocations,
lddwconstants). Syscall sites not reachable from a root through direct calls count asunreachable_sites(possible dead code).indirect_calls(callx) marks programs where missed address-taken functions could make selector sets incomplete. -
Precompile IDs (
precompile.rs): for the Ed25519, secp256k1 and secp256r1 precompiles, the ZK ElGamal proof program and the Instructions sysvar, the scanner finds each ID's 32 bytes in loadable data and its four 8-byte pieces as inline constants, then classifies what reachable code does with them. In order:key_list: the ID sits in a run of at least 20 built-in program and sysvar IDs, and no code refers to its own entry or builds it inline;id_compared: a 32-byte compare of the ID, throughsol_memcmp_or a function that forwards its arguments to it, or all four inline pieces compared within one function;id_passed: the ID and the length 32 passed to another function;referenced: any other use of the ID's address;bytes_unreferenced: the bytes are present and nothing uses them.
A signature precompile counts as
quantum_vulnerableonly when it is compared and the program also compares the Instructions sysvar, which is the pattern of instruction introspection. ZK ElGamal counts when compared.id_passedandreferencedarereview; the rest aremarker. -
Post-quantum implementations (
pqtables.rs): the NTT tables of ML-DSA, ML-KEM and FN-DSA (Falcon), searched for in loadable data in every stored form (order, domain, entry width), givepq_implementationrows. Keccak round constants are amarker. Moduli found only as instruction immediates areweakleads, reported and never counted.
- Cross-reference the syscall name list in
src/syscalls.rsagainst Agave's registry for the scanned release. Missing names surface asunknown_importsor unresolved hashes, not as silent misses. - Double-check account layouts in
src/fetch.rs(upgradeable ProgramData header = 45 bytes; loader-v4 header = 48 bytes, status codes). - Re-check the selector constants against the releases in use: curve IDs (
solana-define-syscall) and BN254 operations (solana-bn254). - Verify the static-syscall encoding for the SBPF versions in use (
e_flagsis recorded). - Check the printed total: it must equal the distinct programs with a
quantum_vulnerablerow independencies.csv, and the programs inscan_summary.csvwith vulnerable counts above zero. - Spot-check precompile rows by hand with
scan-oneandinspect, especially those found only through inline pieces. - Count distinct ELF hashes (
elf_sha256inprograms.csv) next to programs, so mass-deployed copies of one binary are visible. - Check known positives: a ZK Compression program (alt_bn128), a bridge core (secp256k1), a passkey wallet (secp256r1), Token-2022 (ZK ElGamal).
- Base-layer signatures are out of scope. Every Solana account and upgrade authority is an Ed25519 key, checked by the runtime before any program runs. The census measures the crypto that programs use themselves, so it is a lower bound on exposure.
- Unparsed programs yield no precompile rows. Byte matches alone prove nothing, so a program the scanner cannot parse gets syscall-free, precompile-free output and an error in
scan_summary.csv. - Only loadable data counts. An ID's bytes in an executable segment, an unloaded section or symbol data are not reported. The earlier byte search counted them.
- Introspection is decided per program, not per code path. A sysvar compare anywhere in the program satisfies the rule for every signature precompile it compares.
- The analysis is conservative. Values through memory, indirect calls (
callx) and SBPF V2 arithmetic are unknown, never guessed. Undecided sites are counted (unknown_selector_sites,unknown_argument_sites) so that their share is visible. - PQ detection finds stored tables. An implementation that computes its tables at run time, or stores them in a form not searched, appears only as
weakleads, if at all.