The objective is to develop a Python program to get the timestamp when a Solana program was first deployed.
You can refer to Solana's RPC doc.
Programming Language: Python (3.10+)
Package Manager: Use uv for dependency management.
Version Control: Use git as often as you can to save your changes.
Access on-chain data: Use Solana RPC endpoints or Solana official libraries (e.g., solders).
Performance: Optimize the tool for computational efficiency.
No third-party APIs: Access on-chain data directly.
Install dependencies using UV:
uv syncuv run python src/main.pyOr using the configured script:
uv run startThe project includes:
- Ruff: Fast Python linter and formatter
- Pyright: Static type checker
Run formatting:
uv run ruff format .Run linting:
uv run ruff check .Run type checking:
uv run pyrightError Handling: Handle connection issues with access endpoints.
Robustness: Use multiple endpoints to ensure tool robustness.
Your task is to implement the search_for_program() function in src/main.py to efficiently find the deployment slot of a Solana program. Consider:
- How to efficiently search through historical slots
- The trade-offs between different search strategies
- How to verify when a program account was created
- Handling edge cases (program doesn't exist, RPC failures, etc.)
The current implementation is a stub that returns -1. Replace this with your solution.