# Casper Network Developer Onboarding Guide Welcome to the **Casper Network Hackathon**! This guide will help you quickly get started building decentralized applications on Casper, an enterprise-grade proof-of-stake blockchain designed for real-world use cases. --- ## ๐Ÿš€ Quick Start: 3 Steps to Building on Casper ### 1. Set Up Your Environment **System Requirements**: Linux (Ubuntu 22.04+) or macOS recommended **Install Core Tools**: ```bash # Install Rust curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh # Add WebAssembly target rustup target add wasm32-unknown-unknown # Install Casper CLI tools cargo install casper-client cargo install cargo-casper ``` ### 2. Get Testnet Tokens - Generate keys: `casper-client keygen keys/` - Visit **[testnet.cspr.live](https://testnet.cspr.live)** to request test tokens from the faucet - Use the block explorer to monitor your transactions - The faucet gives 1000 Testnet CSPR per account. If you need more Testnet tokens for your project, please [submit a request](https://forms.gle/z3mF7ngVd7f5K19j7). ### 3. Choose Your Development Path Start building with the user-friendly Odra framework (recommended) or the native Casper Rust SDK for more control. You can also explore quick-start options like the [Lottery App demo](https://github.com/casper-ecosystem/lottery-demo-dapp), [CSPR.click](https://cspr.click) & [CSPR.cloud](https://cspr.cloud), or other [available SDKs](https://docs.casper.network/sdk) and starter templates to accelerate your development. **Option A: Odra Framework** (Recommended) ```bash cargo install cargo-odra --locked cargo odra new --name my-project cd my-project cargo odra build cargo odra test ``` **Option B: Native Casper Rust SDK** - Follow the official documentation at **[docs.casper.network](https://docs.casper.network/developers/writing-onchain-code/getting-started)** --- ## ๐Ÿ“š Essential Resources ### Core Documentation - **[odra.dev/docs](https://odra.dev/docs/)** - Smart contract framework documentation with tutorials - **[docs.cspr.click](https://docs.cspr.click)** - Wallet integration SDK for dApp frontends - **[docs.cspr.cloud](https://docs.cspr.cloud)** - Cloud services, RPC nodes, and infrastructure tools - **[docs.casper.network](https://docs.casper.network)** - Official Casper documentation, developer guides, and API references ### Development Tools - **[testnet.cspr.live](https://testnet.cspr.live)** - Block explorer, faucet, and account management - Top SDKs - [.NET SDK](https://github.com/make-software/casper-net-sdk), [TypeScript/JS SDK](https://github.com/casper-ecosystem/casper-js-sdk/), [Go SDK](https://github.com/make-software/casper-go-sdk) --- ## ๐Ÿ› ๏ธ Your Development Workflow ### Step 1: Write Smart Contracts Casper smart contracts are written in **Rust** and compiled to **WebAssembly (Wasm)**. **Using Odra Framework**: ```rust use odra::prelude::*; #[odra::module] pub struct Counter { value: Variable<u64>, } #[odra::module] impl Counter { pub fn increment(&mut self) { let current = self.value.get_or_default(); self.value.set(current + 1); } pub fn get(&self) -> u64 { self.value.get_or_default() } } ``` **Build and Test**: ```bash cargo odra build # Compile to Wasm cargo odra test # Test with OdraVM cargo odra test -b casper # Test with CasperVM ``` ### Step 2: Deploy to Testnet ```bash casper-client put-deploy \ --node-address https://node.testnet.casper.network/rpc \ --chain-name casper-test \ --secret-key keys/secret_key.pem \ --payment-amount 100000000000 \ --session-path target/wasm32-unknown-unknown/release/contract.wasm ``` ### Step 3: Build a Frontend with Wallet Integration **Quick Start with React**: ```bash npx create-react-app my-dapp --template @make-software/csprclick-react cd my-dapp npm start ``` **CSPR.click** provides seamless integration with all Casper wallets: - Casper Wallet - Ledger - MetaMask Snap - Wallet Connect See **[docs.cspr.click](https://docs.cspr.click)** for integration guides. --- ## ๐Ÿ”‘ Key Concepts ### Account Model Casper uses an account-based model where each account has: - **Public Key**: Your account identifier - **Private Key**: Used to sign transactions (keep secure!) - **Account Hash**: Derived from your public key ### Gas & Payment - All transactions require **CSPR tokens** for gas fees - Payment amount depends on computation complexity - Testnet tokens are free from the faucet ### Smart Contract Execution - Contracts are deployed as **stored contracts** on-chain - Call contracts using **entry points** (function names) - State is persistent between calls --- ## ๐Ÿงช Testing & Debugging ### Local Testing ```bash # Unit tests with Odra cargo odra test # Integration tests with CasperVM cargo odra test -b casper ``` ### Testnet Debugging - Monitor transactions on **[testnet.cspr.live](https://testnet.cspr.live)** - Check transaction status: `casper-client get-deploy --node-address http://NODE_IP:7777 <DEPLOY_HASH>` - View account state: Search your account hash on the block explorer --- ## ๐Ÿ“– Learning Resources ### Tutorials & Guides - **Odra Tutorials**: [odra.dev/docs/tutorials](https://odra.dev/docs/tutorials) - **Getting Started**: [docs.cspr.cloud/getting-started](https://docs.cspr.cloud/getting-started) - **Writing Smart Contracts**: [docs.casper.network/developers](https://docs.casper.network/developers) ### Example Projects - **NFT Contract**: https://github.com/casper-ecosystem/cep-78-enhanced-nft/ - **Fungible Token Contract**: https://github.com/casper-ecosystem/cep18 - **Lottery Demo dApp**: https://github.com/casper-ecosystem/lottery-demo-dapp - **Buy Me a Coffee dApp**: TBD ### Community Support - **Telegram**: Join the [Casper Developers Group](https://t.me/CSPRDevelopers) - **Forum**: [Casper developer forum](https://forum.casper.network/c/development/8) - **Casper Discord**: https://discord.com/invite/caspernetwork - **Odra Discord for Smart Contract Support**: https://discord.gg/Mm5ABc9P8k --- ## ๐ŸŽฏ Tips ### Project Ideas - **DeFi**: DEX, lending protocols, stablecoins, bridging, interoperability, liquid staking (including project that use contract staking functionality as a (secondary) yield generator for their app's deposited tokens) - **NFTs**: Marketplaces, gaming assets, digital collectibles - **DAOs**: Governance systems, treasury management - **Enterprise**: Supply chain, identity, tokenization - **Infrastructure**: Developer tools, oracles, bridges ### Best Practices 1. **Start Simple**: Build a minimal viable product first 2. **Test Thoroughly**: Use both OdraVM and [Casper NCTL Docker](https://github.com/make-software/casper-nctl-docker) for testing 3. **Document Well**: Clear README and code comments 4. **Use Testnet**: Deploy early and iterate 5. **Integrate Wallets**: Make your dApp user-friendly with CSPR.click ### Common Pitfalls to Avoid - Insufficient payment amounts (increase gas if transactions fail) - Not testing locally before deploying - Hardcoding node addresses (use environment variables) - Forgetting to fund Testnet accounts --- ## ๐Ÿ”— Quick Reference Links | Resource | Purpose | URL | |----------|---------|-----| | **Odra Framework** | Smart contract development | [odra.dev/docs](https://odra.dev/docs/) | | **Wallet SDK** | Frontend integration | [docs.cspr.click](https://docs.cspr.click) | | **Cloud Services** | RPC nodes & infrastructure | [docs.cspr.cloud](https://docs.cspr.cloud) | | **Testnet Explorer** | Block explorer & faucet | [testnet.cspr.live](https://testnet.cspr.live) | | **Official Docs** | Core documentation & guides | [docs.casper.network](https://docs.casper.network) | --- ## โœ… Pre-Flight Checklist - [ ] Install Rust and Casper CLI tools - [ ] Generate Casper keys - [ ] Get testnet tokens from faucet - [ ] Deploy a test contract to testnet - [ ] Create an account and auth keys on [CSPR.build](https://console.cspr.build) - [ ] Set up a basic frontend with CSPR.click - [ ] Join Casper developer community channels - [ ] Explore example projects on GitHub --- **Ready to build?** Start with CSPR.click for bootstrapping your project fast, and use CSPR.cloud to interact with the network. Use the Odra framework for the fastest path to deployment of the smart contracts, or dive into native Casper development for maximum flexibility. Good luck, and happy hacking! ๐Ÿš€ --- *For technical support, reach out on one of the community support channels or check the documentation links above.*