{"id":15918402,"url":"https://github.com/trmid/block-at-timestamp","last_synced_at":"2026-02-09T07:35:04.314Z","repository":{"id":65422081,"uuid":"591847304","full_name":"trmid/block-at-timestamp","owner":"trmid","description":"Ethers Provider extension to quickly find a block close to a target timestamp.","archived":false,"fork":false,"pushed_at":"2023-10-20T16:10:20.000Z","size":27,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-23T17:50:06.486Z","etag":null,"topics":["block","blockchain","ethers","provider","query","rpc","timestamp"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/trmid.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-01-22T04:06:09.000Z","updated_at":"2023-01-24T18:26:08.000Z","dependencies_parsed_at":"2023-02-12T14:30:33.747Z","dependency_job_id":"dff2f086-a4b7-4d15-bc03-c7bc08a5569d","html_url":"https://github.com/trmid/block-at-timestamp","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/trmid/block-at-timestamp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trmid%2Fblock-at-timestamp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trmid%2Fblock-at-timestamp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trmid%2Fblock-at-timestamp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trmid%2Fblock-at-timestamp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/trmid","download_url":"https://codeload.github.com/trmid/block-at-timestamp/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trmid%2Fblock-at-timestamp/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29258761,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-09T04:11:57.159Z","status":"ssl_error","status_checked_at":"2026-02-09T04:11:56.117Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["block","blockchain","ethers","provider","query","rpc","timestamp"],"created_at":"2024-10-06T18:41:54.835Z","updated_at":"2026-02-09T07:35:04.243Z","avatar_url":"https://github.com/trmid.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# block-at-timestamp\n\n![version](https://img.shields.io/badge/dynamic/json?color=brightgreen\u0026label=npm\u0026logo=npm\u0026query=%24.version\u0026url=https%3A%2F%2Fraw.githubusercontent.com%2Ftrmid%2Fblock-at-timestamp%2Fmain%2Fpackage.json\u0026link=https%3A%2F%2Fwww.npmjs.com%2Fpackage%2Fblock-at-timestamp)\n![typescript](https://img.shields.io/static/v1?label\u0026logo=typescript\u0026logoColor=white\u0026message=TypeScript\u0026color=blue)\n![ethers](https://img.shields.io/static/v1?label\u0026logo=ethereum\u0026logoColor=white\u0026message=ethers.js\u0026color=gray\u0026link=https%3A%2F%2Fwww.npmjs.com%2Fpackage%2Fethers)\n\nQuickly find a block close to a target timestamp using an RPC URL or ethers Provider.\n\n## Installation\n\nInstall the package with the following command:\n\n`npm i block-at-timestamp`\n\n## Usage\n\n### Example Usage:\n```js\nimport { blockAtTimestamp } from \"block-at-timestamp\";\n\nlet timestamp = 1674420070; // unix timestamp in seconds\nlet block = await blockAtTimestamp(\"https://rpc-provider.example/\", timestamp);\n```\n\n### Optional Target Range:\n\nBy default, the algorithm will attempt to find a block within 60 seconds of the target timestamp. If you want a faster result with less accuracy, you can increase the `targetRangeSeconds` parameter like so:\n\n```js\nawait blockAtTimestamp(provider, timestamp, {\n  targetRangeSeconds: 60 * 60 // one hour\n});\n```\n\n### Debugging:\n\nTo see logs for debugging purposes, you can enable verbose logging with the following:\n\n```js\nimport { setVerbose } from \"block-at-timestamp\";\n\nsetVerbose(true);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrmid%2Fblock-at-timestamp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftrmid%2Fblock-at-timestamp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrmid%2Fblock-at-timestamp/lists"}