Skip to main content

๐Ÿ“œ 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.

๐Ÿ—๏ธ 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

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

Components should be small, focused data structures with no behavior.

Systems: Pure Logic Functions

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

Example 2: Inventory Management

๐Ÿงช Testing Your Contracts

Unit Testing Approach

Integration Testing

๐Ÿš€ Advanced Patterns

State Machines with Components

Event-Driven Architecture

๐Ÿ’ก 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