This code demonstrates a minimal example of how to use the bevy game engine inside the RISC Zero zkVM.
First, follow the examples guide to install dependencies and check out the correct version of the example.
Then, run the example with:
cargo run --release
By using this demo as part of a Bonsai application, you could build an app where on-chain payment depends on off-chain gameplay. To learn more about this use case, check out our Twitter thread about using Bonsai as a zk coprocessor.
To link gameplay to a particular player, you may want to pair this demo with the ECDSA demo, which would allow a player to sign their moves.
zkVM applications are organized into a host program and a guest program.
The host program can be found in src/main.rs
and the guest program can be found in methods/guest/src/main.rs
.
The host first executes the guest program and then proves the execution to construct a receipt. The receipt can be passed to a third party, who can examine the journal to check the program's outputs and can verify the receipt to ensure the integrity of the guest program's execution.
For more information about building, running, and testing zkVM applications, see our developer docs.