Nethereum.Zisk.Core
NuGet:
Nethereum.Zisk.Core| Source:src/Nethereum.Zisk.Core/
Nethereum.Zisk.Core
PREVIEW — This package is in preview. APIs may change between releases.
Managed runtime bindings for the Zisk zkVM. Used by guest binaries compiled to RISC-V that execute inside a zero-knowledge virtual machine.
Overview
Zisk is a RISC-V zkVM. A program's execution trace can be proven
cryptographically — the proof attests that f(public_input) == public_output
without re-running the program. Nethereum targets Zisk for stateless
block verification: the guest reads a witness (block + pre-state),
executes the EVM, and emits state-root / block-hash commitments.
Nethereum.Zisk.Core is the low-level guest-side runtime that wires
C# onto Zisk's execution environment:
ZiskInput— read the serialised input buffer (witness bytes) the prover supplies.ZiskIO/ZiskLog— structured text I/O for debugging the guest (stdout lines appear inziskemuruns; redacted in proof generation).ZiskOutput— write the public-output slots that become commitments. Typical slots: result flag, gas used, block hash, state root, transactions root, receipts root.ZiskMemoryMap— fixed memory-region constants (input, ROM, RAM, UART and output-register bases) matching the Zisk 1.1+ ELF layout, which puts a 4 MB stack and the system registers at the base of RAM:UartAddressis0xA0400200andOutputBaseis0xA0410000.ZiskBinaryReader/ZiskBinaryWriter— AOT-safe readers / writers over byte spans, replacingSystem.IO.BinaryReaderin the trimmed guest build.ZiskCrypto— P/Invoke surface for Zisk'szkvm_*accelerator API (keccak, sha256, ecrecover, modexp, bn254, bls12-381, blake2f, kzg, secp256r1, poseidon2). These map to CSR hardware instructions inside the zkVM for near-zero proving cost. Every accelerator returns azkvm_status(0is success); the pairing checks return their result through abool*:zkvm_bn254_pairing(byte[] pairs, nuint num_pairs, bool* verified)andzkvm_bls12_pairing(byte[] pairs, nuint num_pairs, bool* verified). The Poseidon2 permutation issyscall_poseidon2(ulong* state).ZiskKeccakHashProvider/ZiskSha256HashProvider—IHashProviderwrappers over the native keccak and sha256 accelerators.ZiskPoseidonHashProvider—IHashProviderwrapping the Poseidon2 accelerator (the nativesyscall_poseidon2entry point) for Goldilocks-field binary trie state roots. Width=16, rate=12, capacity=4, XOR-based sponge, 32-byte digest.Ripemd160— managed implementation used as a fallback when the Zisk P/Invoke isn't available.
Installation
This package is referenced by the Zisk guest binary at build time;
end users typically do not consume it directly. See
Nethereum.EVM.Zisk for the
EVM-on-Zisk bridge.
Dependencies
- A project reference to
Nethereum.Util— the hash providers (ZiskKeccakHashProvider,ZiskSha256HashProvider,ZiskPoseidonHashProvider) implement itsIHashProviderinterface (Nethereum.Util.HashProviders). System.Runtime.InteropServices(BCL) for the[DllImport]accelerator bindings.
The Zisk.Core code itself uses no LINQ, reflection, or BinaryFormatter,
keeping the guest side AOT- and trim-friendly.
Build Pipeline
The guest binary is built with bflat/NativeAOT cross-compiled to
RISC-V (via the nethereum/bflat-riscv64 Docker image) and linked
against libziskos.a. The build orchestration lives in
zisk/ at the repo root:
bash zisk/scripts/build-libziskos.sh # libziskos.a from the Zisk release tag
bash zisk/scripts/build.sh # source mode
bash zisk/scripts/build.sh --dll # DLL mode
See zisk/README.md for the full build,
proving, and verification flow.
See Also
Nethereum.EVM.Zisk— the EVM-on-Zisk bridge (binary witness entry point, witness-backed precompile backends).Nethereum.EVM.Core— the EVM engine source-shared into the Zisk guest.