{"id":14989340,"url":"https://github.com/ar-io/arns-service","last_synced_at":"2025-08-20T08:20:07.890Z","repository":{"id":207596433,"uuid":"626970220","full_name":"ar-io/arns-service","owner":"ar-io","description":"Koa microservice that leverages Warp to support the ArNS Portal and ar.io observers.","archived":true,"fork":false,"pushed_at":"2024-06-04T16:39:25.000Z","size":1157,"stargazers_count":19,"open_issues_count":1,"forks_count":4,"subscribers_count":6,"default_branch":"main","last_synced_at":"2024-10-01T02:04:55.101Z","etag":null,"topics":["ario","arns","arweave","koa","smartweave","swagger","warp"],"latest_commit_sha":null,"homepage":"https://api.arns.app","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ar-io.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":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-04-12T14:19:27.000Z","updated_at":"2024-09-16T18:30:03.000Z","dependencies_parsed_at":"2024-03-04T17:15:15.161Z","dependency_job_id":"9ee91bcb-a5e5-4e08-a166-2deb45c2c629","html_url":"https://github.com/ar-io/arns-service","commit_stats":{"total_commits":318,"total_committers":6,"mean_commits":53.0,"dds":0.05660377358490565,"last_synced_commit":"caa4ebe53523c36993b3bf91d3b98901e3d7107d"},"previous_names":["ar-io/arns-service"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ar-io%2Farns-service","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ar-io%2Farns-service/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ar-io%2Farns-service/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ar-io%2Farns-service/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ar-io","download_url":"https://codeload.github.com/ar-io/arns-service/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235479364,"owners_count":18996862,"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":["ario","arns","arweave","koa","smartweave","swagger","warp"],"created_at":"2024-09-24T14:18:09.604Z","updated_at":"2025-01-24T17:33:07.582Z","avatar_url":"https://github.com/ar-io.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# arns-service\n\nKoa microservice that facilities the ArNS Portal.\n\n## Getting Started\n\nRequirements:\n\n- `nvm`\n- `yarn`\n- `docker`\n\n### Running Locally\n\nStarting the service:\n\n- `nvm use`\n- `yarn`\n- `cp .env.sample .env` (and update values)\n- `yarn start:dev`\n\nYou can check the service is running by running the command:\n\n```shell\ncurl localhost:3000/healthcheck\n{\"timestamp\":\"2023-04-13T13:33:38.299Z\",\"status\":200,\"message\":\"Hello world.\"}\n```\n\n### Docker\n\nBuild and run the latest image:\n\n```shell\ndocker run -e GATEWAY_HOST=arweave.net -p 3000:3000 ghcr.io/ar-io/arns-service:latest\n```\n\nYou can run on a different port by changing the `-e PORT=3000 -p 3000:3000` to `-e PORT=4000 -p 4000:4000`, for example, or specify a `.env` file with `--env-file` flag.\n\n#### Profiles\n\nThe service can be run with different profiles to facilitate different environments. The following profiles are supported:\n\n- `test`: runs the service and other containers for executing integration tests\n- `litestream`: runs the service with [Litestream] for syncing SQLite data to S3\n\nTo run the service with a profile, you can use the `--profile` flag:\n\n```shell\ndocker compose --env-file .env --profile litestream up --build\n```\n\n## Warp\n\nThe service leverages [Warp SDK] to retrieve, evaluate and cache contract state. To request a contract state, run:\n\n```shell\ncurl localhost:3000/v1/contract/${CONTRACT_ID}\n```\n\ne.g.\n\n```shell\ncurl localhost:3000/v1/contract/bLAgYxAdX2Ry-nt6aH2ixgvJXbpsEYm28NgJgyqfs-U\n```\n\nFor more advanced features of Warp caching and state evaluation (e.g. [D.R.E nodes]), refer to the [Warp] documentation.\n\n### SQLite\n\nThis service uses the [warp-contracts-sqlite] for storing contract state. The sqlite database is stored in the `./cache` directory. To clear the Warp cache, run:\n\n```shell\nrm -rf ./cache\n```\n\n### Evaluation Options\n\nBy default, the service will load `Contract-Manifest` tags for state evaluation.\n\n### Syncing State\n\nSimilar to [D.R.E nodes], the service can be configured to sync state for a given contract. This is useful for contracts with large number of interactions that may take a long time to evaluate locally. To sync state from this service via [Warp], you can use `syncState()` with the `/v1/contract/${CONTRACT_ID}` endpoint:\n\n```js\nconst contract = await warp\n  .contract(CONTRACT_TX_ID)\n  .setEvaluationOptions(evaluationOptions)\n  .syncState(`https://api.arns.app/v1/contract/${CONTRACT_TX_ID}`, {\n    validity: true,\n  });\n```\n\n## Configuration\n\nThe service can be configured using environment variables. The following environment variables are supported:\n\n- `PORT`: the port on which the service should listen. Defaults to 3000 if not set.\n- `GATEWAY_PORT`: the gateway port used to evaluate Smartcontract state.\n- `GATEWAY_PROTOCOL`: the gateway protocol (`http` | `https`) to evaluate Smartcontract state.\n- `GATEWAY_HOST`: the gateway host used to evaluate Smartcontract state (e.g `ar-io.dev` or `127.0.0.1` for arlocal).\n- `GATEWAY_HOST`: the gateway used to evaluate Smartcontract state.\n- `LOG_LEVEL`: the log level to display (using [Winston] log levels - e.g. `info`, `debug`)\n- `LOG_FORMAT`: the log format to use when printing logs (e.g. `json`, `simple`)\n- `WARP_LOG_LEVEL`: the log level to display for Warp SDK (using [Winston] log levels - e.g. `info`, `debug`)\n- `PREFETCH_CONTRACTS`: boolean to enable/disable prefetching of contracts on startup. Defaults to `true`.\n- `PREFETCH_CONTRACT_IDS`: comma separated list of contract IDs to prefetch on startup\n- `ARNS_CONTRACT_TX_ID`: the ArNS contract transaction ID. Defaults to `bLAgYxAdX2Ry-nt6aH2ixgvJXbpsEYm28NgJgyqfs-U` and when `PREFETCH_CONTRACTS` is `true`, will be prefetched on startup.\n- `BLOCKLISTED_CONTRACT_IDS`: comma separated list of contract IDs to block evaluation. These contracts will return `403` when requested.\n\nYou can `cp .env.sample .env` and modify them locally.\n\n## Integration Tests\n\nIntegration tests are used to validate endpoints and response payloads. Then can be run locally via:\n\n1. Run the service locally against the test environment:\n\n```shell\nyarn dotenv -e .env.test yarn start:watch\n```\n\n1. In a separate terminal, run the integration tests:\n\n```shell\nyarn test:integration:local\n```\n\nor entirely via docker compose:\n\n```shell\nyarn test:docker\n```\n\n## Swagger\n\n[Swagger] is used for endpoint documentation and testing. When running the service, you can load the Swagger UI in your browser at:\n\n```shell\nhttp://localhost:3000/api-docs\n```\n\nFor production, the Swagger UI is available at [https://api.arns.app/api-docs](https://api.arns.app/api-docs)\n\n## Contributions\n\n- Build to interfaces\n- Integration tests take precedent over unit tests\n- Use [conventional commits] for commit messages\n- Use [prettier] for code formatting\n- Use [eslint] for linting\n- Use [swagger] for API documentation\n\n[Swagger]: https://swagger.io/\n[conventional commits]: https://www.conventionalcommits.org/en/v1.0.0/\n[prettier]: https://prettier.io/\n[eslint]: https://eslint.org/\n[Warp]: https://academy.warp.cc/docs/docs-intro\n[Warp SDK]: https://github.com/warp-contracts/warp\n[warp-contracts-sqlite]: https://github.com/warp-contracts/warp-contracts-sqlite\n[D.R.E nodes]: https://academy.warp.cc/docs/dre/overview\n[Litestream]: https://litestream.io/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Far-io%2Farns-service","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Far-io%2Farns-service","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Far-io%2Farns-service/lists"}