|
| 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 |
| 85 | +targets: |
| 86 | + |
| 87 | +```bash |
| 88 | +make help |
| 89 | +``` |
| 90 | + |
| 91 | +Common development targets include: |
| 92 | + |
| 93 | +```bash |
| 94 | +# Basic builds |
| 95 | +make build # Debug build for development |
| 96 | +make build-release # Optimized build for production |
| 97 | +make check # Check code without building |
| 98 | + |
| 99 | +# Testing |
| 100 | +make test # Run test suite |
| 101 | +make test-release # Run tests in release mode |
| 102 | + |
| 103 | +# Code quality |
| 104 | +make format # Format all code |
| 105 | +make lint # Run static analysis |
| 106 | +make clean # Clean build artifacts |
| 107 | +``` |
| 108 | + |
| 109 | +### Environment Configuration |
| 110 | + |
| 111 | +Some components require environment variables: |
| 112 | + |
| 113 | +```bash |
| 114 | +# For SQLx database operations (heartbeats processor) |
| 115 | +export DATABASE_URL="sqlite:///tmp/heartbeats.db" |
| 116 | + |
| 117 | +# For archive node development |
| 118 | +export OPENMINA_ARCHIVE_ADDRESS="http://localhost:3007" |
| 119 | +export PG_USER="openmina" |
| 120 | +export PG_PW="openminaopenmina" |
| 121 | +export PG_DB="openmina_archive" |
| 122 | +``` |
| 123 | + |
| 124 | +## Architecture Overview |
| 125 | + |
| 126 | +For detailed information about OpenMina's architecture, Redux-style state |
| 127 | +machine pattern, and component organization, please see the |
| 128 | +[Architecture Documentation](./architecture.md). |
| 129 | + |
| 130 | +## Running OpenMina |
| 131 | + |
| 132 | +### Basic Node |
| 133 | + |
| 134 | +```bash |
| 135 | +# Run a basic node (after building) |
| 136 | +./target/release/openmina node --network devnet |
| 137 | +``` |
| 138 | + |
| 139 | +### Archive Node |
| 140 | + |
| 141 | +```bash |
| 142 | +# Set up PostgreSQL database |
| 143 | +make postgres-setup |
| 144 | + |
| 145 | +# Run archive node |
| 146 | +make run-archive |
| 147 | +``` |
| 148 | + |
| 149 | +### Development Server |
| 150 | + |
| 151 | +For web development with the frontend: |
| 152 | + |
| 153 | +```bash |
| 154 | +# Build and serve documentation |
| 155 | +make docs-serve |
| 156 | + |
| 157 | +# The documentation will be available at http://localhost:3000 |
| 158 | +``` |
| 159 | + |
| 160 | +## Debugging and Development Tools |
| 161 | + |
| 162 | +### Logging |
| 163 | + |
| 164 | +OpenMina uses structured logging with different levels: |
| 165 | + |
| 166 | +```bash |
| 167 | +# Set log level |
| 168 | +export RUST_LOG=debug |
| 169 | + |
| 170 | +# Run with verbose logging |
| 171 | +RUST_LOG=trace ./target/release/openmina node --network devnet |
| 172 | +``` |
| 173 | + |
| 174 | +### Frontend Development |
| 175 | + |
| 176 | +The project includes a web-based dashboard: |
| 177 | + |
| 178 | +```bash |
| 179 | +# Build and run frontend (see frontend/README.md for details) |
| 180 | +cd frontend |
| 181 | +npm install |
| 182 | +npm start |
| 183 | +``` |
| 184 | + |
| 185 | +### Testing Framework |
| 186 | + |
| 187 | +OpenMina includes a comprehensive testing framework: |
| 188 | + |
| 189 | +```bash |
| 190 | +# Build testing binary |
| 191 | +make build-testing |
| 192 | + |
| 193 | +# Run specific test scenarios |
| 194 | +./target/release/openmina-node-testing --help |
| 195 | +``` |
| 196 | + |
| 197 | +## Next Steps |
| 198 | + |
| 199 | +1. **Explore the Codebase**: Start with |
| 200 | + [Architecture Documentation](./architecture.md) |
| 201 | +2. **Run Tests**: Ensure your setup works by running `make test` |
| 202 | +3. **Join the Community**: Connect with other developers on |
| 203 | + [Discord](https://discord.com/channels/484437221055922177/1290662938734231552) |
| 204 | +4. **Read CLAUDE.md**: Check the project-specific development guide in the root |
| 205 | + directory |
| 206 | + |
| 207 | +## Getting Help |
| 208 | + |
| 209 | +- **Documentation**: |
| 210 | + [https://o1-labs.github.io/openmina/](https://o1-labs.github.io/openmina/) |
| 211 | +- **Discord**: |
| 212 | + [OpenMina Community](https://discord.com/channels/484437221055922177/1290662938734231552) |
| 213 | +- **Issues**: [GitHub Issues](https://github.com/o1-labs/openmina/issues) |
| 214 | +- **API Docs**: |
| 215 | + [Rust Documentation](https://o1-labs.github.io/openmina/api-docs/) |
| 216 | + |
| 217 | +Welcome to the OpenMina development community! 🎉 |
0 commit comments