How Smart Contracts Work
Smart contracts are the "rules" of Citizen of Arcanis that run automatically on the blockchain. Think of them as a digital judge that never lies and never changes the rules.
What Are Smart Contracts?
Simple Explanation
Imagine a vending machine:
You put money in
You select a product
The machine automatically gives you the product
No human needed to operate it
Smart contracts work the same way:
You perform an action in the game
The smart contract checks if it's valid
The contract automatically updates the game state
No game company needed to approve it
In Citizen of Arcanis
Every action you take goes through smart contracts:
Creating your character
Fighting enemies
Trading items
Joining factions
Why Use Smart Contracts?
Trust and Transparency
No cheating: Rules can't be changed secretly
Always fair: Same rules apply to everyone
Transparent: Anyone can verify what happened
Permanent: Your achievements can't be deleted
True Ownership
Your items are really yours: Stored on blockchain, not company servers
Can't be taken away: No one can confiscate your items
Trade freely: Sell to anyone, anywhere
Keep forever: Items exist even if game company disappears
The Technology Stack
Starknet Blockchain
Fast: Quick transaction processing
Cheap: Low fees for game actions
Secure: Protected by advanced cryptography
Scalable: Can handle many players
Cairo Programming Language
Efficient: Uses less computational resources
Secure: Built-in safety features
Provable: Mathematical verification of correctness
Dojo Framework
Game-focused: Built specifically for blockchain games
Easy development: Simplifies smart contract creation
Optimized: Efficient for game mechanics
How Actions Work
Example: Attacking an Enemy
You click "Attack" in the game interface
Transaction sent to Starknet blockchain
Smart contract receives your attack command
Contract checks:
Do you have enough energy?
Are you in combat range?
What weapon are you using?
Contract calculates damage based on your stats
Contract updates:
Enemy's health
Your experience points
Any item drops
Result displayed in the game interface
Example: Trading an Item
You list item for sale on marketplace
Smart contract creates a trade offer
Another player accepts the trade
Contract automatically:
Transfers item to buyer
Transfers payment to seller
Updates ownership records
Trade completed without any middleman
Game State on Blockchain
What's Stored
Every important piece of game data lives on the blockchain:
Character Data
Health, attack, defense stats
Experience points and level
Faction membership
Location in game world
Item Data
What items you own
Item stats and rarity
Item history and previous owners
Game Events
Combat results
Trading history
Quest completions
Faction activities
Data Structure
Player {
id: unique_identifier
health: current_health_points
attack: attack_power
defense: defense_rating
experience: total_experience
faction: chosen_faction
}
Item {
id: unique_item_identifier
owner: player_who_owns_it
item_type: weapon/armor/vehicle/pet
rarity: common/rare/epic/legendary
stats: specific_item_bonuses
}
Benefits for Players
Permanent Ownership
Items stored on blockchain forever
Can't be accidentally deleted
Survive game updates and changes
Transparent Economy
See all market transactions
Verify item authenticity
Track market trends and prices
Cross-Game Potential
Items could work in other games
Build reputation across platforms
Investments have lasting value
Community Control
Players can verify game fairness
Community can propose changes
Democratic governance possible
For Non-Technical Players
You don't need to understand the technical details to play! The game interface handles all the complex blockchain interactions. You just:
Connect your wallet (like logging in)
Play the game normally
Your actions automatically use smart contracts
Enjoy true ownership of your achievements
Think of it like using email - you don't need to understand internet protocols to send messages, but the technology makes it possible for your emails to reach anyone in the world securely.
Last updated