How scio-labs/inkathon works
Main Components
• Smart Contracts & Blockchain Interaction:
• The “contracts” directory houses the Rust/ink! smart contracts.
• Deployment scripts, Cargo.toml files, and deployment artifacts (like WASM binaries, JSON metadata, and deployment scripts) orchestrate contract compilation, type-generation (via typechain-polkadot), and deployment to a Substrate-based chain.
• Local deployment is facilitated by scripts that build and deploy these contracts onto a Substrate Contracts Node.
• Frontend Application:
• The “frontend” directory contains a Next.js application that serves as the user interface.
• It includes UI components (both generic and web3-specific) for connecting wallets, displaying chain info, and interacting with the smart contract.
• Configuration files (environment variables in .env, tailwind config, etc.) and components indicate that the UI is built with React, TypeScript, and tailwindcss while using shadcn/ui components.
• Infrastructure & Deployment:
• Dockerfiles (for both contracts and frontend) and docker-compose files are provided for containerized deployments.
• There's a monorepo structure managed by pnpm workspaces (with separate package.json files in the root, contracts, and frontend) which adds an extra layer of dependency management and build orchestration.
• Development & Tooling:
Relationships and Interactions
• The smart contract lifecycle starts with development in the “contracts” directory, goes through build scripts (pnpm run build) to generate artifacts, and is then deployed (via pnpm run deploy) onto the blockchain node.
• Environment configuration plays a vital role: for example, the frontend reads environment variables (configured in the .env file) to decide which deployed contract addresses to interact with.
• Docker components should be included to illustrate the containerized deployment of both frontend and contracts node.
Architectural Patterns and Design Principles
• Monorepo Architecture: Clearly separate the system into “contracts” and “frontend” packages with their own dependency trees.
• Separation of Concerns: Show how the blockchain backend (smart contracts) is decoupled from the UI logic and is interacted with through well-defined APIs (contract interactions via hooks).
• Type-Safe Contract Generation: Emphasize the use of tools like typechain-polkadot to bridge Rust and TypeScript, ensuring type safety between contract artifacts and the frontend.
Relevant Technologies
• Backend/Contracts: Rust, ink!, cargo-contract, Substrate Contracts Node.
• Frontend: Next.js (app directory), React, TypeScript, Tailwind CSS, shadcn/ui, ESLint & Prettier.
• Infrastructure: Docker, Docker Compose, pnpm workspaces, and CI/CD workflows (GitHub Actions workflows).
• Web3 Integration: polkadot-js, useInkathon, and typechain-polkadot.
Final Touches
• Keep the user (or client) interactions in mind, displaying how the user inputs result in contract calls.
• Optionally, include additional development environment elements (like the VSCode workspace) to highlight how developers interact with the project during development.