Skip to content

Manav-Aggarwal/nes_emulator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RISC: Global Domination

Screen Shot 2023-11-12 at 11 21 03 AM

Cheating in video games has accelerated in advancement – now, players employ methods such as bots and software assistance to perform automated target acquisition and calibration, lag switches, and world-hacking. The vision of autonomous worlds is enabled only by provability of all in-game actions. Players must be able to prove ownership and milestone-based achievements in order for the autonomous world itself to create digital scarcity and programmable ruleset based environments independent of control from a centralized authority. In this project, we build the foundation for autonomous worlds by using Bonsai to prove gameplay.

A Nintendo Entertainment System (NES) emulator is a software that allows a computer, smartphone, or other device to emulate both the hardware and software of the original Nintendo Entertainment System. This enables the play of classic NES games on platforms other than the original NES console. The emulator translates NES game code so that it can run on modern devices.

RISC: Global Domination is a NES emulator that uses Risc0 Bonsai to generate proofs to verify gameplay. When the user plays the game, the NES emulator has a buffer that keeps track of all instructions executed. In this project, the CPU is the circuirt and the inputs are the operations. The host writes the input, reads the input, and applies the operated return. The host then passes the inputs to the prover. Later, the host can keep writing the CPU and operation to this. Functionally, the project creates a zk NES CPU with Bonsai.

This delivers the primary benefits:

  1. Preserve Fun and Functionality: There are two general approaches to on-chain gaming–crypto native games for crypto native gamers or replicating traditional games on chain. This project caters to the latter and is an example of maintaining playability of traditional games without needlessly inserting a token/tokenomics. It is simply proving reputation (in-game achievements, milestones, actions) of a game with which players are already familiar.

  2. Provability: Players can prove that in-game achievements and milestones were honestly accomplished without revealing how different milestones were achieved.

Acknowledgements Project inspired by Tonk’s Dappicom and to takahirox for nes-rust.

Screen Shot 2023-11-12 at 11 27 10 AM

RISC Zero Rust Starter Template

Welcome to the RISC Zero Rust Starter Template! This template is intended to give you a starting point for building a project using the RISC Zero zkVM. Throughout the template (including in this README), you'll find comments labelled TODO in places where you'll need to make changes. To better understand the concepts behind this template, check out the zkVM Overview.

Quick Start

First, make sure rustup is installed. The rust-toolchain.toml file will be used by cargo to automatically install the correct version.

To build all methods and execute the method within the zkVM, run the following command:

cargo run

This is an empty template, and so there is no expected output (until you modify the code).

Executing the project locally in development mode

During development, faster iteration upon code changes can be achieved by leveraging dev-mode, we strongly suggest activating it during your early development phase. Furthermore, you might want to get insights into the execution statistics of your project, and this can be achieved by specifying the environment variable RUST_LOG="executor=info" before running your project.

Put together, the command to run your project in development mode while getting execution statistics is:

RUST_LOG="executor=info" RISC0_DEV_MODE=1 cargo run

Running proofs remotely on Bonsai

Note: The Bonsai proving service is still in early Alpha; an API key is required for access. Click here to request access.

If you have access to the URL and API key to Bonsai you can run your proofs remotely. To prove in Bonsai mode, invoke cargo run with two additional environment variables:

BONSAI_API_KEY="YOUR_API_KEY" BONSAI_API_URL="BONSAI_URL" cargo run

How to create a project based on this template

Search this template for the string TODO, and make the necessary changes to implement the required feature described by the TODO comment. Some of these changes will be complex, and so we have a number of instructional resources to assist you in learning how to write your own code for the RISC Zero zkVM:

Directory Structure

It is possible to organize the files for these components in various ways. However, in this starter template we use a standard directory structure for zkVM applications, which we think is a good starting point for your applications.

project_name
├── Cargo.toml
├── host
│   ├── Cargo.toml
│   └── src
│       └── main.rs                        <-- [Host code goes here]
└── methods
    ├── Cargo.toml
    ├── build.rs
    ├── guest
    │   ├── Cargo.toml
    │   └── src
    │       └── bin
    │           └── method_name.rs         <-- [Guest code goes here]
    └── src
        └── lib.rs

Video Tutorial

For a walk-through of how to build with this template, check out this excerpt from our workshop at ZK HACK III.

Questions, Feedback, and Collaborations

We'd love to hear from you on Discord or Twitter.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages