Skip to main content
BlockX is a single Go repository (module name github.com/Chaintable/blockx); python/ holds the Python executor, SDK, and auditor. This page helps you find your way around the code quickly once you have the repository; for the system-level division of responsibilities, see Architecture overview.

Layering conventions

AGENTS.md defines the directory skeleton, and docs/specs/code-style.md expands it into checkable implementation constraints. The key points:
  • cmd/: assembly and startup only. The Worker and Coordinator entry points are an app.Profile manifest plus a single app.Run(...) line; workerProfile() in cmd/worker/main.go lists Deployment, Service, WorkerRegistryPrefix, UsageService, Builders, and Plugins, while cmd/bundle_worker/main.go just swaps in a different manifest and adjusts defaults through TuneDefaults. Assembly order, shutdown order, and config parsing live in internal/worker/app/ and internal/coordinator/app/; they must not be copied per entry point.
  • internal/<module>/core/: Sans-IO domain logic. State machines, idempotency decisions, phase advancement, and result convergence all live here, for example WorkerCore in internal/worker/core/worker.go and DispatcherCore in internal/worker/core/dispatcher.go.
  • internal/<module>/adapters/: side effects such as transport, storage, clocks, logging, and metrics. For example internal/worker/adapters/grpc_server.go, etcd_publisher.go, orchestrator*.go, and the subpackage internal/worker/adapters/executor/ (UDS executor adapter and process pool).
  • internal/<module>/app/: assembly and configuration. WorkerFullConfig in internal/worker/app/config.go is the source of truth for configuration; app.go builds the builder/plugin registries and IO backend modules according to the Profile and chains startup and shutdown together.
  • Scope-oriented modules: internal/io/ does not use an event/command core; instead it uses WorkerIOScope (internal/io/core/worker_scope.go) and TaskIOScope (internal/io/core/task_scope.go) to bind quota, cache, singleflight, and cleanup to the scope lifecycle.
  • api/: protocol structs, message envelopes, and field conventions shared across modules. Side-effect-free validation and codec helpers are allowed; handlers, storage models, and state machines are not.
  • python/: not directly governed by code-style.md; see python/README.md and AGENTS.md for run and test commands.
The dependency rules for the three layers in code-style.md §3 and §5 can be summarized in one paragraph: core/ must not reference gRPC, etcd clients, database clients, logging implementations, or metrics implementations; it does not read the clock, generate random values, or start goroutines on its own, and avoids taking context.Context where possible. Cancellation, timeouts, and TTL expiry are all passed in as explicit inputs, and the output is an enumerable set of commands, decision results, or state snapshots. adapters/ own all IO and concurrency, translate core commands into side effects, and repackage timers, executors, plugins, and IO callbacks as core events. app/ and cmd/ only do assembly, with no domain decisions, admission policy, or protocol-semantics branches. When an adapter calls core it depends on the concrete types directly (WorkerCore, CoordinatorCore); no extra interface is abstracted for core.

Module index

Site page links point to the corresponding component page; “Main spec” refers to files under docs/specs/ in the blockx repository.

cmd/

internal/

api/, python/, e2e/, and others

To build a single binary, use go build ./cmd/<name>; this is the same command the Dockerfile and each cmd/*/README.md use.

docs/specs index

docs/specs/ holds the design documents for behavioral semantics. There are two kinds of file names: those without a date prefix are long-lived subsystem designs (named after the subsystem, e.g. plugin-system.md), and those with a YYYY-MM-DD- prefix are incremental designs or change proposals, where the date is when the proposal was made. Files stay in place after they land, and some note their status at the top (e.g. “Status: Implemented” in 2026-07-21-block-bundle-clusters.md). Six must-reads: architecture.md, worker.md, call-execution-subsystem.md, io-subsystem.md, plugin-system.md, code-style.md.

”I want to change X, where should I look?”