This guide helps developers set up their environment to contribute to Citizen of Arcanis.
Node.js and npm
- Node.js 18+ recommended
- npm comes bundled with Node.js
- Used for frontend development
Rust and Cairo
- Rust programming language
- Cairo 2.10.1+ for smart contracts
- Scarb package manager for Cairo
Git
- Version control for code collaboration
- Required for cloning repositories
- Used for contributing code changes
VS Code
- Cairo extension for syntax highlighting
- Integrated terminal for commands
- Git integration for version control
Starknet Wallet
- Argent or Braavos for testing
- Needed for interacting with smart contracts
- Required for blockchain transactions
The project consists of three main repositories:
COA-Contracts/
├── src/
│ ├── models/ # Game data structures
│ ├── systems/ # Game logic contracts
│ ├── interfaces/ # Contract interfaces
│ └── helpers/ # Utility functions
├── scripts/ # Deployment scripts
└── Scarb.toml # Cairo project configuration
COA-Website/
├── src/
│ ├── app/ # Next.js pages
│ ├── components/ # React components
│ ├── hooks/ # Custom React hooks
│ └── context/ # State management
├── public/ # Static assets
└── package.json # Node.js dependencies
COA-landing/
├── src/
│ ├── components/ # React components
│ ├── pages/ # Application pages
│ └── assets/ # Images and styles
└── package.json # Node.js dependencies
# Clone the main contract repository
git clone https://github.com/SunsetLabs-Game/COA-Contracts.git
cd COA-Contracts
# Clone the website repository
git clone https://github.com/SunsetLabs-Game/COA-Website.git
cd COA-Website
# Clone the landing page repository
git clone https://github.com/SunsetLabs-Game/COA-landing.git
cd COA-landingFor Smart Contracts (COA-Contracts):
cd COA-Contracts
# Install Scarb if not already installed
curl --proto '=https' --tlsv1.2 -sSf https://docs.swmansion.com/scarb/install.sh | sh
# Build the project
scarb buildFor Website (COA-Website):
cd COA-Website
npm installFor Landing Page (COA-landing):
cd COA-landing
npm installSmart Contracts:
- Copy
dojo_dev.toml.exampletodojo_dev.toml - Update configuration for your development environment
- Set up Starknet RPC endpoints
Frontend Applications:
- Create
.env.localfiles in both website and landing directories - Add required environment variables:
- Firebase configuration
- Starknet network settings
- API endpoints
Build Contracts:
cd COA-Contracts
sozo buildDeploy to Local Network:
sozo migrateRun Tests:
scarb testExecute Contract Functions:
# Spawn a player
sozo execute dojo_starter-actions spawn --wait
# Move a player
sozo execute dojo_starter-actions move -c 1 --waitWebsite Development Server:
cd COA-Website
npm run devLanding Page Development Server:
cd COA-landing
npm run devBuild for Production:
npm run buildRun Linting:
npm run lintMaking Changes:
- Edit files in
src/directory - Build contracts with
sozo build - Test changes locally
- Deploy to testnet for integration testing
Common Tasks:
- Adding new game models
- Implementing game mechanics
- Creating new player actions
- Optimizing gas usage
Component Development:
- Create React components in appropriate directories
- Test components in development server
- Integrate with smart contracts
- Style with Tailwind CSS
Common Tasks:
- Building user interfaces
- Integrating wallet connectivity
- Implementing marketplace features
- Creating responsive designs
Unit Tests:
cd COA-Contracts
scarb testIntegration Tests:
- Deploy to local Starknet node
- Test contract interactions
- Verify game logic correctness
Component Tests:
npm run testEnd-to-End Tests:
- Test user workflows
- Verify wallet integration
- Check marketplace functionality
Naming Conventions:
- Use
snake_casefor variables and functions - Use
PascalCasefor structs and traits - Clear, descriptive names
Code Organization:
- Group related functions in traits
- Use modules for logical separation
- Document complex functions
Naming Conventions:
- Use
camelCasefor variables and functions - Use
PascalCasefor components - Use
kebab-casefor file names
Code Organization:
- One component per file
- Group related components in directories
- Use custom hooks for shared logic
Build Failures:
- Check Cairo version compatibility
- Verify Scarb.toml configuration
- Update dependencies if needed
Deployment Issues:
- Ensure sufficient account balance
- Check network connectivity
- Verify contract syntax
Node Module Issues:
- Delete
node_modulesand reinstall - Check Node.js version compatibility
- Clear npm cache if needed
Wallet Connection Issues:
- Verify wallet is properly configured
- Check network settings
- Ensure proper RPC endpoints
- Read the project documentation
- Set up development environment
- Join the community Discord/Telegram
- Look for "good first issue" labels
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
- Clear description of changes
- Reference any related issues
- Include tests for new functionality
- Follow code style guidelines
- Ensure all tests pass
Official Channels:
- Telegram: Technical discussions
- Discord: Community chat
- GitHub Issues: Bug reports and feature requests
Development Help:
- Review existing code for examples
- Check documentation for APIs
- Ask questions in developer channels
- Participate in community calls
Cairo Development:
- Starknet documentation
- Cairo language guide
- Dojo framework documentation
React/Next.js Development:
- React documentation
- Next.js guides
- TypeScript handbook
Welcome to the Citizen of Arcanis development community! Your contributions help build the future of blockchain gaming.