Skip to content

Blockheight to datetime conversion utility #18

Description

@magent-cryptograss

Summary

Create a utility (Lua module or parser function) to convert Ethereum blockheights to human-readable datetimes.

Use case

Shows and other time-anchored content use blockheight as the canonical timestamp. But for display, we need to render "January 15, 2026 8:30 PM" rather than "block 21850000".

Implementation options

1. Lua module

{{#invoke:BlockHeight|toDate|21850000}}
→ January 15, 2026

{{#invoke:BlockHeight|toDateTime|21850000|format=Y-m-d H:i}}
→ 2026-01-15 20:30

2. Lookup table

Pre-compute a table of blockheight ranges to dates. Ethereum averages ~12 seconds per block, so we can estimate with reasonable accuracy and cache known blocks.

3. External API

Hit etherscan/blockscout API for exact timestamps. Would need caching strategy.

Considerations

  • Accuracy vs performance tradeoff
  • Caching strategy for repeated lookups
  • Timezone handling (store UTC, display local?)
  • Historical blocks (exact) vs future blocks (estimated)

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions