Verified programs API integration
The verified programs API integration connects the verifier CLI to two sources of truth: the remote verification service and the Solana network. It submits a program and its uploader for remote checking, reads job and verification results, and reads on-chain program and verification data needed to make those requests meaningful. This page is a child of Verifier CLI and relates to build verification execution, Solana program artifacts, and build image configuration.
System boundary
The API layer separates remote verification work from direct Solana reads. The remote service runs the verification job and stores its result. Solana RPC supplies the deployed program state and the verification record that the CLI uses to validate and submit a job.
API surfaces
The integration has two external API surfaces:
| Surface | Purpose | Main result |
|---|---|---|
| Remote verification service | Queue a verification job and inspect its progress or saved result | Request IDs, job state, hashes, repository data, and verification state |
| Solana JSON-RPC | Read program deployment data and verification accounts | Deployment slot and on-chain verification parameters |
The Rust API module exposes the small set of operations needed by the CLI. The command layer does not call the remote service directly. It selects an operation and passes Solana addresses and an RPC connection to the API layer. src/…/mod.rs src/main.rs
Service identity
The remote service is selected from the Solana cluster unless the user supplies --remote-url. Mainnet uses https://verify.osec.io, while devnet uses https://verify-devnet.osec.io. An explicit URL overrides cluster detection and has its trailing slash removed before endpoint paths are added. Unsupported clusters require this override. src/…/client.rs src/main.rs src/main.rs
The client uses long request time limits because a verification job can include a full reproducible build rather than a short data lookup. src/…/client.rs src/…/client.rs
References: src/…/mod.rs• L1-8 src/…/client.rs• L20-53 src/…/client.rs• L133-135 src/…/client.rs• L298-301 src/main.rs• L378-385 src/main.rs• L654-662
Remote verification lifecycle
Remote verification is an asynchronous exchange. The CLI submits a job, receives a request ID, polls that job until it reaches a final state, and then compares the service hashes before it reports the result.
Job submission
The remote submit-job command sends a program address and an uploader address to the service. Before it sends the request, the client checks that the uploader has a verification PDA for the program. This prevents a remote job from being created without the on-chain record that identifies the build to verify. The command normally uses the server selected for the Solana cluster, or the server named by --remote-url. src/main.rs src/…/client.rs
The request uses POST /verify-with-signer. Its body identifies the program and signer. The repository and commit fields are empty because this command asks the remote worker to use the verification information already uploaded on Solana. src/…/client.rs
Job state polling
The service returns a request ID in a VerifyResponse. The client uses that ID with GET /job/{request_id} and checks the returned JobStatus until the job is complete, failed, or unknown. An in-progress job is checked again after a delay. src/…/models.rs src/…/client.rs [src/api/client.rs#L254-L295]
The completed response contains the on-chain hash and the executable hash. Matching values mean that the remote build matches the deployed program data. A failed job reports the service message and points the user to /logs/{request_id}. The client also prints /job/{request_id} and /status/{program_id} so the user can inspect the work outside the CLI. src/…/client.rs
This diagram shows the remote exchange from the CLI command to the final comparison.
sequenceDiagram
participant CLI as Verifier CLI
participant Solana as Solana RPC
participant Service as Selected verification service
CLI->>Solana: Check uploader verification PDA
Solana-->>CLI: On-chain verification record
CLI->>Service: POST /verify-with-signer
Service-->>CLI: request_id
loop Until final job state
CLI->>Service: GET /job/{request_id}
Service-->>CLI: JobStatus and result data
end
CLI->>CLI: Compare executable_hash with on_chain_hash
CLI-->>CLI: Report verified or not verified
References: src/…/client.rs• L124-150 src/…/client.rs• L153-252 src/…/client.rs• L254-295 src/…/models.rs• L10-15 src/…/models.rs• L40-59
Remote status lookup
The remote get-status command asks for the saved verification status of a program. The client calls GET /status-all/{program_id} and prints a list of status records. Each record describes a signer, verification flag, hashes, repository, commit, and last verification time. src/main.rs src/…/client.rs src/…/models.rs
The remote get-job command reads one job by ID through the same job lookup used during polling. It is useful when the user has a job URL or request ID and wants the current service result without starting a new submission. src/main.rs src/…/client.rs
References: src/main.rs• L378-410 src/…/client.rs• L254-320 src/…/models.rs• L71-99
Data contracts
The model layer defines the JSON shapes that cross the remote service boundary. These models keep job state separate from verification evidence and make the CLI output useful during both progress and final-result states.
Submission contract
The submission body is built at the call site rather than represented by a named request type. It contains two identities:
| Field | Meaning |
|---|---|
program_id | The Solana program being checked |
signer | The uploader whose on-chain verification record is used |
repository | Empty for the on-chain submission flow |
commit_hash | Empty for the on-chain submission flow |
The program and signer must remain aligned with the verification PDA lookup. A change to either value changes which on-chain record the service should use. src/…/client.rs
References: src/…/client.rs• L124-146 src/main.rs• L400-410
Job result contract
The service uses JobStatus to describe the job state. VerifyResponse carries the request ID returned at submission time. JobVerificationResponse carries the evidence used after the worker finishes.
| Model | Role | Key data |
|---|---|---|
VerifyResponse | Submission acknowledgment | Status, request ID, and message |
JobResponse | CLI polling result | Job status and optional detailed response |
JobVerificationResponse | Final verification result | Status, message, on-chain hash, executable hash, and repository URL |
ErrorResponse | Conflict or service error body | Success/error status and error text |
The detailed response is optional while a job is in progress. It is expected when the job reaches a final state. src/…/models.rs src/…/models.rs
References: src/…/models.rs• L3-59
Status record contract
The status endpoint returns a collection because a program can have verification records associated with different signers. RemoteStatusResponseWrapper formats all records for the CLI. The is_verified flag gives the stored result, while the hash and commit fields explain which build was checked. src/…/models.rs
References: src/…/models.rs• L71-115 src/…/client.rs• L298-310
Solana data access
The Solana-facing part of the integration reads the chain through the RPC endpoint selected by the CLI. It resolves deployment metadata from program accounts and reads the verification PDA that links a signer to build information.
Deployment slot lookup
The deployment slot is the slot of the program's program-data account. The client first reads the program account with parsed JSON-RPC data. It then follows the programData address and reads that account to obtain its deployment slot. The slot becomes part of the verification data uploaded on chain by the normal verification flow. src/…/solana.rs src/…/solana.rs src/solana_program.rs
This two-step read matters for upgradeable Solana programs because the program account points to a separate account that holds deployment data. If either account lacks the expected parsed value, the upload path cannot build complete verification parameters.
References: src/…/solana.rs• L8-56 src/…/solana.rs• L58-111 src/solana_program.rs• L339-355
Verification PDA lookup
The verification PDA is the on-chain record that stores the repository, commit, build arguments, verifier version, and deployed slot for a program and signer. The CLI derives the record from the program and signer, reads it with confirmed commitment, and decodes it before remote submission. src/solana_program.rs src/solana_program.rs
The same PDA relationship controls local upload and remote submission. The upload path creates or updates the record. The remote path requires the record to exist before it sends the service request. src/solana_program.rs src/…/client.rs
References: src/solana_program.rs• L68-90 src/solana_program.rs• L412-415 src/solana_program.rs• L468-506 src/…/client.rs• L124-132
RPC endpoint selection
The CLI resolves a named network or a full RPC URL into one RpcClient. The API layer reuses that connection for cluster detection, PDA reads, and deployment-slot reads. Remote submission is therefore tied to the network selected for the Solana-facing part of the command unless the user supplies an explicit remote URL. src/solana_program.rs src/main.rs src/…/client.rs
References: src/solana_program.rs• L277-301 src/main.rs• L426-428 src/…/client.rs• L38-53 src/…/client.rs• L124-132
CLI integration
The CLI exposes remote API work under the remote command group. Other verification commands use the same API module indirectly when they gather deployment data or write verification information to Solana.
Remote command surface
The remote commands map to distinct user goals:
| Command | Goal |
|---|---|
remote submit-job | Queue a check for a program and uploader |
remote get-job | Inspect one queued or finished job |
remote get-status | Inspect saved verification records for a program |
The command layer parses strings into Solana addresses before it calls the API functions. It also resolves the remote server from the selected cluster or the --remote-url override. This keeps address and service selection at the CLI boundary and lets the client operate on typed program and signer identities. src/main.rs src/main.rs src/…/mod.rs
References: src/main.rs• L378-410 src/main.rs• L654-679 src/…/mod.rs• L5-9
Change checklist
When these files or sections are changed, remember to consider these:
- Keep the remote endpoint paths and JSON field names aligned with the external service contract. The client builds the submission body inline and deserializes response bodies into the models.
- Keep the cluster-to-server mapping and
--remote-urloverride behavior aligned with the CLI help. A change can silently send requests to the wrong verification service. - Keep
JobStatusvalues aligned with the service. Polling and final-result handling depend on thein_progress,completed,failed, andunknownvalues. - Keep the program-and-signer PDA rules aligned with remote submission. A mismatch can submit the wrong verification record or reject a valid job.
- Keep the deployment-slot lookup aligned with the Solana account JSON shape. The upload path needs the program account's
programDatalink and the program-data account's slot. - Keep the remote API functions re-exported from src/…/mod.rs when their CLI call sites change. The command layer depends on that public module boundary.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| The RPC cluster is not mainnet or devnet and no remote URL override is given | The CLI cannot select a remote verification service | Pass --remote-url or use a supported cluster |
| Remote submission uses a program and uploader with no matching verification PDA | The client does not send a remote job | Read the PDA before submission and upload verification data first |
The service returns a success body that does not match VerifyResponse | The request ID cannot be obtained and polling stops | Treat response parsing as part of the submission contract |
A job reaches failed or unknown | The CLI reports that the program is not verified | Show the service message or job details and inspect the job logs when available |
| Executable and on-chain hashes differ | The build does not count as verified | Compare both hashes before reporting success |
| Program or program-data account lacks the expected parsed field | Verification data cannot include a deployment slot | Use an RPC endpoint that returns parsed account data for the deployed program |
Key files
| File | Why to read it |
|---|---|
| src/…/client.rs | Shows the remote service boundary, server selection, submission flow, polling loop, status lookups, and user-facing outcomes |
| src/…/models.rs | Defines the job, error, verification, and saved-status data contracts |
| src/…/solana.rs | Shows how the client follows Solana program account data to find the last deployed slot |
| src/…/mod.rs | Shows the small public API used by the CLI |
| src/main.rs | Maps CLI remote commands, remote URL selection, and the shared RPC connection to API operations |
| src/solana_program.rs | Explains the verification PDA, on-chain build record, and upload relationship used by the API integration |