This README includes instructions to install and play RISC Zero Battleship on your own machine. For more information about RISC Zero Battleship, check out the tutorials at www.risczero.com. For questions, find us on Discord.
RISC Zero Battleship is a 2-player hidden information game implemented in Rust on the NEAR Network.
Players produce proofs of game-state and the result of their actions to enable two players to play fairly with no intermediaries.
- Web UI (client)
- Prover web service
- NEAR smart contract
Follow the instructions for Yew Project Setup.
Install the near-cli:
npm install -g near-cli
Create a NEAR account: https://wallet.testnet.near.org/create
Deploy the NEAR smart contract (currently this is required due to risc0/risc0#116)
cargo run --bin risc0-build-methods
cd contract
cargo build --release
near dev-deploy target/wasm32-unknown-unknown/release/battleship_contract.wasm
NOTE: If you deploy your own smart contract, you'll need to update the code to point to this new contract.
See: https://github.com/risc0/battleship-example/blob/main/web/client/near.js#L16
Launch the web service:
cargo run --bin risc0-build-methods
cargo run --bin battleship-web-server --release
Launch the web client:
cargo run --bin risc0-build-methods
cd web/client
trunk serve --open
cargo run --bin risc0-build-methods
cargo test
- Every build of the guest code requires a new contract deployment. See: risc0/risc0#116.
- There's an issue with the near javascript API that prevents adjusting the contract allowance during sign in or when the game starts. This limits each game to only a few moves regardless of how much NEAR the account had.