DEV Community

lifeme2027
lifeme2027

Posted on

What KIP-16's Two ZK Modes Mean for .NET Developers (NKaspa FAQ)

Status & Disclaimer: NKaspa (0.1.11-alpha on NuGet) is alpha software. The public repository and NuGet metadata do not claim a security audit, and no public audit report was found. It is an MIT-licensed community .NET library (lifeme2027/NKaspa), not an official Kaspa SDK. This article is a developer FAQ, not investment advice and not a security-audit opinion. NKaspa has not implemented BN254 pairing or RISC0 STARK verification and cannot be used to confirm whether a ZK covenant is valid. Statements that KAS and non-ZK transactions are unaffected, and that node operators need no upgrade for this advisory, restate official public explanations published from 2026-11-23 onward. The remark that there are no known production ZK applications on mainnet is what the author of that analysis wrote at the time, not an independent census. A repair of 0x21 is described as a future hard-fork item; no activation date has been announced. Prefer testnet-10 and small amounts when experimenting.

If you use NKaspa only for addresses, BIP39 mnemonics, ordinary KAS payments, PSKT, or non-ZK scripts, official Kaspa explanations of the November 2026 RISC Zero advisory say you are not affected, and you do not need to upgrade a node or miner for this advisory.

This FAQ explains KIP-16's two Kaspa ZK modes (OpZkPrecompile tags 0x20 and 0x21), what changed after the RISC Zero Groth16 advisory, and the current boundary of NKaspa 0.1.11-alpha: BN254 pairing and RISC0 STARK verification are not implemented, and NKaspa does not claim to support ZK covenant verification.

Keep three version lines distinct. They are not interchangeable:

Line Current public version (as of 2026-12-01) What it is
Node release rusty-kaspa v2.1.0 (still the latest GitHub Release, published 2026-09-22) kaspad / official node
Rust development crates kaspa-txscript and kaspa-txscript-zk-sdk 2.2.0 (2.1.0 of both has been yanked; older kaspa-txscript 0.x versions remain listed) Builder / script SDK, not a node release
NKaspa 0.1.11-alpha Community .NET library. It is not the Rust 2.2.0 crate, and it was not patched in response to this advisory.

The RISC Zero Advisory, and Who Is Not Affected

Does this RISC Zero vulnerability affect KAS or ordinary transfers?

No. On 2026-11-11, RISC Zero published GHSA-g6qg-9j8p-7j87: under-constrained checks in the Groth16 wrapper and recursion circuit let an attacker who already has one valid Groth16 receipt substitute a chosen claim (including image ID, journal, and exit code) and still pass verification. Patched crates include risc0-zkvm 3.1.0 and risc0-groth16 3.0.6. Receipts produced by earlier versions do not verify under 3.1.0 and must be regenerated. Earlier affected crate versions were yanked from crates.io.

That is a RISC Zero proving-system issue, not a bug in Kaspa's consensus rules for ordinary transfers. Michael Sutton's 2026-11-23 analysis and the Kaspa Inline ZK docs state that KAS, all non-ZK transactions and covenants, and Kaspa's generic Groth16 verifier (0x20) are unaffected. Non-RISC Zero Groth16 systems (for example Circom, Noir, SP1, or custom circuits) that use the generic 0x20 path are likewise unaffected.

Do node operators or miners need to upgrade? Is a hard fork required?

No. The same official explanations say no hard fork and no node or miner upgrade is required for this advisory. The Kaspa-side fix shipped in development crates, not in a new node release. The latest official rusty-kaspa GitHub Release remains v2.1.0 (published 2026-09-22).

kaspanet/rusty-kaspa PR #1176 (opened by michaelsutton, merged 2026-11-23 23:55 Asia/Shanghai, merge commit 68bd2e91cddbdcdca5e59357344c7e26f2d6d97b) updated the Groth16 SDK to risc0-zkvm 3.1.0 / risc0-groth16 3.0.6, switched native STARK (0x21) verification onto the published kaspa-r0-recursion-legacy =0.1.0 port so the yanked 4.0.4 circuit stays byte-compatible for consensus, and made breaking Rust API changes: succinct builders were removed from the ZK SDK, and the legacy recursion re-export was removed from kaspa-txscript.

On crates.io, kaspa-txscript 2.2.0 and kaspa-txscript-zk-sdk 2.2.0 are published. The 2.1.0 release of each crate has been yanked. That is not the same as yanking every historical version: kaspa-txscript still lists older 0.x versions. kaspa-txscript-zk-sdk 2.2.0 depends on risc0-zkvm =3.1.0 and risc0-groth16 =3.0.6.

KIP-16's Two ZK Modes: 0x20 and 0x21

What are KIP-16's two ZK modes?

They are the two verification paths dispatched by OpZkPrecompile (opcode 0xa6) using a tag byte. KIP-16 (Status: Active) introduces that opcode and starts tags at 0x20 so they stay compatible with OpData stack operations. The current meaning of the two tags, as stated in Sutton's analysis and the official Inline ZK docs, is:

  • 0x20 — generic BN254 Groth16 (ZkTag::Groth16). The spending script supplies the verifying key, the proof, and the public inputs. This path is not tied to RISC Zero. L1 only runs a generic Groth16 check, so new verifying-key parameters can be introduced with a library upgrade and do not require a consensus change.
  • 0x21 — native RISC Zero STARK (ZkTag::R0Succinct). This path verifies a RISC Zero succinct receipt against a recursion circuit that Toccata pinned into consensus.

Do not read the older KIP-16 wording that describes 0x20 in terms of a RISC Zero image ID and journal as the current definition of that tag. The live protocol explanation is the generic Groth16 path above.

Why are 0x20 and 0x21 handled differently?

Because only 0x21 hardcodes an external proving-system circuit in consensus. In Toccata, carrying a recursion circuit of about 70 KB with every spend was impractical, so Kaspa pinned RISC Zero's 4.0.4 recursion circuit and control root into consensus. A consensus-pinned verifier cannot adopt the patched RISC Zero 3.1 circuit without a hard fork. Official docs therefore mark 0x21 as unsound and deprecated and tell builders not to use it for new deployments.

0x20 does not pin a proving-system circuit in consensus. The verifying key lives in the spending script, so RISC Zero Groth16 deployments that still use tag 0x20 can move to new parameters with an SDK and prover upgrade.

Has 0x21 been removed from the chain?

No. Official docs say the precompile remains enabled on-chain so existing UTXOs stay spendable (backed by kaspa-r0-recursion-legacy). The circuit itself is still unsound. Builders have been removed from kaspa-txscript-zk-sdk 2.2.0, and the mode should not be used for new deployments. A repair is described as planned for a future hard fork; timing depends on community demand and feedback, and no activation date has been announced.

What Builders Using RISC Zero Groth16 Should Do

If I am deploying a new RISC Zero Groth16 covenant, what should I do?

Do not use 0x21. New deployments should use generic Groth16 (0x20) with kaspa-txscript-zk-sdk 2.2.0 and RISC Zero 3.1.0, and they should generate fresh proofs. Those are Rust crate and prover versions, not an NKaspa package version. NKaspa has not been updated to "2.2.0" and does not implement the pairing check that would verify such a proof.

If you author covenants in Silverscript, official Kaspa docs say to use Silverscript v1.0.2 or later: r0.g16.verify was updated to the 2.2.0 SDK / RISC Zero 3.1.0 parameters, generic g16.verify is unchanged, and r0.succinct.verify is disabled at compile time. This FAQ does not take a position on whether Silverscript itself is "production ready"; it only records those version and builtin changes. Prefer testnet-10 while you experiment.

NKaspa is not a substitute for that Rust / Silverscript path. Its ScriptBuilder covenant helpers cover introspection opcodes. They do not provide kaspa-txscript-zk-sdk-style Groth16 or RISC Zero builders.

What This Means for NKaspa and .NET

Can NKaspa verify ZK covenants today?

No. NKaspa 0.1.11-alpha (public main at db56f276dfcc54a70bb675259ed61535e8211bce, 2026-11-03) has not implemented BN254 pairing or RISC0 STARK verification and does not claim to support ZK covenants. That is the library's existing capability set, not a follow-up patch for the RISC Zero advisory. As of 2026-12-01, public main is still on that commit.

What OP_ZKPRECOMPILE does in this release is the finalized tag, cost, and layout checks. After those structural checks succeed, the opcode returns ScriptErrorCode.Unimplemented and does not push true. The public test Structurally_valid_proofs_stay_unimplemented_and_do_not_succeed asserts the two messages:

  • OP_ZKPRECOMPILE Groth16 pairing is not implemented
  • OP_ZKPRECOMPILE RISC0 succinct receipt is not implemented

You can recognize that library limit through the public Script.VerifyScript overload that returns a ScriptError:

using NKaspa;

// scriptSig, scriptPubKey, tx, inputIndex, and utxos must already be in hand.
// This snippet only shows how to recognize the unimplemented pairing / STARK
// step. It does not construct or broadcast a covenant, and it does not mean
// the node would accept or reject the same spend.
if (!Script.VerifyScript(scriptSig, scriptPubKey, tx, inputIndex, utxos, out var error)
    && error?.Code == ScriptErrorCode.Unimplemented)
{
    // Expected messages after a structurally valid 0x20 or 0x21 layout:
    // "OP_ZKPRECOMPILE Groth16 pairing is not implemented"
    // "OP_ZKPRECOMPILE RISC0 succinct receipt is not implemented"
    Console.Error.WriteLine(error.Message);
}
Enter fullscreen mode Exit fullscreen mode

Transaction.Verify will also return false in that situation, but that API does not expose the ScriptError, so it is a poor way to tell an unimplemented cryptographic step from a real script failure.

One advanced layout detail, documented on ZkPrecompile: rusty-kaspa rejects a compressed point that has the right length but is not on the curve during ark deserialization, before the gamma charge. NKaspa cannot perform that check, so a well-sized invalid point may be charged and then fail closed as unimplemented. Do not treat that difference as "NKaspa verified the proof."

If I only send ordinary KAS, derive addresses, or use PSKT with NKaspa, do I need to change code?

Not because of this advisory. Official explanations say ordinary non-ZK usage is unaffected, and you do not need to upgrade a node for this advisory. Keep treating NKaspa as an alpha community library whose public repository and NuGet metadata do not claim a security audit, and prefer testnet-10. "No node upgrade is required for this advisory" is not the same statement as "NKaspa is production-ready."

To install the current prerelease:

dotnet add package NKaspa --version 0.1.11-alpha
Enter fullscreen mode Exit fullscreen mode

If local Transaction.Verify or Script.VerifyScript fails, did the chain also reject the spend?

Not necessarily. If the error is OP_ZKPRECOMPILE Groth16 pairing is not implemented or OP_ZKPRECOMPILE RISC0 succinct receipt is not implemented, the current NKaspa engine stopped before the cryptographic step. A Kaspa node still applies consensus rules for 0x20 and 0x21. A local unimplemented result is not a verdict that the spend is invalid or valid on-chain.

Are there production ZK applications on Kaspa mainnet?

This FAQ does not conduct a census and does not cite mainnet transaction ids. Sutton's 2026-11-23 article said that, as far as the author was aware at that time, there were no publicly known production ZK applications deployed on mainnet, and that ZK work was still mainly in development and on testnet. That is a dated, author-qualified remark, not an independent survey.

Links

Status & Disclaimer: NKaspa (0.1.11-alpha) is alpha software. The public repository and NuGet metadata do not claim a security audit, and no public audit report was found. It is an MIT-licensed community .NET library, not an official Kaspa SDK. It has not implemented BN254 pairing or RISC0 STARK verification and cannot confirm whether a ZK covenant is valid. Unaffected-KAS and no-node-upgrade wording restates official public explanations from 2026-11-23 onward. Prefer testnet-10.

Top comments (0)