# Synor Blockchain

Quantum-secure decentralized cloud computing platform built on DAG-based consensus.

## Features

- **Quantum-Resistant Cryptography**: Hybrid Ed25519 + Dilithium3 signatures (NIST FIPS 204)
- **DAG Consensus**: GHOSTDAG-based ordering for high throughput
- **Smart Contracts**: WASM-based execution with Rust SDK
- **Post-Quantum Security**: Future-proof against quantum computing threats

## Installation

### Desktop Wallet

Download the latest release for your platform:

| Platform | Download | Notes |
|----------|----------|-------|
| **macOS (Apple Silicon)** | `Synor-Wallet_x.x.x_aarch64.dmg` | Drag to Applications |
| **macOS (Intel)** | `Synor-Wallet_x.x.x_x64.dmg` | Drag to Applications |
| **Windows** | `Synor-Wallet_x.x.x_x64_en-US.msi` | Run installer (recommended) |
| **Windows (portable)** | `Synor-Wallet_x.x.x_x64-setup.exe` | Alternative installer |
| **Linux** | `Synor-Wallet_x.x.x_amd64.AppImage` | `chmod +x && ./` |

**First launch on macOS**: Right-click → Open (to bypass Gatekeeper if not code-signed)

### Node Daemon (synord)

Download pre-built binaries:

| Platform | Download |
|----------|----------|
| **Linux x86_64** | `synor-linux-x86_64.tar.gz` |
| **Linux ARM64** | `synor-linux-aarch64.tar.gz` |
| **macOS x86_64** | `synor-macos-x86_64.tar.gz` |
| **macOS ARM64** | `synor-macos-aarch64.tar.gz` |
| **Windows x86_64** | `synor-windows-x86_64.zip` |

```bash
# Extract and install (Linux/macOS)
tar -xzf synor-<platform>.tar.gz
sudo mv synord /usr/local/bin/
sudo mv synor-cli /usr/local/bin/

# Initialize and run
synord init --network testnet
synord run --network testnet
```

### Docker (Recommended for Nodes)

```bash
# Run a single node
docker run -d \
  --name synor-node \
  -p 17511:17511 \
  -p 17110:17110 \
  -p 17111:17111 \
  -v synor-data:/data/synor \
  synor/synord:latest \
  --network testnet

# Run multi-node testnet
./scripts/testnet-deploy.sh start
```

**Ports:**
| Service | Port | Description |
|---------|------|-------------|
| P2P | 17511 | Peer-to-peer network |
| HTTP RPC | 17110 | JSON-RPC API |
| WebSocket RPC | 17111 | WebSocket API |

## Build from Source

### Prerequisites

**All platforms:**
- Rust 1.75+ (`curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh`)

**macOS:**
```bash
brew install rocksdb cmake llvm node pnpm
```

**Ubuntu/Debian:**
```bash
sudo apt-get install -y librocksdb-dev libclang-dev cmake pkg-config libssl-dev
```

**Windows:**
```powershell
winget install Rustlang.Rustup Microsoft.VisualStudio.2022.BuildTools OpenJS.NodeJS.LTS LLVM.LLVM
npm install -g pnpm
```

### Build Node

```bash
# Clone repository
git clone https://github.com/g1-technologies/synor.git
cd synor

# Build all binaries
cargo build --release --workspace

# Binaries located at:
# ./target/release/synord      (node daemon)
# ./target/release/synor-cli   (CLI wallet)
```

### Build Desktop Wallet

```bash
# Install Tauri CLI
cargo install tauri-cli

# Build wallet
cd apps/desktop-wallet
pnpm install
pnpm tauri:build

# Output:
# macOS: src-tauri/target/release/bundle/dmg/
# Windows: src-tauri/target/release/bundle/msi/
# Linux: src-tauri/target/release/bundle/appimage/
```

## Usage

### CLI Wallet

```bash
# Create new wallet
synor-cli wallet create

# Check balance
synor-cli balance

# Send tokens
synor-cli send <address> <amount>

# View network info
synor-cli info
```

### RPC API

```bash
# Get node info
curl -X POST http://localhost:17110 \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","method":"synor_getInfo","params":[],"id":1}'

# Get block count
curl -X POST http://localhost:17110 \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","method":"synor_getBlockCount","params":[],"id":1}'
```

## Configuration

Config file: `~/.synor/config.toml` (Linux/macOS) or `%APPDATA%\Synor\config.toml` (Windows)

```toml
[network]
network = "testnet"  # mainnet, testnet, or devnet

[p2p]
listen_addr = "/ip4/0.0.0.0/tcp/17511"
max_peers = 50

[rpc]
http_enabled = true
http_addr = "127.0.0.1:17110"
ws_enabled = true
ws_addr = "127.0.0.1:17111"

[mining]
enabled = false
coinbase_address = "synor:qz..."
threads = 4
```

## Documentation

- [Developer Guide](docs/DEVELOPER_GUIDE.md) - Full development documentation
- [Deployment Guide](docs/DEPLOYMENT.md) - Production deployment instructions
- [Code Signing](docs/CODE_SIGNING.md) - Certificate setup for releases
- [API Reference](docs/API.md) - RPC API documentation

## Architecture

```
synor/
├── apps/
│   ├── synord/           # Node daemon
│   ├── cli/              # CLI wallet
│   ├── desktop-wallet/   # Tauri desktop wallet
│   ├── faucet/           # Testnet faucet
│   └── explorer/         # Block explorer
├── crates/
│   ├── synor-crypto/     # Quantum-resistant cryptography
│   ├── synor-dag/        # GHOSTDAG consensus
│   ├── synor-consensus/  # Transaction validation
│   ├── synor-network/    # P2P networking (libp2p)
│   ├── synor-storage/    # RocksDB persistence
│   ├── synor-vm/         # WASM smart contracts
│   └── synor-rpc/        # JSON-RPC server
└── contracts/            # Example smart contracts
```

## Security

- Report vulnerabilities to security@synor.cc
- See [SECURITY.md](SECURITY.md) for our security policy

## License

MIT OR Apache-2.0
