Knowledge King is a knowledge game where player answers questions to earn on-chain rewards.
Knowledge King is a decentralized knowledge-sharing game where player answers questions to earn on-chain rewards. Players stake tokens to join quizzes, and winners receive rewards through automated smart contracts. The platform aims to gamify learning, encourage healthy competition, and ensure transparency using blockchain technology. All users are secured and verified on-chain.
We built Knowledge King using Foundry for smart contract development and testing, leveraging Solidity to implement the core game logic, including staking, rewards distribution. The front-end is powered by Next.js, providing a responsive and dynamic user experience. Players can interact with smart contracts directly from the UI using ethers.js. FastAPI serves as the backend, handling off-chain logic, managing user data, quiz generation, and verifying answers before interacting with the blockchain. The contracts deployed through Foundry ensure fast and reliable test cycles, while the combination of FastAPI and Next.js allows us to efficiently handle both on-chain and off-chain data. As a hacky but efficient solution, we use optimistic UI updates and off-chain caching to reduce latency and improve user experience while waiting for on-chain confirmations.