Welcome back to our Weekly Developer Unit series!
In this 17th edition, we’re excited to delve deep into the backbone of our gaming universe — the Web3 system architecture and our approach to creating a DAO in the Metaverse.
In this section, we explore the intricate workings of Token Canisters within our Web3 gaming environment. These canisters are not just storage units for digital assets but are dynamic, programmable components that manage the intricacies of our game’s digital currencies — CXP, Neutrinos, and Spirals.
Core Canisters: The Foundation
At the heart of our system are the Core Canisters, each designed to handle specific functionalities:
This is where we manage user authentication and authorization, ensuring secure user sessions and token management.
- Handles user authentication and authorization.
- Maintains user sessions and security tokens.
Game Logic Canister
The epicenter of our gaming universe, containing all the core mechanics and inter-canister communication for validations.
- Contains the core game mechanics.
- Communicates with other canisters for validations.
User Profile Canister
Your digital identity and social networking features are managed here, in sync with the Authentication Canister.
- Manages user profiles and social networking features.
- Integrates with the Authentication Canister for secure access to user data.
- Manages proposals and voting for Neutrinos holders.
- Integrates with other canisters to implement governance decisions.
Token Canisters: The Economy Backbone
Here, we break down the core functionalities of the Token Canisters, highlighting their roles in transaction management, rule enforcement, and system interoperability. This part is crucial in understanding how these canisters integrate with the overall game architecture.
Token Canisters influence player engagement and the economic balance of the game.
Cosmicrafts Tokens (Separate for CXP, Neutrinos, and Spirals, etc)
Within the Internet Computer, each token type — CXP, Neutrinos, and Spirals — is managed by its dedicated Token Canister.
- Handles the ledger and transactions related to each token type.
- Manages token-specific rules, such as minting, burning, and staking.
This isn’t just about compartmentalization; it’s about creating specialized environments where each token can operate under its unique set of rules and functionalities.
NFT Management Canister
This canister orchestrates all NFT-related operations, from minting to staking, and interfaces with the Game Logic Canister for metadata assignments.
- Manages all aspects of NFTs, including minting, burning, transferring, and staking.
- Works with the Game Logic Canister to assign NFT Metadata values.
- Manages the staking of NFTs and tokens.
- Calculates rewards based on staked assets and and Economy Canister.
Reward and Economy Canister
- Distributes rewards, manages chests, quests, and rebates.
- Ensures economic balance and sustainability.
Supportive Canisters: Enhancing the Experience
- Facilitates trading of NFTs and tokens between players.
- Could integrate with external markets or ledgers if needed.
Quest Assignment Canister
- Randomly assigns quests to players.
- Manages quest completion and timing.
Cooldown and Timing Canister:
- Ensures that actions respect the necessary cool downs and timing restrictions.
- Acts as a timing oracle for other canisters.
Analytics and Reporting Canister:
- Gathers game data for analysis and reporting.
- Helps identify patterns and potential areas for improvement.
- For extra game settings, like speed, bullet speed etc.
- Provides tools to balance in the game-play difficulty.
Workflow DiagramSecurity and Scalability: Our Top Priority
In the blockchain technology, security isn’t just a feature; it’s a foundation. Our architecture here focuses on the robust security measures embedded within the Token Canisters.
It’s about building trust and ensuring that every transaction, every game move, is not only smooth but also secure and compliant with the highest standards.
- Access Control: Ensures that only authorized entities can make significant changes.
- Inter-canister Communication: Designed for secure and efficient data exchange.
- Audit Trails: Maintains transparency with logs of critical transactions and decisions.
- Decentralization of Power: Averts single points of failure by distributing control.
- Backup and Recovery: Robust mechanisms are in place for data safety.
- Data Sharding: For larger canisters, data is distributed to maintain efficiency.
- Upgradability: Our canisters are designed to evolve with our community’s needs.
Cost Analysis: Ensuring Affordability and Sustainability
The DFINITY Foundation has a cost model for cycles and they have provided some example costs for various operations on the Internet Computer.
These are relatively expensive operations because they involve network communication and consensus. Each call could cost on the order of 1 trillion cycles, depending on the payload size.
Update calls (write operations)
These are more costly than query calls because they modify the state and require consensus. The cost could be on the order of 10 million to 100 million cycles.
Query calls (read operations)
These are cheaper because they do not modify the state and do not require consensus. The cost might be around 1 million cycles per call.
Storing data costs cycles. The cost is based on the size of the data and the duration of storage. For example, storing 1 GB of data for a year might cost on the order of 200 billion cycles.
Here’s the breakdown of the estimated costs for each type of user interaction per session, along with the total costs in cycles and the equivalent in USD:
Cosmicrafts estimated costs per session
- Login: 10,000,000 cycles
- Database Queries (50 per session): 50,000,000 cycles
- Token Transfers (25 per session): 125,000,000 cycles
- Match Making Search: 8,000,000 cycles
- Claiming Rewards (8 per session): 32,000,000 cycles
- Staking Operations (staking, unstaking, restaking — 2 per session): 14,000,000 cycles
Total Cost Per Session in Cycles: 239,000,000 cycles
Equivalent in USD (assuming 1 trillion cycles = 1 USD): $0.000239
So, for each user session, the rough estimated cost is 239 million cycles, which equates to roughly 0.000239 USD
Looking Ahead: Evolution and Scalability
The future-proofing of Cosmicrafts DAO is vital. This concluding part addresses the adaptability and scalability of Canisters, for they remain effective and efficient as Cosmicrafts evolves and grows.
Wrapping Up Our Discussion on System Architecture
Cosmicrafts DAO architecture might seem complex, but at its core, it’s about creating a stable and functional environment for our players. Each canister we discussed — whether it’s for handling tokens, managing NFTs, or ensuring fair gameplay — is a crucial piece of this larger puzzle.
What’s important in our setup is how these canisters work together. This integration is key to making sure the system runs smoothly.
Looking ahead, we plan to keep refining these systems, making sure they’re as efficient and user-friendly as possible.
Stay Connected for More
Until next time, stay cosmic, and may the Celestial watch over you!