Skip to content

Onchain Analytics System #40

Open
Open

Description

@thalescb

Context

GoodDollar's onchain data was scattered across subgraphs, Google Apps Script pipelines, block explorers, and loose Dune dashboards -- no centralized, reliable view of protocol activity existed. The idea emerged in early 2026 to build a proper analytics system.

Journey so far:

  1. Hypersync discovery -- Hadar pointed to Hypersync as an indexing solution; studied it, built the first ingestion pipeline
  2. BigQuery as the warehouse -- researched storage options; chose BigQuery for cost, public dataset capability, and SQL familiarity
  3. MVP: XDC invites pipeline -- first end-to-end pipeline (Hypersync to BigQuery to Looker Studio dashboard), validating the architecture
  4. dbt migration -- 10 models across staging/semantic/marts, 57 tests, full documentation and governance framework
  5. Production deployment -- all models live in BigQuery, dbt docs site operational

Goal

A production-grade onchain analytics system: centralized, automated, documented, and expandable -- so any team member can query protocol activity without asking the data team.

Scope

  • Hypersync ingestion pipeline (MVP)
  • BigQuery warehouse setup
  • XDC invites dashboard (architecture validation)
  • dbt migration -- 10 models, staging to semantic to marts
  • Documentation and governance framework (analytics contract, business glossary, freshness macros)
  • Pipeline hardening -- error handling, retries, alerting
  • Scheduled execution -- cron/Cloud Scheduler
  • Expansion: additional contract events (phased -- each entity gets its own sub-issue as scoped)
  • Centralized metric dictionary (dbt-native, evolves with expansion)

Current Status

Production-deployed with 10 models and 57 passing tests. Pipeline hardening complete (PR #51). Data freshness blocked on Envio XDC indexer outage -- reported, awaiting fix. Hadar greenlit the approach after a demo (Jul 6).

Value

Moves GoodDollar from "ask Thales to pull the data" to "query it yourself." Foundation for every dashboard, metric, and reporting cadence downstream.

References

  • Project folder: projects/onchain-analytics/
  • dbt docs: generated locally via dbt docs generate
  • dbt models: projects/onchain-analytics/gd_dbt/

Activity

  1. self-assigned this
    on Jul 9, 2026
  2. added
    epicInitiative-level tracking issue
    in-progressActively being worked on
    infrastructurePipeline, systems, and platform work
    on Jul 9, 2026
  3. thalescb commented on Jul 9, 2026

    @thalescb
    CollaboratorAuthor

    CI fix shipped (PR #46): dbt-docs workflow updated for the onchain-analytics folder rename. Docs now deploy to /onchain-analytics/ subfolder, making room for other tools (utm-builder) on the same GitHub Pages site. Live at https://gooddollar.github.io/data-team/onchain-analytics/

  4. thalescb commented on Aug 3, 2026

    @thalescb
    CollaboratorAuthor

    Pipeline hardening shipped in PR #51. Hardened v5 pipeline replaces the prototype: staging+MERGE write path (idempotent), block-aligned chunking, Slack alerting on failure/staleness, structured logging and exit codes, PipelineRuns observability table. GitHub Actions cron workflow included (01:00 UTC daily). Blocked on Envio -- their XDC HyperSync indexer is stuck at block 105,265,600 (~400K blocks behind the actual chain tip). Reported to their team. Once they fix it, pipeline will auto-catch-up and scheduling can be activated.

  5. thalescb commented on Aug 4, 2026

    @thalescb
    CollaboratorAuthor

    Status Update (Aug 4, 2026)

    Pipeline v5 hardened and shipped (PR #51). Daily cron at 01:00 UTC configured (needs service account key for CI). Slack alerting and freshness monitoring live.

    XDC/Fuse ingestion ON HOLD: HyperSync dropped XDC support entirely. Hadar is pinging the XDC team about subsidizing infra costs. Decision: wait for their answer before committing to full RPC pivot. For Fuse, existing subgraphs can provide backfill data. Celo ingestion working fine.

    Backfill strategy pivot: Issues #52/#53 (HyperSync backfill) are superseded -- HyperSync is gone. New plan depends on XDC team response.

  6. thalescb commented on Sep 25, 2026

    @thalescb
    CollaboratorAuthor

    Three PRs open that rebuild the ingestion substrate ahead of the expansion item in this epic's scope.

    The system currently captures two contracts on one chain into decoded, per-contract tables, which means every new contract needs a schema change. The inventory work found the real surface is 148 contracts and 354 implementation eras across Celo, XDC, Fuse and Ethereum, so that pattern does not scale and a log missed because nobody had defined a column for it is unrecoverable.

    Merge order is #70, then #69, then #71: the pipeline reads the seed at startup.

    Nothing has been run against the production dataset. No historical backfill is included or authorised; that is the next piece of work, and the Fuse chain in particular needs a decision on paid archive access before it can be planned.

  7. thalescb commented on Sep 29, 2026

    @thalescb
    CollaboratorAuthor

    Three PRs merged today: the L0 v4 ingestion contract (#69), the contract registry seed expanded to all four chains (#70), and the pipeline rewritten against that contract (#71).

    #72 is now open on top of them -- the test foundation, reference data and safety controls the pipeline needed before it can be run against production.

    • 447 tests, none of which need credentials or network access. Statement coverage went from 30% to 69%.
    • Eleven known defects are pinned as failing tests by name, so the ones not yet fixed cannot be quietly lost. Four are closed by this work, including commands that reported success for runs they had refused, and coverage that hid a gap nobody recorded.
    • Events are now decoded against the contract version that actually emitted them, with a confidence grade and a traceable receipt on each interval.
    • Release scope is recorded in docs/release-scope.md: Celo, XDC and Ethereum. Fuse is out, with its measured reference data retained rather than deleted.

    Next: reconciling ingested claim counts and amounts against the contracts' own daily ledgers on both chains, then a bounded ingestion of the recent window. Scheduled execution stays off until the pipeline has run end to end at least once.

  8. thalescb commented on Sep 29, 2026

    @thalescb
    CollaboratorAuthor

    Ingestion pipeline hardening merged — #72

    master is now at e493247. Twelve commits, each independently green, covering correctness and
    write-safety work on the ingestion pipeline.

    The defects that had real consequences, and are now closed:

    • Two runs of the same block range could both write the same rows while both reported success. One
      measured run left 149 rows across 102 distinct keys, with every coverage row marked complete.
    • Verification returned "clean" when it had compared nothing at all — three separate code paths
      reached that result, and all three exited zero.
    • Claim amounts were reconciled against the UBIScheme contracts' own per-day ledgers for the first
      time. XDC matches to the wei on 255 of 255 days.
    • Staging tables were being created and dropped inside the production dataset, which would have
      forced a writer identity to hold table-delete permission on the raw layer.

    State of the test suite: 543 tests passing across 25 files, plus a suite of 21 tests that pin
    the specific defects above. All 21 were red when this work began and all 21 are green now, none
    skipped. Statement coverage is 80.19%, up from 57.55%.

    Nothing was written to production and no write credential exists yet. The identity used
    throughout has tables.create, tables.update, tables.updateData, tables.delete and
    datasets.delete denied on the raw dataset, re-verified after every change.

    Next step, and it needs a decision rather than code: the first production write requires a
    separate writer identity scoped to a staging dataset that does not exist yet
    (BlockchainEvents_Staging). Five preconditions are defined and must each be independently
    verifiable before that credential is issued. That work is deliberately not in this PR.

  9. thalescb commented on Oct 6, 2026

    @thalescb
    CollaboratorAuthor

    PR #74 adds a current start-here guide and corrects the onchain analytics status documentation; production ingestion and scheduling remain separate open work.

  10. thalescb commented on Oct 6, 2026

    @thalescb
    CollaboratorAuthor

    PR #74 is merged to master. The current onboarding/status guide is now available at projects/onchain-analytics/docs/START_HERE.md; production ingestion and scheduling remain separate open work.

  11. thalescb commented on Oct 8, 2026

    @thalescb
    CollaboratorAuthor

    PR #75 is merged and the interactive current/target lineage map is live at https://gooddollar.github.io/data-team/onchain-analytics/map/. Selecting a model shows its grain, purpose, dependencies, status, and caveats; live models link to dbt Docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

epicInitiative-level tracking issuein-progressActively being worked oninfrastructurePipeline, systems, and platform work

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions