# Building From Sources

### Prerequisites

- Linux x86_64 (Ubuntu 22.04+ recommended)
- CMake 3.16+
- C++17 compiler (GCC 11+ or Clang 14+)
- Boost 1.75+
- OpenSSL
- Conan package manager (installed automatically by Makefile)

```bash
# Ubuntu/Debian
sudo apt-get install build-essential cmake git libboost-all-dev libssl-dev pkg-config
```

### Clone and build

```bash
git clone https://github.com/lethean-io/blockchain.git
cd blockchain

# Testnet build
make testnet

# Mainnet build
make mainnet
```

### Build outputs

| Binary | Description |
|--------|-------------|
| `lethean-chain-node` | Blockchain daemon |
| `lethean-wallet-cli` | Wallet CLI (also serves as RPC server) |
| `lethean-chain-tool` | Chain utility (export/import) |
| `lethean-testnet-chain-node` | Testnet daemon (with `-DTESTNET=1`) |
| `lethean-testnet-wallet-cli` | Testnet wallet |

### Known issues

- **Wallet build requires TOR library** — the `tor-connect` submodule may not be available. Add `DISABLE_TOR=TRUE` to CMake flags if the wallet build fails.
- **Conan cache** — first build downloads dependencies via Conan. Subsequent builds use the cache.

### Release packaging

```bash
# After building:
make package
# Creates .tar.gz in build/packages/
```

### CI/CD

A Forgejo Actions workflow is available at `.forgejo/workflows/build-release.yml` for automated builds on tag push.

> **Verified:** Testnet and mainnet binaries built from source on Ubuntu 24.04 with GCC 14. Daemon builds clean, wallet build requires TOR workaround.
