Architecture
GL1X is one statically linked Go program (gl1x) and one PostgreSQL database,
with nginx in front as edge cache and HTTPS server. The program indexes
GenesisL1 from its RPC endpoints, serves the explorer's interface and every
API, runs the MCP server, and runs the scientific services (the molecular
indexer, BLAST, structure alignment and search, features, datasets, proofs)
in its own code. There is no Docker, no Node.js, no Python and no message
queue: the moving parts are the binary, the database and nginx.
GenesisL1 nodes IPFS gateways
(EVM JSON-RPC, CometBFT RPC, Cosmos LCD) (content and raw blocks)
│ │
┌────────────────┴─────────────┐ │
│ gl1x index (indexing) │◄──────────────────┤
│ EVM lanes · Cosmos lanes · │ │
│ balances · chain-state sync │ │
│ molecular indexer · structure│ │
│ queue · comparisons │ │
└───────────────┬───────────────┘ │
│ COPY + set-based deltas │
▼ │
┌───────────────────┐ │
│ PostgreSQL │ coverage, ledger tables, │
│ (primary + any │ molecular tables, cache, │
│ read replicas) │ settings, chess games │
└─────────┬─────────┘ │
│ │
┌───────────────────┴───────────────────┐ │
│ gl1x serve (one or N processes) │◄───────────────┘
│ router · response cache · admission │ (proofs, records
│ explorer API · Blockscout v2 · │ read on demand)
│ Etherscan · eth-rpc · bio · docs · │
│ MCP (/mcp) · BLAST index · structure │
│ index · built-in UI · admin │
└───────────────────┬───────────────────┘
│ X-Accel-Expires, ETag
▼
┌───────────────┐
│ nginx │ edge cache, HTTP/2, TLS (ACME by gl1x)
└───────┬───────┘
│
people (browser) · programs (REST) · AI agents (MCP)
Processes #
gl1x run (the default) does everything in one process. On large machines the
installer splits it:
| Process | systemd unit | Role |
|---|---|---|
gl1x index | gl1x | the indexers, the molecular indexer and structure queue, chain-state snapshots, balance refreshes |
gl1x serve | gl1x-web@1 … gl1x-web@N | the interface, APIs, MCP, BLAST and structure indexes, admin; they share the listening port (SO_REUSEPORT) |
gl1x supply | gl1x-supply | /api/v1/supply… from the node alone, so supply answers survive a database outage |
gl1x cert renew | gl1x-cert.timer | certificate renewal (ACME), hourly |
Web processes hold no state that another web process lacks: chess games,
settings and the database are shared; the response cache, the BLAST
databases and the structure index are per process and rebuilt from the
database. That is what lets them restart one at a time and lets extra web
servers join with --web-only. Every process reports itself (version, start,
how its previous run ended, survived failures) to the admin page through the
database.
Indexing #
- Coverage, not watermarks. The
coveragetable stores the indexed block intervals; the work left is the configured ranges minus coverage. Restarts, overlapping ranges, crashes and reindexes need no special cases. - Ranges with their own endpoints. Each configured range (an archive node,
the live head) has its own pool of RPC endpoints with failover, request rate,
batch size and workers. The live lane jumps to the head when it falls more
than
GL1X_LIVE_JUMPblocks behind; the gap is backfilled newest first. - Batches in one transaction. Blocks, transactions, logs, token transfers and traces are fetched in JSON-RPC batches, COPY'd into staging tables and merged with set-based, order-independent deltas (address counters, balances, holders, daily statistics), in one transaction with their coverage row.
- Heavy blocks. Blocks above
GL1X_HEAVY_BLOCK_BYTES(the MolNFT v2 mints carry about a megabyte of structure each) go to a lane of their own and are fetched one at a time, by parts when the node cannot send them whole. - Cosmos. CometBFT blocks and decoded SDK transactions, the per-account index, IBC transfers; validators, delegations, governance, supply and the community pool are snapshotted from the LCD and refreshed by events.
- Balances. Every touched account is re-read from the node within about a second; a balance read live for a page is written back when it differs.
- The molecular indexer walks the MolNFT collections, reads every record and its sequences, and queues its structure file (MolNFT). Structure files are read by a queue of their own (one worker per CPU, 4 to 16) and compared by another (a quarter of the CPUs), so TM-align never holds up reading; both yield only while the node is slow to serve new blocks (Structures).
Database #
PostgreSQL holds what pages read, in a compact layout (column order without
padding, hash indexes for 32-byte keys, small ids for producers, large values
kept on the node and fetched on demand), tuned by the installer for the
machine. The molecular tables (molecular_*) hold the scientific index: the
records, every sequence, structure files' outcomes, every chain's packed CA
trace and GSA string, the ligands with their binding sites and the chemical
components, and the precomputed comparisons. See
Operations.
Serving #
- Router and caches. Every API answer is computed once and kept in memory
as finished bytes (and gzip) for as long as it is fresh (
X-Cache, ETags); identical requests that arrive together share one computation; an expired answer is served while one background refresh replaces it. - Admission control. Uncached work runs at most
GL1X_MAX_INFLIGHTat a time; a request waits up toGL1X_QUEUE_WAITfor a slot, then gets 503 withRetry-After. Live node reads for pages have a gate of their own. - Structure files. A MolNFT's structure file, which a node may take
minutes to return for a large on-chain record, has a lane of its own (three
reads at once per web process, duplicates shared, a read going on after the
request that started it stops waiting) and a cache of its own: compressed
files on disk in
GL1X_DATA_DIR/structure-cache(GL1X_STRUCTURE_CACHE_MB), shared by the web processes, the latest in memory. Requests for them pass by the response cache and the admission gate (Serving structure files). - Record pictures. A MolNFT record's picture (its own from the chain, or
its molecule drawn from its structure) is made once, by the first request
for it, duplicates waiting for that one, and kept: JPEGs on disk in
GL1X_DATA_DIR/picture-cache(GL1X_PICTURE_CACHE_MB: by default a quarter of the free disk, up to the whole archive's pictures), shared by the web processes, the latest in memory. A few are made at once, with drawing slots of their own, and 256 more may wait; past that a request is answered 503 at once. Requests for pictures pass by the response cache and the admission gate, which their own bounds stand in for (Collections and pictures). - API families. The unified explorer API (
/api/…), Blockscout REST v2 (/api/v2/…), the Etherscan-style API (/api?module=…), JSON-RPC served from the index (/api/eth-rpc), GenesisL1's Cosmos endpoints (/api/cosmos/…), the molecular, BLAST, structure, ligand, feature and dataset routes (/api/bio/…), GL1F (/api/gl1f/…), chess (/api/chess/…) and the documentation (/api/docs). See API. - MCP.
POST /mcpruns tool calls in-process through the same router and cache, as the calling client (MCP). - Live updates. The indexers announce each batch they write with a
PostgreSQL notification (
gl1x_evm,gl1x_cosmos); every web process listens and relays them to the browsers on/api/live(server-sent events), with aheadevent carrying the newest block's height and time, so the network card's last block changes the moment the block is indexed rather than at its next poll (API). - The interface. A React single-page application built into the binary
(
internal/ui/embedded/dist). Its HTML shell is filled for each address (internal/seo, completed from the index by the API server): the page's title, description, canonical address, robots directive, preview image, structured data and an HTML rendering for crawlers and readers that run no script, with status 404 for addresses that are no page; with its own security headers (content security policy, frame and referrer policies). - Previews.
internal/ogdraws each page's link preview (1200×630 PNG) in pure Go: a TrueType reader for the embedded WOFF fonts, an anti-aliased scanline rasterizer, and a molecule renderer that turns a MolNFT record's indexed backbone into lit tubes (API). Every page has an illustration of its own; a process draws the previews of the explorer's own pages when it starts. - Made before anyone asks. The web processes make the MolNFT records'
pictures in the background, one at a time and out of visitors' way (one
process of a layout at a time, by a Postgres advisory lock; up to nine
tenths of the picture cache), so the first visitor of a record and the
image crawler reading the sitemaps find them made (
GL1X_PICTURE_WARM). - First paint. The built-in interface's pages carry its theme script inline (allowed by its digest in the content security policy) and name the chunks of the page they are for, from the build's manifest, so the browser fetches a page's code with the interface's first script.
- The admin. Server-rendered pages under
/admin, signed in with the admin token (Admin guide).
The scientific services #
| Service | Where it runs | State |
|---|---|---|
| Molecular indexer, structure queue, comparison queue | indexing process | PostgreSQL (molecular_*); the queues' pace in cache_kv for the admin page |
| Molecular search | web processes | PostgreSQL (full text, trigram, MinHash bands) and the BLAST index |
| BLAST | web processes | in-memory protein and nucleotide databases, refreshed every 5 s, rebuilt every 6 h; an answer cache |
| Structure alignment | web processes | traces from PostgreSQL, or a file sent with the request |
| Ligand index | indexing process (with the structure queue; component counts every 5 minutes while ligands change) and web processes (the component catalog in memory, read again every 2 minutes; binding sites from PostgreSQL) | molecular_ligands, molecular_ligand_components; a record not read yet is read from its file on demand (200 records kept 10 minutes) |
| Structure search, motif search of the structures | web processes | in-memory index (2 bytes per residue: protein chains' pair codes; DNA, RNA and unusual chains as residues), refreshed by the update time of structures and chain rows; answer caches |
| Chain breaks of chains stored before 2.8.1 | indexing process | computed from the packed traces in molecular_chains3d, a batch at a time |
| Structure files for viewers and tools | web processes | the structure cache: files on disk in GL1X_DATA_DIR/structure-cache (2 GB), shared by the processes, the latest 128 MB in memory, read again after a week |
| Preview images of records not indexed yet | web processes | the record's structure file read on demand and its traces kept (160 records) |
| Record pictures | web processes | the picture cache: JPEGs on disk in GL1X_DATA_DIR/picture-cache (a quarter of the free disk, at most 40 GB), shared by the processes, the latest in memory, made again after half a year; records without a picture remembered ten minutes |
| pH environments | web processes (two analyses at once) | the record's structure file read on demand in full atoms and shared with the other full-atom tools; answers kept 30 minutes in memory (64 structures) |
| Features, datasets | web processes | computed on request from PostgreSQL rows |
| Proofs | web processes | read live from the node (pinned block) and IPFS (CID-verified) |
| CIPNFT | web processes | read live from the contract (cached 30 to 60 s); decryption in the visitor's browser |
| PubMed search | web processes (NCBI's E-utilities, within NCBI's rate shared by the processes) and the visitor's browser (the clustering) | NCBI's answers in a 48 MB memory cache (searches 30 minutes, records 24 hours); nothing searched is kept |
Each is bounded: concurrency slots with short queues, per-client budgets, time limits, and work limits (cells of an alignment, residue pairs of a dataset), so a scientific request cannot take the explorer down.
Failure isolation #
internal/safe turns a panic inside an indexing batch, a search, a worker
round or a request into an error of that unit: the batch is parked and
retried, the request answers 500, the process goes on, and the admin page
lists the failure with its stack in the log. A crash of the whole process
(out of memory, a runtime fault) leaves a crash report the next start shows on
the admin page.
Edge and HTTPS #
nginx keeps each answer exactly as long as GL1X keeps it fresh (GL1X sends the
remaining time in X-Accel-Expires) and revalidates with ETags, so it never
serves an answer older than GL1X allows; only when GL1X does not answer does it
serve its last copy. With a domain, GL1X's own ACME client (internal/acme)
obtains and renews the Let's Encrypt certificate (HTTP-01 through nginx, ARI
renewal windows), checks nginx's configuration, reloads it and confirms the
certificate served.
Source map #
| Path | What it holds | Copyright |
|---|---|---|
cmd/gl1x | the command: run, serve, index, supply, mcp, cert, tune, status, admin tools | Decentralized Science Labs LLC |
internal/indexer | EVM and Cosmos indexing lanes, coverage, heavy blocks, traces | Decentralized Science Labs LLC |
internal/store | schema, migrations, database reports, statement cache | Decentralized Science Labs LLC |
internal/api | every HTTP API, the response cache, admission control, MCP, chess, GL1F and CIPNFT routes | Decentralized Science Labs LLC (bio, structure, ligand, feature routes and MCP bio tools: Bioinformatics LLC) |
internal/web | server-side pages, the HTML shell, admin, UI serving | Decentralized Science Labs LLC |
internal/seo | the pages of the interface: canonical addresses, titles, descriptions, robots, breadcrumbs, structured data, crawler HTML | Decentralized Science Labs LLC |
internal/og | link preview images: fonts, rasterizer, cards, section illustrations, molecule drawings | Decentralized Science Labs LLC |
internal/indexnow | IndexNow: the site's key and its check, the pages new or changed since the last round, the daily budget; WebSub: telling the feed's hub of new pages | Decentralized Science Labs LLC |
internal/nft | NFT metadata, media, MolNFT records, IPFS reading and verification, the structure cache | Decentralized Science Labs LLC |
internal/bio | the molecular index, search, BLAST index, proofs, structures (and their motif search), the ligand index, features, datasets, admin report | Bioinformatics LLC |
internal/blast | the BLAST engine and motif scan | Bioinformatics LLC |
internal/fold | structure readers (with ligands and their binding sites), TM-align, GSA, structure search, GSA training | Bioinformatics LLC |
internal/phenv | the pH analysis: ionizable groups, pKa estimation (burial, hydrogen bonds, screened charges), coupled titration, membrane placement, environments | Bioinformatics LLC |
internal/molfeat | molecular features | Bioinformatics LLC |
internal/pubmed | the NCBI E-utilities client for PubMed: rate, retries, cache, records, MeSH topics, title digests | Decentralized Science Labs LLC |
internal/gl1f | GL1F models: format, evaluation, chain reads | Decentralized Science Labs LLC |
internal/chess | the chess engine around the on-chain network | Decentralized Science Labs LLC |
internal/chain, internal/rpc | ABI, addresses, units; the batch RPC client with endpoint pools | Decentralized Science Labs LLC |
internal/acme, internal/tlscert | ACME client and certificate store | Decentralized Science Labs LLC |
internal/config | settings and autotune | Decentralized Science Labs LLC |
internal/safe | panic recovery, process history, crash capture | Decentralized Science Labs LLC |
internal/ui, internal/uipack | the built-in interface and its packer | Decentralized Science Labs LLC |
internal/docdates | dates the documentation pages whose text changed (docs/dates.go: sitemaps, structured data, the feed) | Decentralized Science Labs LLC |
internal/verify | Solidity and Vyper verification | Decentralized Science Labs LLC |
docs | this documentation, served in the explorer and over MCP | as stated on each page |
deploy, install.sh | systemd units, nginx configuration, settings template, the installer | Decentralized Science Labs LLC |