I need help. I have been trying to compile 5 smart contracts for weeks now so I can make my dApp(s) live on the Midnight network. After fixing every compilation error known all of my contracts now say the same thing. Zkir returned non-zero exit status -4. I have tried everything on docs.midnight.network as well as every suggestion from Google search, Gemini, Microsoft copilot and others. Can someone tell me what I am doing wrong or what I need to do to fix this please?
Hey @Hughdownunda welcome, and sorry you’ve been stuck on this.
Zkir returned non-zero exit status -4 usually means the ZKIR proving-key step failed, not that Compact still has a syntax/type error. Same -4 on all five contracts usually points to the toolchain/environment (zkir binary blocked, bad install, arch mismatch, or low memory), not contract bugs.
Quick checks:
- Try compiling with
--skip-zk. If that succeeds, your contracts are fine and the failure is specifically in key generation. - Tell us your OS/arch and the output of
compact --versionandcompact compile --version. - Paste the full compiler output around the error (not only the last line).
- If you’re on macOS: open System Settings → Privacy & Security and allow
zkir/ the Compact binaries if they were blocked. - Then try a clean reinstall of a pinned compiler, e.g.
compact cleanthencompact update 0.31.1, and recompile.
Once we know whether --skip-zk works and what OS/versions you’re on, we can narrow this down quickly. or better still open an issue on the service desk
1.Try compiling with --skip-zk. If that succeeds, your contracts are fine and the failure is specifically in key generation. I guess it succeeded. It didn’t say anything.
2.Tell us your OS/arch and the output of compact --version and compact compile --version. Linux Ubuntu compact 0.5.2 compile 0.34.0
3.Paste the full compiler output around the error (not only the last line).
Compiling 2 circuits:
Circuit “registerPolicy”
Exception: zkir returned a non-zero exit status -4
- If you’re on macOS: open System Settings → Privacy & Security and allow zkir / the Compact binaries if they were blocked.
5.Then try a clean reinstall of a pinned compiler, e.g. compact clean then compact update 0.31.1, and recompile.