Setup Guide
This guide helps developers set up their environment to contribute to Citizen of Arcanis.
Prerequisites
Required Software
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
Recommended Tools
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
Repository Structure
The project consists of three main repositories:
COA-Contracts (Smart Contracts)
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 (Marketplace)
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 (Landing Page)
COA-landing/
├── src/
│ ├── components/ # React components
│ ├── pages/ # Application pages
│ └── assets/ # Images and styles
└── package.json # Node.js dependencies
Setup Instructions
1. Clone the Repositories
# 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-landing
2. Install Dependencies
For 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 build
For Website (COA-Website):
cd COA-Website
npm install
For Landing Page (COA-landing):
cd COA-landing
npm install
3. Environment Configuration
Smart Contracts:
Copy
dojo_dev.toml.example
todojo_dev.toml
Update configuration for your development environment
Set up Starknet RPC endpoints
Frontend Applications:
Create
.env.local
files in both website and landing directoriesAdd required environment variables:
Firebase configuration
Starknet network settings
API endpoints
Development Commands
Smart Contracts
Build Contracts:
cd COA-Contracts
sozo build
Deploy to Local Network:
sozo migrate
Run Tests:
scarb test
Execute Contract Functions:
# Spawn a player
sozo execute dojo_starter-actions spawn --wait
# Move a player
sozo execute dojo_starter-actions move -c 1 --wait
Frontend Development
Website Development Server:
cd COA-Website
npm run dev
Landing Page Development Server:
cd COA-landing
npm run dev
Build for Production:
npm run build
Run Linting:
npm run lint
Development Workflow
1. Contract Development
Making Changes:
Edit files in
src/
directoryBuild 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
2. Frontend Development
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
Testing
Smart Contract Testing
Unit Tests:
cd COA-Contracts
scarb test
Integration Tests:
Deploy to local Starknet node
Test contract interactions
Verify game logic correctness
Frontend Testing
Component Tests:
npm run test
End-to-End Tests:
Test user workflows
Verify wallet integration
Check marketplace functionality
Code Standards
Smart Contracts (Cairo)
Naming Conventions:
Use
snake_case
for variables and functionsUse
PascalCase
for structs and traitsClear, descriptive names
Code Organization:
Group related functions in traits
Use modules for logical separation
Document complex functions
Frontend (TypeScript/React)
Naming Conventions:
Use
camelCase
for variables and functionsUse
PascalCase
for componentsUse
kebab-case
for file names
Code Organization:
One component per file
Group related components in directories
Use custom hooks for shared logic
Common Issues and Solutions
Smart Contract Issues
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
Frontend Issues
Node Module Issues:
Delete
node_modules
and reinstallCheck Node.js version compatibility
Clear npm cache if needed
Wallet Connection Issues:
Verify wallet is properly configured
Check network settings
Ensure proper RPC endpoints
Contributing Guidelines
Before Contributing
Read the project documentation
Set up development environment
Join the community Discord/Telegram
Look for "good first issue" labels
Making Contributions
Fork the repository
Create a feature branch
Make your changes
Test thoroughly
Submit a pull request
Pull Request Guidelines
Clear description of changes
Reference any related issues
Include tests for new functionality
Follow code style guidelines
Ensure all tests pass
Getting Help
Community Resources
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
Common Learning Resources
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.
Last updated