{"id":22073263,"url":"https://github.com/snapshot-labs/score-api","last_synced_at":"2025-07-24T11:31:08.845Z","repository":{"id":36966404,"uuid":"377791424","full_name":"snapshot-labs/score-api","owner":"snapshot-labs","description":null,"archived":false,"fork":false,"pushed_at":"2024-05-28T11:49:42.000Z","size":2467,"stargazers_count":24,"open_issues_count":5,"forks_count":31,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-05-29T03:16:42.392Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://score.snapshot.org/api","language":"TypeScript","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/snapshot-labs.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-06-17T10:27:41.000Z","updated_at":"2024-05-31T05:23:51.642Z","dependencies_parsed_at":"2023-10-14T16:20:11.776Z","dependency_job_id":"8b7d8c74-6f83-434a-ba98-00c845dcf628","html_url":"https://github.com/snapshot-labs/score-api","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/snapshot-labs%2Fscore-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snapshot-labs%2Fscore-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snapshot-labs%2Fscore-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snapshot-labs%2Fscore-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/snapshot-labs","download_url":"https://codeload.github.com/snapshot-labs/score-api/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227432327,"owners_count":17775896,"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":[],"created_at":"2024-11-30T21:17:39.909Z","updated_at":"2024-11-30T21:17:40.596Z","avatar_url":"https://github.com/snapshot-labs.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Snapshot Score API\nThe Score API is a simple RESTful API that calculates scores for various strategies based on the Snapshot protocol. This README outlines the functionality provided by the API and how to use it without any specific code examples.\n\n---\nWe recommend using the [snapshot.js](https://github.com/snapshot-labs/snapshot.js) library for obtaining voting power and doing validation, as it provides a simple and convenient way to interact with the Snapshot Score API. The snapshot.js library offers the following methods:\n\n- `getScores()` - https://docs.snapshot.org/tools/snapshot.js#getscores\n- `getVp()` - https://github.com/snapshot-labs/snapshot.js/blob/ad55119b0b684f7d6eeaa06f3642f7424d1fa949/src/utils.ts#L190\n- `validate()` - https://github.com/snapshot-labs/snapshot.js/blob/ad55119b0b684f7d6eeaa06f3642f7424d1fa949/src/utils.ts#L227\n---\n\nThe URL for score api is `https://score.snapshot.org`\n\n## API Endpoints\n\n### 1. POST /\nThe base endpoint serves as the entry point for various methods:\n\n- get_vp: Calculate voting power for a given address using strategies.\n- validate: Validate a given address using validation strategies.\n\n\n\n### 2. GET /api\nThis endpoint returns the current version of the Snapshot Score API and block numbers for different networks.\n\nSend a GET request to this endpoint to receive a JSON object containing the version and block_num properties.\n\n### 3. GET /api/strategies\nThis endpoint returns a list of available strategies for calculating voting power.\n\nSend a GET request to this endpoint to receive a JSON object containing key-value pairs representing the strategies and their respective information.\n\n### 4. GET /api/validations\nThis endpoint returns a list of available validation strategies for address validation.\n\nSend a GET request to this endpoint to receive a JSON object containing key-value pairs representing the validation strategies and their respective information.\n\n### 5. POST /api/scores\nThis endpoint calculates scores for a given set of strategies and addresses.\n\nTo use this endpoint, send a POST request with a JSON body containing the params object. The params object should include:\n\n- space: The id of the space to calculate scores for.\n- network: The network ID to use for calculations.\n- snapshot: A specific block number or 'latest' for the latest block.\n- addresses: An array of addresses for which the scores will be calculated.\n- strategies: An array of strategy objects, each containing a name and params property.\n- force: A boolean indicating whether to force the calculation of scores despite potential restrictions.\n\n## Running the API locally with Docker\n\nYou can run the API locally using Docker. To do so, follow these steps:\n\n1. Clone the repository and `cd` into it.\n2. Copy the `.env.example` file to `.env` and set necessary values.\n3. Run `docker-compose up` to start the API.\n\n## Running load tests with Artillery\n\nYou can run load tests on the API using Artillery. To do so, follow these steps:\n\n1. Clone the repository and `cd` into it.\n2. Copy the `.env.example` file to `.env` and set necessary values.\n3. Run `npm install` to install dependencies.\n4. Install Artillery globally by running `npm install -g artillery`.\n5. Run `artillery run -t \u003cyour server url\u003e ./test/load/\u003ctest-file\u003e.yml` to run the load test.` to run the load test.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsnapshot-labs%2Fscore-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsnapshot-labs%2Fscore-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsnapshot-labs%2Fscore-api/lists"}