GL1X · GenesisL1 explorer

GL1X docs · Overview

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:

Processsystemd unitRole
gl1x indexgl1xthe indexers, the molecular indexer and structure queue, chain-state snapshots, balance refreshes
gl1x servegl1x-web@1 … gl1x-web@Nthe interface, APIs, MCP, BLAST and structure indexes, admin; they share the listening port (SO_REUSEPORT)
gl1x supplygl1x-supply/api/v1/supply… from the node alone, so supply answers survive a database outage
gl1x cert renewgl1x-cert.timercertificate 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 coverage table 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_JUMP blocks 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_INFLIGHT at a time; a request waits up to GL1X_QUEUE_WAIT for a slot, then gets 503 with Retry-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 /mcp runs 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 a head event 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/og draws 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 #

ServiceWhere it runsState
Molecular indexer, structure queue, comparison queueindexing processPostgreSQL (molecular_*); the queues' pace in cache_kv for the admin page
Molecular searchweb processesPostgreSQL (full text, trigram, MinHash bands) and the BLAST index
BLASTweb processesin-memory protein and nucleotide databases, refreshed every 5 s, rebuilt every 6 h; an answer cache
Structure alignmentweb processestraces from PostgreSQL, or a file sent with the request
Ligand indexindexing 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 structuresweb processesin-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.1indexing processcomputed from the packed traces in molecular_chains3d, a batch at a time
Structure files for viewers and toolsweb processesthe 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 yetweb processesthe record's structure file read on demand and its traces kept (160 records)
Record picturesweb processesthe 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 environmentsweb 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, datasetsweb processescomputed on request from PostgreSQL rows
Proofsweb processesread live from the node (pinned block) and IPFS (CID-verified)
CIPNFTweb processesread live from the contract (cached 30 to 60 s); decryption in the visitor's browser
PubMed searchweb 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 #

PathWhat it holdsCopyright
cmd/gl1xthe command: run, serve, index, supply, mcp, cert, tune, status, admin toolsDecentralized Science Labs LLC
internal/indexerEVM and Cosmos indexing lanes, coverage, heavy blocks, tracesDecentralized Science Labs LLC
internal/storeschema, migrations, database reports, statement cacheDecentralized Science Labs LLC
internal/apievery HTTP API, the response cache, admission control, MCP, chess, GL1F and CIPNFT routesDecentralized Science Labs LLC (bio, structure, ligand, feature routes and MCP bio tools: Bioinformatics LLC)
internal/webserver-side pages, the HTML shell, admin, UI servingDecentralized Science Labs LLC
internal/seothe pages of the interface: canonical addresses, titles, descriptions, robots, breadcrumbs, structured data, crawler HTMLDecentralized Science Labs LLC
internal/oglink preview images: fonts, rasterizer, cards, section illustrations, molecule drawingsDecentralized Science Labs LLC
internal/indexnowIndexNow: 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 pagesDecentralized Science Labs LLC
internal/nftNFT metadata, media, MolNFT records, IPFS reading and verification, the structure cacheDecentralized Science Labs LLC
internal/biothe molecular index, search, BLAST index, proofs, structures (and their motif search), the ligand index, features, datasets, admin reportBioinformatics LLC
internal/blastthe BLAST engine and motif scanBioinformatics LLC
internal/foldstructure readers (with ligands and their binding sites), TM-align, GSA, structure search, GSA trainingBioinformatics LLC
internal/phenvthe pH analysis: ionizable groups, pKa estimation (burial, hydrogen bonds, screened charges), coupled titration, membrane placement, environmentsBioinformatics LLC
internal/molfeatmolecular featuresBioinformatics LLC
internal/pubmedthe NCBI E-utilities client for PubMed: rate, retries, cache, records, MeSH topics, title digestsDecentralized Science Labs LLC
internal/gl1fGL1F models: format, evaluation, chain readsDecentralized Science Labs LLC
internal/chessthe chess engine around the on-chain networkDecentralized Science Labs LLC
internal/chain, internal/rpcABI, addresses, units; the batch RPC client with endpoint poolsDecentralized Science Labs LLC
internal/acme, internal/tlscertACME client and certificate storeDecentralized Science Labs LLC
internal/configsettings and autotuneDecentralized Science Labs LLC
internal/safepanic recovery, process history, crash captureDecentralized Science Labs LLC
internal/ui, internal/uipackthe built-in interface and its packerDecentralized Science Labs LLC
internal/docdatesdates the documentation pages whose text changed (docs/dates.go: sitemaps, structured data, the feed)Decentralized Science Labs LLC
internal/verifySolidity and Vyper verificationDecentralized Science Labs LLC
docsthis documentation, served in the explorer and over MCPas stated on each page
deploy, install.shsystemd units, nginx configuration, settings template, the installerDecentralized Science Labs LLC

GL1X is a live explorer of the GenesisL1 blockchain. Turn on JavaScript for search, charts and interactive views.