# galacticcouncil/hydration-node architecture

> Architecture diagram of the GitHub repository galacticcouncil/hydration-node, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-22). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/galacticcouncil/hydration-node
- Repository: https://github.com/galacticcouncil/hydration-node

## Overview

Hydration is a Substrate-based cross-chain liquidity protocol. A user connects to a node over RPC and submits transactions; the runtime provides liquidity, routing, asset, oracle, and protocol functions, while node-side workers support ICE solving and liquidation. The tree and README establish these product areas, but sampled runtime implementation is limited, so most pallet-to-pallet relationships are omitted. The node service and synthetic-log relationships are supported by the source index or excerpts; integration tests and build machinery are excluded.

Main entry points: [`node/src/service.rs`](https://github.com/galacticcouncil/hydration-node/blob/master/node/src/service.rs) (Chain service), [`node/src/synthetic_logs/storage_override.rs`](https://github.com/galacticcouncil/hydration-node/blob/master/node/src/synthetic_logs/storage_override.rs) (Synthetic Ethereum logs), [`node/src/main.rs`](https://github.com/galacticcouncil/hydration-node/blob/master/node/src/main.rs) (Hydration node), [`node/src/cli.rs`](https://github.com/galacticcouncil/hydration-node/blob/master/node/src/cli.rs) (CLI and commands)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_node["Node services"]
  node_node_app["Hydration node<br/>[main.rs]"]
  node_node_cli["CLI and commands<br/>[cli.rs]"]
  node_node_service["Chain service<br/>[service.rs]"]
  node_rpc["RPC endpoints<br/>[rpc.rs]"]
  node_ice_worker["ICE solver worker"]
  node_liquidation_worker["Liquidation worker"]
  node_synthetic_logs["Synthetic Ethereum logs"]
  node_compat_events["Event compatibility<br/>[compat_events.rs]"]
  node_metadata_events["Metadata events<br/>[metadata_events.rs]"]
end

subgraph group_liquidity["Liquidity and routing"]
  node_ice["ICE routing and swaps<br/>[lib.rs]"]
  node_route_executor["Route execution<br/>[lib.rs]"]
  node_omnipool["Omnipool<br/>[lib.rs]"]
  node_stableswap["StableSwap<br/>[lib.rs]"]
  node_xyk["XYK pools<br/>[lib.rs]"]
  node_dca["Recurring swaps<br/>[lib.rs]"]
end

subgraph group_protocol["Protocol features"]
  node_asset_registry["Asset registry<br/>[lib.rs]"]
  node_oracle["EMA oracle<br/>[lib.rs]"]
  node_liquidation["Liquidation pallet<br/>[lib.rs]"]
  node_xcm["Cross-chain messaging<br/>[xcm.rs]"]
end

subgraph group_runtime["Runtime support"]
  node_runtime["Hydration runtime<br/>[lib.rs]"]
  node_router_traits["Routing interfaces<br/>[router.rs]"]
  node_math["Protocol mathematics<br/>[lib.rs]"]
end

node_user(("Wallet or client"))

node_user -->|"connects to"| node_node_app
node_node_app -->|"runs"| node_node_cli
node_node_cli -.->|"starts"| node_node_service
node_node_service -->|"configures"| node_rpc
node_node_service -->|"starts"| node_ice_worker
node_node_service -->|"starts"| node_liquidation_worker
node_node_service -->|"configures"| node_synthetic_logs
node_liquidation_worker -->|"submits liquidations"| node_liquidation
node_synthetic_logs -->|"decodes events"| node_compat_events
node_synthetic_logs -->|"uses metadata"| node_metadata_events

click node_node_app "https://github.com/galacticcouncil/hydration-node/blob/master/node/src/main.rs"
click node_node_cli "https://github.com/galacticcouncil/hydration-node/blob/master/node/src/cli.rs"
click node_node_service "https://github.com/galacticcouncil/hydration-node/blob/master/node/src/service.rs"
click node_rpc "https://github.com/galacticcouncil/hydration-node/blob/master/node/src/rpc.rs"
click node_ice_worker "https://github.com/galacticcouncil/hydration-node/blob/master/node/src/ice_solver_worker.rs"
click node_liquidation_worker "https://github.com/galacticcouncil/hydration-node/blob/master/node/src/liquidation_worker.rs"
click node_synthetic_logs "https://github.com/galacticcouncil/hydration-node/blob/master/node/src/synthetic_logs/storage_override.rs"
click node_compat_events "https://github.com/galacticcouncil/hydration-node/blob/master/node/src/synthetic_logs/compat_events.rs"
click node_metadata_events "https://github.com/galacticcouncil/hydration-node/blob/master/node/src/synthetic_logs/metadata_events.rs"
click node_ice "https://github.com/galacticcouncil/hydration-node/blob/master/pallets/ice/src/lib.rs"
click node_route_executor "https://github.com/galacticcouncil/hydration-node/blob/master/pallets/route-executor/src/lib.rs"
click node_omnipool "https://github.com/galacticcouncil/hydration-node/blob/master/pallets/omnipool/src/lib.rs"
click node_stableswap "https://github.com/galacticcouncil/hydration-node/blob/master/pallets/stableswap/src/lib.rs"
click node_xyk "https://github.com/galacticcouncil/hydration-node/blob/master/pallets/xyk/src/lib.rs"
click node_dca "https://github.com/galacticcouncil/hydration-node/blob/master/pallets/dca/src/lib.rs"
click node_asset_registry "https://github.com/galacticcouncil/hydration-node/blob/master/pallets/asset-registry/src/lib.rs"
click node_oracle "https://github.com/galacticcouncil/hydration-node/blob/master/pallets/ema-oracle/src/lib.rs"
click node_liquidation "https://github.com/galacticcouncil/hydration-node/blob/master/pallets/liquidation/src/lib.rs"
click node_xcm "https://github.com/galacticcouncil/hydration-node/blob/master/runtime/hydradx/src/xcm.rs"
click node_runtime "https://github.com/galacticcouncil/hydration-node/blob/master/runtime/hydradx/src/lib.rs"
click node_router_traits "https://github.com/galacticcouncil/hydration-node/blob/master/traits/src/router.rs"
click node_math "https://github.com/galacticcouncil/hydration-node/blob/master/math/src/lib.rs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_node_app,node_node_cli,node_node_service,node_rpc,node_ice_worker,node_liquidation_worker,node_synthetic_logs,node_compat_events,node_metadata_events,node_user toneBlue
class node_ice,node_route_executor,node_omnipool,node_stableswap,node_xyk,node_dca toneAmber
class node_asset_registry,node_oracle,node_liquidation,node_xcm toneMint
class node_runtime,node_router_traits,node_math toneRose
```

## Components

### Node services

- [Hydration node](https://github.com/galacticcouncil/hydration-node/blob/master/node/src/main.rs): `node/src/main.rs`
- [CLI and commands](https://github.com/galacticcouncil/hydration-node/blob/master/node/src/cli.rs): `node/src/cli.rs`
- [Chain service](https://github.com/galacticcouncil/hydration-node/blob/master/node/src/service.rs): `node/src/service.rs`
- [RPC endpoints](https://github.com/galacticcouncil/hydration-node/blob/master/node/src/rpc.rs): `node/src/rpc.rs`
- [ICE solver worker](https://github.com/galacticcouncil/hydration-node/blob/master/node/src/ice_solver_worker.rs): `node/src/ice_solver_worker.rs`
- [Liquidation worker](https://github.com/galacticcouncil/hydration-node/blob/master/node/src/liquidation_worker.rs): `node/src/liquidation_worker.rs`
- [Synthetic Ethereum logs](https://github.com/galacticcouncil/hydration-node/blob/master/node/src/synthetic_logs/storage_override.rs): `node/src/synthetic_logs/storage_override.rs`
- [Event compatibility](https://github.com/galacticcouncil/hydration-node/blob/master/node/src/synthetic_logs/compat_events.rs): `node/src/synthetic_logs/compat_events.rs`
- [Metadata events](https://github.com/galacticcouncil/hydration-node/blob/master/node/src/synthetic_logs/metadata_events.rs): `node/src/synthetic_logs/metadata_events.rs`

### Liquidity and routing

- [ICE routing and swaps](https://github.com/galacticcouncil/hydration-node/blob/master/pallets/ice/src/lib.rs): `pallets/ice/src/lib.rs`
- [Route execution](https://github.com/galacticcouncil/hydration-node/blob/master/pallets/route-executor/src/lib.rs): `pallets/route-executor/src/lib.rs`
- [Omnipool](https://github.com/galacticcouncil/hydration-node/blob/master/pallets/omnipool/src/lib.rs): `pallets/omnipool/src/lib.rs`
- [StableSwap](https://github.com/galacticcouncil/hydration-node/blob/master/pallets/stableswap/src/lib.rs): `pallets/stableswap/src/lib.rs`
- [XYK pools](https://github.com/galacticcouncil/hydration-node/blob/master/pallets/xyk/src/lib.rs): `pallets/xyk/src/lib.rs`
- [Recurring swaps](https://github.com/galacticcouncil/hydration-node/blob/master/pallets/dca/src/lib.rs): `pallets/dca/src/lib.rs`

### Protocol features

- [Asset registry](https://github.com/galacticcouncil/hydration-node/blob/master/pallets/asset-registry/src/lib.rs): `pallets/asset-registry/src/lib.rs`
- [EMA oracle](https://github.com/galacticcouncil/hydration-node/blob/master/pallets/ema-oracle/src/lib.rs): `pallets/ema-oracle/src/lib.rs`
- [Liquidation pallet](https://github.com/galacticcouncil/hydration-node/blob/master/pallets/liquidation/src/lib.rs): `pallets/liquidation/src/lib.rs`
- [Cross-chain messaging](https://github.com/galacticcouncil/hydration-node/blob/master/runtime/hydradx/src/xcm.rs): `runtime/hydradx/src/xcm.rs`

### Runtime support

- [Hydration runtime](https://github.com/galacticcouncil/hydration-node/blob/master/runtime/hydradx/src/lib.rs): `runtime/hydradx/src/lib.rs`
- [Routing interfaces](https://github.com/galacticcouncil/hydration-node/blob/master/traits/src/router.rs): `traits/src/router.rs`
- [Protocol mathematics](https://github.com/galacticcouncil/hydration-node/blob/master/math/src/lib.rs): `math/src/lib.rs`

### Other components

- **Wallet or client**

## Connections

- Wallet or client → Hydration node: connects to
- Hydration node → CLI and commands: runs (evidence: `node/src/main.rs`)
- CLI and commands → Chain service: starts (evidence: `node/src/service.rs`)
- Chain service → RPC endpoints: configures (evidence: `node/src/service.rs`)
- Chain service → ICE solver worker: starts (evidence: `node/src/service.rs`)
- Chain service → Liquidation worker: starts (evidence: `node/src/service.rs`)
- Chain service → Synthetic Ethereum logs: configures (evidence: `node/src/service.rs`)
- Liquidation worker → Liquidation pallet: submits liquidations (evidence: `node/src/liquidation_worker.rs`)
- Synthetic Ethereum logs → Event compatibility: decodes events (evidence: `node/src/synthetic_logs/storage_override.rs`)
- Synthetic Ethereum logs → Metadata events: uses metadata (evidence: `node/src/synthetic_logs/storage_override.rs`)
