|  | 
|  | 1 | +--- | 
|  | 2 | +sidebar_position: 1 | 
|  | 3 | +--- | 
|  | 4 | + | 
|  | 5 | +# Getting Started for Developers | 
|  | 6 | + | 
|  | 7 | +import CodeBlock from '@theme/CodeBlock'; | 
|  | 8 | +import InstallRustSh from '!!raw-loader!../../scripts/setup/install-rust.sh'; | 
|  | 9 | +import InstallSystemDepsSh from '!!raw-loader!../../scripts/setup/install-system-deps.sh'; | 
|  | 10 | +import InstallNodejsSh from '!!raw-loader!../../scripts/setup/install-nodejs.sh'; | 
|  | 11 | +import InstallDockerSh from '!!raw-loader!../../scripts/setup/install-docker.sh'; | 
|  | 12 | +import InstallWasmToolsSh from '!!raw-loader!../../scripts/setup/install-wasm-tools.sh'; | 
|  | 13 | +import CloneAndBuildSh from '!!raw-loader!../../scripts/setup/clone-and-build.sh'; | 
|  | 14 | +import BuildSpecializedSh from '!!raw-loader!../../scripts/setup/build-specialized.sh'; | 
|  | 15 | +import RunTestsSh from '!!raw-loader!../../scripts/setup/run-tests.sh'; | 
|  | 16 | +import FormatAndLintSh from '!!raw-loader!../../scripts/setup/format-and-lint.sh'; | 
|  | 17 | + | 
|  | 18 | +Welcome to OpenMina development! This guide will help you set up your | 
|  | 19 | +development environment and build OpenMina from source. | 
|  | 20 | + | 
|  | 21 | +## Prerequisites | 
|  | 22 | + | 
|  | 23 | +### System Requirements | 
|  | 24 | + | 
|  | 25 | +- **Operating System**: Ubuntu 20.04+ or Debian 11+ (other Linux distributions | 
|  | 26 | +  may work but are not officially supported) | 
|  | 27 | +- **Memory**: At least 8GB RAM (16GB recommended) | 
|  | 28 | +- **Storage**: At least 20GB free space | 
|  | 29 | +- **Network**: Stable internet connection for downloading dependencies | 
|  | 30 | + | 
|  | 31 | +### Required Tools | 
|  | 32 | + | 
|  | 33 | +#### 1. Rust Toolchain | 
|  | 34 | + | 
|  | 35 | +OpenMina requires both stable and nightly Rust toolchains: | 
|  | 36 | + | 
|  | 37 | +<CodeBlock language="bash">{InstallRustSh}</CodeBlock> | 
|  | 38 | + | 
|  | 39 | +#### 2. System Dependencies | 
|  | 40 | + | 
|  | 41 | +<CodeBlock language="bash">{InstallSystemDepsSh}</CodeBlock> | 
|  | 42 | + | 
|  | 43 | +#### 3. Additional Development Tools | 
|  | 44 | + | 
|  | 45 | +**Node.js (for documentation and frontend):** | 
|  | 46 | + | 
|  | 47 | +<CodeBlock language="bash">{InstallNodejsSh}</CodeBlock> | 
|  | 48 | + | 
|  | 49 | +**Docker (optional, for containerized builds):** | 
|  | 50 | + | 
|  | 51 | +<CodeBlock language="bash">{InstallDockerSh}</CodeBlock> | 
|  | 52 | + | 
|  | 53 | +#### 4. WASM Tools (for web node development) | 
|  | 54 | + | 
|  | 55 | +<CodeBlock language="bash">{InstallWasmToolsSh}</CodeBlock> | 
|  | 56 | + | 
|  | 57 | +## Clone and Build OpenMina | 
|  | 58 | + | 
|  | 59 | +### 1. Clone the Repository and Build | 
|  | 60 | + | 
|  | 61 | +<CodeBlock language="bash">{CloneAndBuildSh}</CodeBlock> | 
|  | 62 | + | 
|  | 63 | +### 2. Specialized Builds | 
|  | 64 | + | 
|  | 65 | +For more advanced builds including release mode, WebAssembly, and specialized | 
|  | 66 | +components: | 
|  | 67 | + | 
|  | 68 | +<CodeBlock language="bash">{BuildSpecializedSh}</CodeBlock> | 
|  | 69 | + | 
|  | 70 | +### 3. Run Tests | 
|  | 71 | + | 
|  | 72 | +<CodeBlock language="bash">{RunTestsSh}</CodeBlock> | 
|  | 73 | + | 
|  | 74 | +## Development Workflow | 
|  | 75 | + | 
|  | 76 | +### Code Quality and Formatting | 
|  | 77 | + | 
|  | 78 | +OpenMina maintains strict code quality standards: | 
|  | 79 | + | 
|  | 80 | +<CodeBlock language="bash">{FormatAndLintSh}</CodeBlock> | 
|  | 81 | + | 
|  | 82 | +### Working with Makefiles | 
|  | 83 | + | 
|  | 84 | +The project's Makefile provides many helpful commands. View all available targets: | 
|  | 85 | + | 
|  | 86 | +```bash | 
|  | 87 | +make help | 
|  | 88 | +``` | 
|  | 89 | + | 
|  | 90 | +Common development targets include: | 
|  | 91 | + | 
|  | 92 | +```bash | 
|  | 93 | +# Basic builds | 
|  | 94 | +make build          # Debug build for development | 
|  | 95 | +make build-release  # Optimized build for production | 
|  | 96 | +make check          # Check code without building | 
|  | 97 | + | 
|  | 98 | +# Testing | 
|  | 99 | +make test           # Run test suite | 
|  | 100 | +make test-release   # Run tests in release mode | 
|  | 101 | + | 
|  | 102 | +# Code quality | 
|  | 103 | +make format         # Format all code | 
|  | 104 | +make lint           # Run static analysis | 
|  | 105 | +make clean          # Clean build artifacts | 
|  | 106 | +``` | 
|  | 107 | + | 
|  | 108 | +### Environment Configuration | 
|  | 109 | + | 
|  | 110 | +Some components require environment variables: | 
|  | 111 | + | 
|  | 112 | +```bash | 
|  | 113 | +# For SQLx database operations (heartbeats processor) | 
|  | 114 | +export DATABASE_URL="sqlite:///tmp/heartbeats.db" | 
|  | 115 | + | 
|  | 116 | +# For archive node development | 
|  | 117 | +export OPENMINA_ARCHIVE_ADDRESS="http://localhost:3007" | 
|  | 118 | +export PG_USER="openmina" | 
|  | 119 | +export PG_PW="openminaopenmina" | 
|  | 120 | +export PG_DB="openmina_archive" | 
|  | 121 | +``` | 
|  | 122 | + | 
|  | 123 | +## Architecture Overview | 
|  | 124 | + | 
|  | 125 | +For detailed information about OpenMina's architecture, Redux-style state machine pattern, and component organization, please see the [Architecture Documentation](./architecture.md). | 
|  | 126 | + | 
|  | 127 | +## Running OpenMina | 
|  | 128 | + | 
|  | 129 | +### Basic Node | 
|  | 130 | + | 
|  | 131 | +```bash | 
|  | 132 | +# Run a basic node (after building) | 
|  | 133 | +./target/release/openmina node --network devnet | 
|  | 134 | +``` | 
|  | 135 | + | 
|  | 136 | +### Archive Node | 
|  | 137 | + | 
|  | 138 | +```bash | 
|  | 139 | +# Set up PostgreSQL database | 
|  | 140 | +make postgres-setup | 
|  | 141 | + | 
|  | 142 | +# Run archive node | 
|  | 143 | +make run-archive | 
|  | 144 | +``` | 
|  | 145 | + | 
|  | 146 | +### Development Server | 
|  | 147 | + | 
|  | 148 | +For web development with the frontend: | 
|  | 149 | + | 
|  | 150 | +```bash | 
|  | 151 | +# Build and serve documentation | 
|  | 152 | +make docs-serve | 
|  | 153 | + | 
|  | 154 | +# The documentation will be available at http://localhost:3000 | 
|  | 155 | +``` | 
|  | 156 | + | 
|  | 157 | +## Debugging and Development Tools | 
|  | 158 | + | 
|  | 159 | +### Logging | 
|  | 160 | + | 
|  | 161 | +OpenMina uses structured logging with different levels: | 
|  | 162 | + | 
|  | 163 | +```bash | 
|  | 164 | +# Set log level | 
|  | 165 | +export RUST_LOG=debug | 
|  | 166 | + | 
|  | 167 | +# Run with verbose logging | 
|  | 168 | +RUST_LOG=trace ./target/release/openmina node --network devnet | 
|  | 169 | +``` | 
|  | 170 | + | 
|  | 171 | +### Frontend Development | 
|  | 172 | + | 
|  | 173 | +The project includes a web-based dashboard: | 
|  | 174 | + | 
|  | 175 | +```bash | 
|  | 176 | +# Build and run frontend (see frontend/README.md for details) | 
|  | 177 | +cd frontend | 
|  | 178 | +npm install | 
|  | 179 | +npm start | 
|  | 180 | +``` | 
|  | 181 | + | 
|  | 182 | +### Testing Framework | 
|  | 183 | + | 
|  | 184 | +OpenMina includes a comprehensive testing framework: | 
|  | 185 | + | 
|  | 186 | +```bash | 
|  | 187 | +# Build testing binary | 
|  | 188 | +make build-testing | 
|  | 189 | + | 
|  | 190 | +# Run specific test scenarios | 
|  | 191 | +./target/release/openmina-node-testing --help | 
|  | 192 | +``` | 
|  | 193 | + | 
|  | 194 | +## Next Steps | 
|  | 195 | + | 
|  | 196 | +1. **Explore the Codebase**: Start with | 
|  | 197 | +   [Architecture Documentation](./architecture.md) | 
|  | 198 | +2. **Run Tests**: Ensure your setup works by running `make test` | 
|  | 199 | +3. **Join the Community**: Connect with other developers on | 
|  | 200 | +   [Discord](https://discord.com/channels/484437221055922177/1290662938734231552) | 
|  | 201 | +4. **Read CLAUDE.md**: Check the project-specific development guide in the root | 
|  | 202 | +   directory | 
|  | 203 | + | 
|  | 204 | +## Getting Help | 
|  | 205 | + | 
|  | 206 | +- **Documentation**: | 
|  | 207 | +  [https://o1-labs.github.io/openmina/](https://o1-labs.github.io/openmina/) | 
|  | 208 | +- **Discord**: | 
|  | 209 | +  [OpenMina Community](https://discord.com/channels/484437221055922177/1290662938734231552) | 
|  | 210 | +- **Issues**: [GitHub Issues](https://github.com/o1-labs/openmina/issues) | 
|  | 211 | +- **API Docs**: | 
|  | 212 | +  [Rust Documentation](https://o1-labs.github.io/openmina/api-docs/) | 
|  | 213 | + | 
|  | 214 | +Welcome to the OpenMina development community! 🎉 | 
0 commit comments