{"id":20441543,"url":"https://github.com/helius-labs/photon","last_synced_at":"2025-04-05T12:04:12.541Z","repository":{"id":221631483,"uuid":"754466683","full_name":"helius-labs/photon","owner":"helius-labs","description":null,"archived":false,"fork":false,"pushed_at":"2024-10-18T21:57:29.000Z","size":4108,"stargazers_count":40,"open_issues_count":0,"forks_count":5,"subscribers_count":6,"default_branch":"main","last_synced_at":"2024-10-19T14:23:18.083Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/helius-labs.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":"2024-02-08T05:30:51.000Z","updated_at":"2024-10-18T21:57:32.000Z","dependencies_parsed_at":"2024-02-09T05:23:59.663Z","dependency_job_id":"2fdea006-830c-47a0-aeee-fa8db13c5dfc","html_url":"https://github.com/helius-labs/photon","commit_stats":null,"previous_names":["helius-labs/photon"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/helius-labs%2Fphoton","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/helius-labs%2Fphoton/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/helius-labs%2Fphoton/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/helius-labs%2Fphoton/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/helius-labs","download_url":"https://codeload.github.com/helius-labs/photon/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247332560,"owners_count":20921853,"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-15T09:33:35.491Z","updated_at":"2025-04-05T12:04:12.515Z","avatar_url":"https://github.com/helius-labs.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Photon: the Indexer for ZK Compression on Solana\n\nPhoton is the core indexer for [ZK Compression](https://www.zkcompression.com) on the Solana blockchain. It offers rapid indexing capabilities, snapshot support, and flexible database options to cater to local and production deployments.\n\n## 🚀 Quick Start\n\n### Installation\n\n1. Install dependencies:\n\n```bash\nsudo apt install -y build-essential pkg-config libssl-dev\n```\n\n2. Install `photon-indexer`:\n\n```bash\ncargo install photon-indexer\n```\n\n### 🔧 Usage\n\n#### Basic Usage \n\n* Run Photon with default settings against localnet:\n\n```bash\nphoton\n```\n\n#### Configuration\n\n* Connect to Devnet:\n\n```bash\nphoton --rpc-url=https://api.devnet.solana.com\n```\n\n* Use gRPC for block streaming (requires GRPC_X_TOKEN env variable):\n\n```bash\nphoton --rpc-url=https://api.devnet.solana.com --grpc-url=\u003cgrpc_url\u003e\n```\n\n* Use a local Postgres database:\n\n```bash\nphoton --db-url=postgres://postgres@localhost/postgres\n```\n\n* Specify a start slot:\n\n```bash\nphoton --start-slot=123\n```\n\n* For more advanced options:\n\n```bash\nphoton --help\n```\n\n## 📸 Snapshots\n\nPhoton supports snapshots for quick bootstrapping. \n\n### Loading a Snapshot\n\n1. Download a snapshot:\n\n```bash\nphoton-snapshot-loader --snapshot-dir=~/snapshot --snapshot-server-url=https://photon-devnet-snapshot.helius-rpc.com\n```\n\n2. Run Photon with the snapshot:\n\n```bash\nphoton --snapshot-dir=~/snapshot --rpc-url=https://api.devnet.solana.com --db-url=postgres://postgres@localhost/postgres\n```\n\n### Creating Snapshots\n\nCreate a local snapshot:\n```bash\nphoton-snapshotter --snapshot-dir=~/snapshot\n```\n\nStore snapshots in an R2 bucket:\n```bash\nphoton-snapshotter --r2-bucket=some-bucket --r2-prefix=prefix\n```\n\nNote: Set `R2_ACCESS_KEY`, `R2_ACCOUNT_ID`, and `R2_SECRET_KEY` environment variables when using R2.\n\n## 🗄️ Database Management\n\nPhoton supports both Postgres and SQLite. By default, it uses an in-memory SQLite database.\n\nTo use a custom database:\n```bash\nexport DATABASE_URL=\"postgres://postgres@localhost/postgres\"\n# Set ENABLE_CUSTOM_INDEXES=true to enable program-specific indexes. \nphoton-migration up\nphoton --db-url=$DATABASE_URL\n```\n\n## 🗄️ Custom Indexes\n\nDevelopers can easily add program-specific indexes through a custom migration to speed up queries. See `src/migration/migrations/custom/custom20252201_000001_init.rs` for an example. In the future, we will add tooling to make it easier to add custom indexes. For now, contact the Helius team to add custom indexes.\n\n## 🛠️ Local Development\n\n### Running Tests\n\n1. Set up the environment:\n```bash\nexport MAINNET_RPC_URL=https://api.mainnet-beta.solana.com\nexport DEVNET_RPC_URL=https://api.devnet.solana.com\nexport TEST_DATABASE_URL=\"postgres://postgres@localhost/postgres\"\n```\n\n2. Install additional tools:\n```bash\nnpm install -g @apidevtools/swagger-cli\nwget https://dl.min.io/server/minio/release/linux-amd64/minio\nchmod +x minio\ndocker run -p 3001:3001 docker.io/pmantica1/light-prover:1\n```\n\n3. Run tests:\n```bash\ncargo test\n```\n\nNote: All migrations run automatically during tests for both Postgres and SQLite.\n\n### Database Model Generation\n\n```bash\ncargo install sea-orm-cli --version 0.10.6\nsea-orm-cli generate entity -o src/dao/generated\n```\n\n### API Documentation\n\nGenerate OpenAPI schemas:\n```bash\ncargo run --bin=photon-openapi\n```\n\n## 📬 Support\n\nFor support or queries, please open an issue on Github or contact the [Helius discord](https://discord.gg/HjummjUXgq).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhelius-labs%2Fphoton","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhelius-labs%2Fphoton","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhelius-labs%2Fphoton/lists"}