Skip to main content

One post tagged with "builder-spotlight"

View All Tags

Builder Spotlight: ScrollFighter

· 4 min read

Revolutionizing Async ZK Gaming with Zero-Knowledge Proofs

In this installment of our Builder Spotlight series, we delve into Scroll Fighter, an innovative asynchronous fighting game built on the Scroll network. Developed by Arjan, this project showcases the potential of zero-knowledge proofs in gaming while demonstrating the power and simplicity of Sindri's ZK proving API. You can play Scroll Fighter here or visit Arjan's github.

"I could just use a simple endpoint in my frontend to do the proof generation. I was surprised how easy Sindri was, and that it worked right away."

-Arjan

Project Overview

Scroll Fighter is an asynchronous fighting ZK game that leverages zero-knowledge proofs to create a fair and engaging player-vs-player experience. The game's unique mechanism allows players to commit strategies without revealing them, ensuring a level playing field and adding a layer of strategic depth to the gameplay.

Key Features and ZK Game Mechanics

  • Asynchronous, blockchain-based gameplay with strategic depth
  • ZK-proof secured strategy commitment for fairness
  • Three-round combat system with diverse fighter roster
  • On-chain verification using Sindri for seamless proof generation
  • Challenge, commit, reveal, and execute game flow

Technical Stack

  • Frontend: Next.js and React (created with Scaffold-ETH 2)
  • ZK Circuits: Noir for UX and circuit abstraction
  • Proving Infrastructure: Sindri API for efficient ZK proof generation
  • Blockchain: Smart contracts deployed on Scroll network
  • Data Indexing: The Graph for enhanced game state querying

Development Approach and Technological Impact

Arjan's creation of Scroll Fighter exemplifies a strategic approach to solo development in the blockchain gaming space. The project's success hinged on the careful selection and integration of key technologies that could meet the unique demands of an asynchronous, ZK-powered game.

Central to the development was the choice of zero-knowledge proof infrastructure. Arjan opted for a combination of Noir for writing ZK circuits and Sindri's performant, cloud-based proving platform for proof generation. This pairing proved a powerful accelerator, allowing for rapid iteration on game mechanics and development.

The blockchain gaming context presented unique challenges, particularly in terms of user experience. Scroll Fighter required a solution that could deliver low-latency, high-scalability proving to ensure a responsive and engaging gameplay flow. Sindri's API helped meet these requirements, facilitating proof generation and verification directly from the game's interface. This integration contributed to creating a gameplay experience that felt natural and immediate to users, aligning with the responsiveness expected in traditional gaming.

By leveraging Noir and the Sindri proving API, Arjan implemented ZK gaming capabilities typically associated with larger development teams. This democratization of powerful ZK developer tools and access to scalable infrastructure mirrors existing development environments, significantly advancing the ZK gaming and Web3 landscape.

The efficient workflow enabled by Noir and Sindri ZK proving API allowed Arjan to focus on core ZK game mechanics and user experience, not infrastructure. This strategy enabled the delivery of a complex, feature-rich ZK gaming application, demonstrating how solo developers can create innovative and competitive ZK games that rival projects from larger teams.

Sindri Integration

The below snippet demonstrates the straightforward process of generating and retrieving a zero-knowledge proof using Sindri's API and SDKs, showcasing its simplicity and efficiency in enabling a responsive gaming experience.

const circuitId = '21990165-2224-4446-8887-1261482ec5cd';

console.log('proving ', proofInput);
const proveResponse = await axios.post(`/circuit/${circuitId}/prove`, {
proof_input: proofInput,
});
console.log('proveResponse', proveResponse);
const proofId = proveResponse.data.proof_id;

// Polling for proof generation
while (true) {
proofDetailResponse = await axios.get(`/proof/${proofId}/detail`);
const { status } = proofDetailResponse.data;
if (status === 'Ready') {
console.log(`Polling succeeded after ${elapsedSeconds} seconds.`);
break;
}
// ... error handling and timeout logic
}
const circuitId = '21990165-2224-4446-8887-1261482ec5cd';

console.log('proving ', proofInput);
const proveResponse = await axios.post(`/circuit/${circuitId}/prove`, {
proof_input: proofInput,
});
console.log('proveResponse', proveResponse);
const proofId = proveResponse.data.proof_id;

// Polling for proof generation
while (true) {
proofDetailResponse = await axios.get(`/proof/${proofId}/detail`);
const { status } = proofDetailResponse.data;
if (status === 'Ready') {
console.log(`Polling succeeded after ${elapsedSeconds} seconds.`);
break;
}
}

What's Next

Scroll Fighter represents a significant step forward in blockchain-based gaming, demonstrating the potential of zero-knowledge proofs to create fair, engaging, and strategically deep experiences. Arjan's journey in developing this project highlights the power of strategic tool selection, the value of efficient development practices, and the impact of developer-friendly tools like Sindri in simplifying complex cryptographic implementations.

As we continue to explore the intersection of blockchain, gaming, and zero-knowledge technology, projects like ScrollFighter serve as inspiring examples of how solo developers can leverage cutting-edge tools to create innovative and competitive applications in the Web3 space.