๐ Move Contract Development
Master the art of building scalable, secure Move smart contracts with Dubheโs Entity Component System
Prerequisites: Basic understanding of blockchain concepts and programming. Complete the blockchain basics guide if youโre new to blockchain development.
๐ฏ What Youโll Learn
ECS Patterns
Build contracts using Entity Component System architecture
Move Best Practices
Write secure, gas-efficient Move code
Schema-Driven Development
Generate contracts automatically from schema definitions
๐ Development Overview
Dubhe transforms traditional smart contract development by introducing Entity Component System (ECS) architecture to blockchain applications. Instead of monolithic contracts, you build modular, composable systems.- Traditional Approach
- Dubhe ECS Approach
๐๏ธ Development Workflow
1
Design Your Game Schema
Start with data structure design - this drives everything else.
Schema-First Development: Your schema definition automatically generates Move contracts, TypeScript types, and client SDK methods. This ensures type safety from blockchain to frontend.
2
Generate Base Contracts
Generated World Contract
Generated World Contract
3
Implement Game Logic
Focus on the unique parts - Dubhe handles the boilerplate.
4
Build and Test
๐งฉ Core ECS Concepts in Practice
Components: Pure Data Containers
Component Design Principles
Component Design Principles
Components should be small, focused data structures with no behavior.
Systems: Pure Logic Functions
System Design Patterns
System Design Patterns
Systems are functions that operate on entities with specific component combinations.
๐ Detailed Tutorial Series
๐๏ธ Step-by-Step Contract Development
Part 1: Project Setup
15 minutes โข Initialize your Dubhe project, configure development environment, and understand the project structure.What youโll learn:
- Project initialization and configuration
- Development environment setup
- Understanding generated project structure
- Configuring for multiple blockchain networks
Part 2: Local Development
10 minutes โข Start a local blockchain node for rapid development and testing.What youโll learn:
- Starting local Sui/Aptos nodes
- Network configuration and connection
- Account management and funding
- Basic deployment workflow
Part 3: Contract Implementation
30 minutes โข Implement your first ECS-based game contracts with components and systems.What youโll learn:
- Schema design and code generation
- Component implementation patterns
- System function development
- Event emission for frontend integration
Part 4: Testing Strategies
25 minutes โข Write comprehensive tests for your Move contracts using Dubheโs testing framework.What youโll learn:
- Unit testing individual components and systems
- Integration testing with complete game scenarios
- Test data setup and teardown
- Performance and gas testing
Part 5: Deployment
20 minutes โข Deploy your contracts to testnet and mainnet with proper verification.What youโll learn:
- Testnet deployment and verification
- Mainnet deployment best practices
- Contract verification on explorers
- Post-deployment monitoring setup
๐ฎ Practical Examples
Example 1: Simple Combat System
- Schema Definition
- Generated Components
- Combat System Implementation
Example 2: Inventory Management
- Inventory Schema
- Inventory System
๐งช Testing Your Contracts
Unit Testing Approach
- Component Tests
- System Tests
Integration Testing
๐ Advanced Patterns
State Machines with Components
AI State Management
AI State Management
Event-Driven Architecture
Cross-System Communication
Cross-System Communication
๐ก Best Practices
Security Guidelines
Access Control
Always validate entity ownership before modifying components
Input Validation
Validate all function parameters and assert preconditions
Resource Management
Use Moveโs resource safety to prevent duplication and loss
Event Emission
Emit events for all important state changes
Performance Optimization
1
Minimize Component Size
Keep components small to reduce gas costs
2
Batch Operations
Process multiple entities in single function calls when possible
3
Optimize Queries
Structure your component queries for maximum efficiency
๐ฏ Next Steps
Start the Tutorial Series
Begin with project setup and work through each step
Join the Community
Get help from other developers and share your projects
Explore Examples
See a complete game implementation using these concepts
Advanced Concepts
Deep dive into ECS architecture patterns