How ark-network/ark works
Project Type and Purpose
• Ark is a monorepo implementing an off-chain Bitcoin transaction protocol.
• It comprises:
• server (“arkd”): Always-on Go daemon exposing gRPC/REST APIs.
• client: Single-key CLI tool for end users.
• pkg/client-sdk: Go and WASM SDK for programmatic access (browser, scripts).
• common: Shared domain code (crypto, data models).
• api-spec: Protobuf + OpenAPI definitions driving codegen.
High-Level File-Structure Analysis
• Top-level directories:
• server/: Hexagonal-architecture backend (interface → application → domain → ports → infrastructure).
• client/: CLI front end.
• pkg/client-sdk/: SDK layer with REST, gRPC, file/in-memory/SQL stores, WASM bindings.
• common/: Reusable types/logic.
• api-spec/: Source of truth for RPC and REST APIs.
• Config & CI:
• Dockerfile, docker-compose for regtest networks.
• GitHub workflows for build, tests, release.
• Build scripts: Makefiles at root, client, common, server.
Key README Insights
• Ark supports multiple Bitcoin networks via embedded lnwallet or RPC nodes.
• Exposes both gRPC and HTTP (via gRPC-Gateway / OpenAPI swagger).
• Uses Badger or SQLite adaptively for state, and Nostrum for event notifications.
• Authentication via macaroons integrated at gRPC interceptor layer.
Detail Level
• Essential components without overcrowding.
• If needed, split into two views:
• “Macro” overview showing Clients → Server → External Systems.
• “Server internals” focused on hexagonal layers and adapters.