RavenQuest
Smart contracts, NFTs and a Go backend for a Play2Earn blockchain game.
Lead Blockchain Developer, Backend Developer
ravenquest.io ↗
Overview
RavenQuest is a Play2Earn blockchain game, where users can buy land and build their own game. RavenQuest Whitepaper.
Backend made using Go. Website made using server-side rendering. Since RavenQuest is a Play2Earn blockchain game, the backend needs to integrate some blockchain elements in it:
- Multiple smart-contract using abigen bindings integration with the Go backend.
- NFT minting on-demand.
- Handle all assets metadata and all assets state to prevent out-of-sync issues between the game and the blockchain.
- Link between user-created accounts and their Immutable zkEVM Passport wallets.
- Integrations with some AWS systems such as SNS, SES and S3.
Land Sale
The land sale is just a land ownership sale, where users can buy an "ownership" spot on the game. A smart-contract was used for the sale, where users would pay with any ERC20 token and the contract will end emitting certain event, where the backend will then gather the event and insert specific information into the database.
Reading events is basically done with eth_getLogs and some specific filters (like block range for example). The thread runs on a ticker and periodically checks for new events that have not been processed before.
Since the sale was done on Polygon, blocks are not final, we can expect a fork, to ensure some security the thread only works with blocks that are at least 22 blocks deep on the chain. Since Polygon PoS average block time is around 2 seconds this is not a big deal.
The contracts managed around 300,000 USD. Handled chain interactions with around 1500 daily users.
NFTs
Users can interact with a multitude of NFTs inside the game. Minting is done through a specialized queue with a double signature system. One signature is handled by the backend and the other one is handled by the queue microservice, both using KMS. The signature follows the EIP-721 and is verified at the contract level using ecrecover.
The $QUEST Ecosystem token follows the ERC-20 standard, the project uses 6 decimals allowing us to store as a simple integer on any backend system. All operations are handled with the ItemVault and TokenVault contracts. There is also a couple more intermediary contracts that handle other user actions (like multi nft deposit into the vault).