{"id":20138297,"url":"https://github.com/pinax-network/antelope-token-api","last_synced_at":"2026-02-25T17:34:23.151Z","repository":{"id":220931596,"uuid":"711888085","full_name":"pinax-network/antelope-token-api","owner":"pinax-network","description":"Tokens information from the Antelope blockchains, powered by Substreams","archived":false,"fork":false,"pushed_at":"2025-02-03T17:43:30.000Z","size":1509,"stargazers_count":3,"open_issues_count":3,"forks_count":0,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-03-23T20:05:34.356Z","etag":null,"topics":["api","clickhouse","substreams","typescript","web3"],"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/pinax-network.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","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-10-30T11:29:27.000Z","updated_at":"2025-03-01T20:23:28.000Z","dependencies_parsed_at":"2024-02-05T09:04:08.491Z","dependency_job_id":"ac220544-cb35-4e2e-9e49-9bc6d52ae2a7","html_url":"https://github.com/pinax-network/antelope-token-api","commit_stats":null,"previous_names":["pinax-network/antelope-token-api"],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pinax-network%2Fantelope-token-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pinax-network%2Fantelope-token-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pinax-network%2Fantelope-token-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pinax-network%2Fantelope-token-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pinax-network","download_url":"https://codeload.github.com/pinax-network/antelope-token-api/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248084893,"owners_count":21045135,"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":["api","clickhouse","substreams","typescript","web3"],"created_at":"2024-11-13T21:37:16.059Z","updated_at":"2026-02-25T17:34:18.088Z","avatar_url":"https://github.com/pinax-network.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Antelope Token API\n\n[![.github/workflows/bun-test.yml](https://github.com/pinax-network/antelope-token-api/actions/workflows/bun-test.yml/badge.svg)](https://github.com/pinax-network/antelope-token-api/actions/workflows/bun-test.yml)\n\n\u003e Tokens information from the Antelope blockchains, powered by [Substreams](https://substreams.streamingfast.io/)\n\n\u003ca href=\"https://pinax.network/en/chain/eos\"\u003e\u003cimg src=\"https://img.shields.io/badge/EOS-grey?style=for-the-badge\u0026logo=data:image/svg%2bxml;base64,PHN2ZyB3aWR0aD0iNjciIGhlaWdodD0iMTAxIiB2aWV3Qm94PSIwIDAgNjcgMTAxIiBmaWxsPSJub25lIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPg0KPGcgY2xpcC1wYXRoPSJ1cmwoI2NsaXAwXzY2XzI5KSI+DQo8cGF0aCBkPSJNMzMuMzUwOCAwLjIyMTE5MUw5Ljk1MDg2IDMyLjQyMTJMMC4xNTA4NzkgODAuMDIxMkwzMy4zNTA4IDEwMC4yMjFMNjYuNTUwOCA4MC4wMjEyTDU2LjU1MDggMzIuMjIxMkwzMy4zNTA4IDAuMjIxMTkxWk01LjU1MDg3IDc3LjgyMTJMMTIuOTUwOSA0MS42MjEyTDI5Ljc1MDggOTIuNjIxMkw1LjU1MDg3IDc3LjgyMTJaTTE1LjM1MDkgMzMuNDIxMkwzMy4zNTA4IDguNjIxMTlMNTEuMzUwOCAzMy40MjEyTDMzLjM1MDggODcuODIxMkwxNS4zNTA5IDMzLjQyMTJaTTM2Ljc1MDggOTIuNjIxMkw1My41NTA4IDQxLjYyMTJMNjAuOTUwOCA3Ny44MjEyTDM2Ljc1MDggOTIuNjIxMloiIGZpbGw9IndoaXRlIi8+DQo8L2c+DQo8ZGVmcz4NCjxjbGlwUGF0aCBpZD0iY2xpcDBfNjZfMjkiPg0KPHJlY3Qgd2lkdGg9IjY2LjM5OTkiIGhlaWdodD0iMTAwIiBmaWxsPSJ3aGl0ZSIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMC4xNTA4NzkgMC4yMjExOTEpIi8+DQo8L2NsaXBQYXRoPg0KPC9kZWZzPg0KPC9zdmc+DQo=\u0026logoSize=auto\" height=\"30\" /\u003e\u003c/a\u003e\n\u003ca href=\"https://pinax.network/en/chain/wax\"\u003e\u003cimg src=\"https://img.shields.io/badge/WAX-grey?style=for-the-badge\u0026logo=data%3Aimage%2Fsvg%2Bxml%3Bbase64%2CPHN2ZyB3aWR0aD0iMTAxIiBoZWlnaHQ9IjEwMSIgdmlld0JveD0iMCAwIDEwMSAxMDEiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI%2BDQo8ZyBjbGlwLXBhdGg9InVybCgjY2xpcDBfNjdfOSkiPg0KPHBhdGggZD0iTTUwLjEzOTQgMTAwLjIyMUM3Ny43NTM2IDEwMC4yMjEgMTAwLjEzOSA3Ny44MzU0IDEwMC4xMzkgNTAuMjIxMkMxMDAuMTM5IDIyLjYwNyA3Ny43NTM2IDAuMjIxMTkxIDUwLjEzOTQgMC4yMjExOTFDMjIuNTI1MiAwLjIyMTE5MSAwLjEzOTQwNCAyMi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09InRyYW5zbGF0ZSgwLjEzOTQwNCAwLjIyMTE5MSkiLz4NCjwvY2xpcFBhdGg%2BDQo8L2RlZnM%2BDQo8L3N2Zz4NCg%3D%3D\u0026logoSize=auto\" height=\"30\" /\u003e\u003c/a\u003e\n\n## Swagger API\n\n### Usage\n\n| Method | Path | Query parameters\u003cbr\u003e(* = **Required**) | Description |\n| :---: | --- | --- | --- |\n| GET \u003cbr\u003e`text/html` | `/` | - | [Swagger](https://swagger.io/) API playground |\n| GET \u003cbr\u003e`application/json` | `/balance` | **`account*`**\u003cbr\u003e`contract`\u003cbr\u003e`symcode`\u003cbr\u003e`limit`\u003cbr\u003e`page` | Balances of an account |\n| GET \u003cbr\u003e`application/json` | `/balance/historical` | **`account*`**\u003cbr\u003e`block_num`\u003cbr\u003e`contract`\u003cbr\u003e`symcode`\u003cbr\u003e`limit`\u003cbr\u003e`page` | Historical token balances |\n| GET \u003cbr\u003e`application/json` | `/head` | `limit`\u003cbr\u003e`page` | Head block information |\n| GET \u003cbr\u003e`application/json` | `/holders` | **`contract*`**\u003cbr\u003e**`symcode*`**\u003cbr\u003e`limit`\u003cbr\u003e`page` | List of holders of a token |\n| GET \u003cbr\u003e`application/json` | `/supply` | `block_num`\u003cbr\u003e`issuer`\u003cbr\u003e**`contract*`**\u003cbr\u003e**`symcode*`**\u003cbr\u003e`limit`\u003cbr\u003e`page` | Total supply for a token |\n| GET \u003cbr\u003e`application/json` | `/tokens` | `limit`\u003cbr\u003e`page` | List of available tokens |\n| GET \u003cbr\u003e`application/json` | `/transfers` | `block_range`\u003cbr\u003e**`contract*`**\u003cbr\u003e**`symcode*`**\u003cbr\u003e`limit`\u003cbr\u003e`page` | All transfers related to a token |\n| GET \u003cbr\u003e`application/json` | `/transfers/account` | **`account*`**\u003cbr\u003e`block_range`\u003cbr\u003e`from`\u003cbr\u003e`to`\u003cbr\u003e`contract`\u003cbr\u003e`symcode`\u003cbr\u003e`limit`\u003cbr\u003e`page` | All transfers related to an account |\n| GET \u003cbr\u003e`application/json` | `/transfers/id` | **`trx_id*`**\u003cbr\u003e`limit`\u003cbr\u003e`page` | Specific transfer related to a token |\n\n### Docs\n\n| Method | Path | Description |\n| :---: | --- | --- |\n| GET \u003cbr\u003e`application/json` | `/openapi` | [OpenAPI](https://www.openapis.org/) specification |\n| GET \u003cbr\u003e`application/json` | `/version` | API version and Git short commit hash |\n\n### Monitoring\n\n| Method | Path | Description |\n| :---: | --- | --- |\n| GET \u003cbr\u003e`text/plain` | `/health` | Checks database connection |\n| GET \u003cbr\u003e`text/plain` | `/metrics` | [Prometheus](https://prometheus.io/) metrics |\n\n### `X-Api-Key`\n\nUse the `Variables` tab at the bottom to add your API key:\n\n```json\n{\n  \"X-Api-Key\": \"changeme\"\n}\n```\n\n### Additional notes\n\n- For the `block_range` parameter in `transfers`, you can pass a single integer value (low bound) or an array of two values (inclusive range).\n- Use the `from` and `to` field for transfers of an account to further filter the results (i.e. incoming or outgoing transactions from/to another account).\n- Don't forget to request the `meta` fields in the response to get access to pagination and statistics !\n\n## Requirements\n\n- [ClickHouse](clickhouse.com/), databases should follow a `{chain}_tokens_{version}` naming scheme. Database tables can be setup using the [`schema.sql`](./schema.sql) definitions created by the [`create_schema.sh`](./create_schema.sh) script.\n- A [Substream sink](https://substreams.streamingfast.io/reference-and-specs/glossary#sink) for loading data into ClickHouse. We recommend [Substreams Sink ClickHouse](https://github.com/pinax-network/substreams-sink-clickhouse/) or [Substreams Sink SQL](https://github.com/pinax-network/substreams-sink-sql). This Token API makes use of the [`substreams-antelope-tokens`](https://github.com/pinax-network/substreams-antelope-tokens/) substream.\n\n### API stack architecture\n\n![Token API architecture diagram](token_api_architecture_diagram.png)\n\n### Setting up the database backend (ClickHouse)\n\n#### Without a cluster\n\nExample on how to set up the ClickHouse backend for sinking [EOS](https://pinax.network/en/chain/eos) data.\n\n1. Start the ClickHouse server\n\n```console\nclickhouse server\n```\n\n2. Create the token database\n\n```console\necho \"CREATE DATABASE eos_tokens_v1\" | clickhouse client -h \u003chost\u003e --port 9000 -d \u003cdatabase\u003e -u \u003cuser\u003e --password \u003cpassword\u003e\n```\n\n3. Run the [`create_schema.sh`](./create_schema.sh) script\n\n```console\n./create_schema.sh -o /tmp/schema.sql\n```\n\n4. Execute the schema\n\n```console\ncat /tmp/schema.sql | clickhouse client -h \u003chost\u003e --port 9000 -d \u003cdatabase\u003e -u \u003cuser\u003e --password \u003cpassword\u003e\n```\n\n5. Run the [sink](https://github.com/pinax-network/substreams-sink-sql)\n\n```console\nsubstreams-sink-sql run clickhouse://\u003cusername\u003e:\u003cpassword\u003e@\u003chost\u003e:9000/eos_tokens_v1 \\\nhttps://github.com/pinax-network/substreams-antelope-tokens/releases/download/v0.4.0/antelope-tokens-v0.4.0.spkg `#Substreams package` \\\n-e eos.substreams.pinax.network:443 `#Substreams endpoint` \\\n1: `#Block range \u003cstart\u003e:\u003cend\u003e` \\\n--final-blocks-only --undo-buffer-size 1 --on-module-hash-mistmatch=warn --batch-block-flush-interval 100 --development-mode `#Additional flags`\n```\n\n6. Start the API\n\n```console\n# Will be available on locahost:8080 by default\nantelope-token-api --host \u003chost\u003e --database eos_tokens_v1 --username \u003cusername\u003e --password \u003cpassword\u003e --verbose\n```\n\n#### With a cluster\n\nIf you run ClickHouse in a [cluster](https://clickhouse.com/docs/en/architecture/cluster-deployment), change step 2 \u0026 3:\n\n2. Create the token database\n\n```console\necho \"CREATE DATABASE eos_tokens_v1 ON CLUSTER \u003ccluster\u003e\" | clickhouse client -h \u003chost\u003e --port 9000 -d \u003cdatabase\u003e -u \u003cuser\u003e --password \u003cpassword\u003e\n```\n\n3. Run the [`create_schema.sh`](./create_schema.sh) script\n\n```console\n./create_schema.sh -o /tmp/schema.sql -c \u003ccluster\u003e\n```\n\n## [`Bun` Binary Releases](https://github.com/pinax-network/antelope-token-api/releases)\n\n\u003e [!WARNING]\n\u003e Linux x86 only\n\n```console\n$ wget https://github.com/pinax-network/antelope-token-api/releases/download/v4.0.0/antelope-token-api\n$ chmod +x ./antelope-token-api\n$ ./antelope-token-api --help                                                                                                       \nUsage: antelope-token-api [options]\n\nToken balances, supply and transfers from the Antelope blockchains\n\nOptions:\n  -V, --version            output the version number\n  -p, --port \u003cnumber\u003e      HTTP port on which to attach the API (default: \"8080\", env: PORT)\n  --hostname \u003cstring\u003e      Server listen on HTTP hostname (default: \"localhost\", env: HOSTNAME)\n  --host \u003cstring\u003e          Database HTTP hostname (default: \"http://localhost:8123\", env: HOST)\n  --database \u003cstring\u003e      The database to use inside ClickHouse (default: \"default\", env: DATABASE)\n  --username \u003cstring\u003e      Database user (default: \"default\", env: USERNAME)\n  --password \u003cstring\u003e      Password associated with the specified username (default: \"\", env: PASSWORD)\n  --max-limit \u003cnumber\u003e     Maximum LIMIT queries (default: 10000, env: MAX_LIMIT)\n  -v, --verbose \u003cboolean\u003e  Enable verbose logging (choices: \"true\", \"false\", default: false, env: VERBOSE)\n  -h, --help               display help for command\n```\n\n## `.env` Environment variables\n\n```env\n# API Server\nPORT=8080\nHOSTNAME=localhost\n\n# Clickhouse Database\nHOST=http://127.0.0.1:8123\nDATABASE=default\nUSERNAME=default\nPASSWORD=\nMAX_LIMIT=500\n\n# Logging\nVERBOSE=true\n```\n\n## Docker environment\n\n- Pull from GitHub Container registry\n\n**For latest tagged release**\n\n```bash\ndocker pull ghcr.io/pinax-network/antelope-token-api:latest\n```\n\n**For head of `main` branch**\n\n```bash\ndocker pull ghcr.io/pinax-network/antelope-token-api:develop\n```\n\n- Build from source\n\n```bash\ndocker build -t antelope-token-api .\n```\n\n- Run with `.env` file\n\n```bash\ndocker run -it --rm --env-file .env ghcr.io/pinax-network/antelope-token-api\n```\n\n## Contributing\n\nSee [`CONTRIBUTING.md`](CONTRIBUTING.md).\n\n### Quick start\n\nInstall [Bun](https://bun.sh/)\n\n```console\nbun install\nbun dev\n```\n\n**Tests**\n\n```console\nbun lint\nbun test\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpinax-network%2Fantelope-token-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpinax-network%2Fantelope-token-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpinax-network%2Fantelope-token-api/lists"}