{"id":19336569,"url":"https://github.com/subsquid/substrate-archive-setup","last_synced_at":"2025-04-23T01:30:49.801Z","repository":{"id":41139657,"uuid":"397867353","full_name":"subsquid/substrate-archive-setup","owner":"subsquid","description":"Squid Archive setups for various chains","archived":true,"fork":false,"pushed_at":"2024-05-22T19:40:25.000Z","size":257,"stargazers_count":19,"open_issues_count":6,"forks_count":26,"subscribers_count":11,"default_branch":"main","last_synced_at":"2025-03-13T01:33:52.236Z","etag":null,"topics":["archive","graphql"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/subsquid.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2021-08-19T08:13:15.000Z","updated_at":"2024-12-01T17:41:37.000Z","dependencies_parsed_at":"2024-05-22T20:53:33.356Z","dependency_job_id":null,"html_url":"https://github.com/subsquid/substrate-archive-setup","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/subsquid%2Fsubstrate-archive-setup","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/subsquid%2Fsubstrate-archive-setup/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/subsquid%2Fsubstrate-archive-setup/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/subsquid%2Fsubstrate-archive-setup/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/subsquid","download_url":"https://codeload.github.com/subsquid/substrate-archive-setup/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250352177,"owners_count":21416454,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["archive","graphql"],"created_at":"2024-11-10T03:11:40.321Z","updated_at":"2025-04-23T01:30:49.481Z","avatar_url":"https://github.com/subsquid.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Squid Archive setups\n\n\u003e [!CAUTION]\n\u003e V1 Subsquid Archives are deprecated. Use [Subsquid Network](https://docs.subsquid.io/subsquid-network/) instead.\n\n## What is an Archive?\n\nSquid Archive collects the historical on-chain data from a Substrate chain and stores it in a normalized form for further processing.\nIt comes with an optional explorer service exposing the historical blocks, events and extrinsics via a rich GraphQL API, making it a helpful exploration and development tool. \n\n\nThere are currently two major Archive releases incompatible with each other: `v5` and `FireSquid`. The old `v5` archives are considered deprecated, and their support will be discontinued. \n\n## Running in Docker\n\nTo run a Squid Archive for a specific chain, change the WebSocket endpoints in `docker-compose.yml` and run:\n\n```sh\ndocker-compose up\n```\n\nThe explorer will be up at `http://localhost:4444/graphql` and the data source endpoint (compatible with [Squid Processor](https://github.com/subsquid/squid-template) at port `8888`).\n\nPrometheus metrics are available at `http://localhost:9090/metrics` by default. Inspect `sqd_last_block` for the sync status of the archive. \n\n\n**Support for EVM logs (Frontier pallete)**\n\nFor chains with Frontier EVM pallete (such as Shiden/Astar or Moonriver/Moonbeam), add `--evm-support` to `substrate-gateway` image. It will enable additional query interfaces compatible with [EvmLog handlers](https://github.com/subsquid/squid-evm-template) for downstream Squids.\n\nSee `docker-compose-evm.yml` for a Moonbase-alpha archive setup.\n\n**Support for WASM (Contracts pallete)**\n\nTo support additional indexing capabilities for WASM (`Contracts` pallete) add `--contracts-support` argument to `substrate-gateway`\n\n**Type bundles**\n\nFor most chains, `substrate-ingest` will process all historical blocks without additional setup.  \n\nIn some rare cases, to decode old unrecognized (pre-v14 metadata) blocks, add `--types-bundle \u003cjson with type definitions\u003e` argument to `substrate-ingest`. Note that the types bundle format is [slightly different](https://github.com/subsquid/squid-sdk/tree/master/substrate/substrate-metadata/src/old/definitions) than that of `polkadot.js`\n\n## How to use an Archive?\n\nThe Archive gateway (exposed on port `8888` in the sample setups) is intended to be used as a data source for [Squid Processor](https://github.com/subsquid/squid-sdk/tree/master/substrate/substrate-processor). See also [Squid template](https://github.com/subsquid/squid-template) for a basic end-to-end example.\n\nThe explorer API can be immediately used with a GraphQL playground available at `http://localhost:4444/graphql` by default. Use the left pane for ad-hoc queries and exploration. \n\n## Run with Cockroach DB\n\nBoth `substrate-ingest` and `substrate-gateway` work with [Cockroach DB](https://www.cockroachlabs.com/docs/) out of the box. To make  `substrate-explorer` compatible as well, set `DB_TYPE` to `cockroach`. \n\n## Running with local Substrate node\n\nInitially, the local Substrate node runs on the URL `ws://127.0.0.1:9944`.\nMake sure that the archive can connect to the node via proper [docker network setup](https://stackoverflow.com/questions/24319662/from-inside-of-a-docker-container-how-do-i-connect-to-the-localhost-of-the-mach)\n\n```yml\n    command: [\n       \"-e\", \"ws://host.docker.internal:9944\",\n    ]\n ```\n\n## Running in production\n\nTo run an archive in production, we recommend the following:\n\n- Use a container orchestrator like Kubernetes. \n- Use [Cocroach DB](https://www.cockroachlabs.com/docs/cockroachcloud/quickstart) cluster or a separate write (for `substrate-ingest`) and read replicas (for `substrate-explorer` and `substrate-gateway`)\n- Monitor Prometheus metrics exposed by `substrate-ingest` and `substrate-gateway` (on port `8000`)\n- Run multiple instances of `substrate-gateway` behind a load balancer. \n\n**Hardware requirements**\n\n- A rule of thumb is to allocate 30GB per 1 million indexed blocks for storage. This is based on our Kusama deployment and may vary depending on the average number of events per block\n\n- We recommend 2GB RAM and 2xCPU per `substrate-gateway` instance\n- We recommend 2GB RAM and 2xCPU for `substrate-ingest`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsubsquid%2Fsubstrate-archive-setup","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsubsquid%2Fsubstrate-archive-setup","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsubsquid%2Fsubstrate-archive-setup/lists"}