Skip to content

Provable play of Nintendo Entertainment System in Noir

License

Notifications You must be signed in to change notification settings

0xSileo/dappicom

Repository files navigation

Dappicom Banner of a product box floating, it says "Provable NES emulator"

Dappicom — NES Emulation in Noir

Dappicom is a provable Nintendo Entertainment System emulator written in Noir and Rust. Practically, this is a zkvm which supports the MOS 6502 instruction set and a few NES specific quirks. The zkvm is built in Noir (we heard you liked zkvms, so we put a zkvm in your zkvm).

The project is in its early stages. There is a loose skeleton structure laid out which should make collaboration much easier moving forward, however like any kind of "architecting" there will be oversights and gaps. As the project matures those gaps will be filled in and oversights corrected.

What does that mean?

Hopefully, it means you can play NES ROMs on your local machine and then prove outcomes of that gameplay onchain to trigger downstream rewards/consequences. That's the end goal.

Using zero knowledge to prove off-chain compute effectively brings the result of that compute onto the blockchain when it is verified. Think of what you might want to do with NES gameplay when it's composable, permissionless and trustless.

Why are you doing this?

A whole bunch of reasons!

  1. Dappicom could bootstrap the onchain game catalog with retro games. Today (and despite enormous industry hype) there’s a dearth of actual onchain gaming content. Onchain games also come with a crypto learning curve. Playing NES games is simple, and there is a large catalog of ROMs. (Legally, we want to flag at this point that any ROMs you play on a NES emulator should be your legitimately-owned ROMs!)
  2. Dappicom widens the appeal of onchain games beyond a crypto-native audience. Dappicom doesn’t require a token and nor does it fit the play-to-earn model, which has a controversial reputation in gaming. To prove out the fully-onchain gaming category we need to cross the chasm beyond gamers who play games just to earn tokens. Dappicom could appeal to the retro gaming scene beyond crypto.
  3. Dappicom illustrates the power of provable gaming. Proving speedruns with hidden strategies has never been done before. Speedruns are often contested - for example, Dream’s controversial Minecraft speedrun. You can’t argue with maths, though.
  4. Dappicom can level-up developers in Noir. Noir and other ZK DSLs will be imporant parts of the future internet stack; it’s important to get developers up to speed. The project comes with plenty of documentation to get someone contributing right away. There will be extra material discussing best practices when writing Noir code.
  5. Dappicom stretches Noir in powerful ways. Dappicom shows that Noir has ambitions beyond being a DSL for Aztec protocol, and also has significant performance needs for Noir to match.

Also, it's fun - and the MOS 6502 is beautiful & historically significant.

How does it work?

See roadmap and product flow technical explainer

I want to contribute

That's great! We are actively seeking contributions and are grateful for your support. Please see the contribution guidelines to get started.

How to run

The NES emulator will require modifications to output the transcript and snapshot its state in a format most suitable for proving. In the interest of developer velocity, we have gone ahead and forked the tetanes project. For now, it's a submodule.

Performance is nearly 60fps when using the release build. When running the binary, you can load a test_rom or play the freeware roms in play_rom

cd tetanes

# make sure you have these installed
brew install sdl2 sdl2_gfx sdl2_image sdl2_mixer sdl2_ttf

cargo build
cargo run

Noir circuits should have tests being written for them. For those circuits that do have tests you can run them by installing Noir and then in the root folder for example (/circuits/cpu) run:

nargo test

Credits

Thanks to lukexor for open-sourcing their tetanes project, which is a feature rich NES emulator written in Rust.

Thanks to nesdev.org — an incredible resource, practically the single resource for all things NES.

Thanks to bugzmanov for their wonderful write-up on NES emulation in Rust and provided example code. This is a great beginners guide into writing a NES emulator in Rust.

Thanks to Frank Laub at Risc0 for discussions on zkvm design and feedback on proving MOS 6502 execution.

This project is funded by an Aztec grant. Without them it wouldn't happen :)

Illustration made by Hi-Bred and may only be used in this project.

About

Provable play of Nintendo Entertainment System in Noir

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Rust 75.2%
  • Roff 20.8%
  • TypeScript 2.4%
  • HTML 0.8%
  • JavaScript 0.3%
  • Shell 0.3%
  • Other 0.2%