Smart Contract Verification Websocket Events
This guide explains how to subscribe to websocket notifications related to smart contract verification. It covers:- verification result notifications
- automated source lookup lifecycle notifications
- legacy and V2 websocket namespaces
1. Which Socket To Use
Blockscout exposes two websocket endpoints:- Legacy UI socket:
/socket - V2 socket:
/socket/v2
2. Topic Format
Subscribe to an address topic.- Legacy topic:
addresses_old:<address_hash> - V2 topic:
addresses:<address_hash>
addresses_old:0xabc123...addresses:0xabc123...
Invalid address hashRestricted access
3. Events You Can Receive
3.1 verification_result
Purpose:
- Final result of a verification attempt (success or validation errors).
addresses:<address_hash>addresses_old:<address_hash>
:on_demand
V2 payload
Success:errorsis generated from changeset errors.- Field names and messages depend on verification flow and validator results.
Legacy behavior
Legacy notifier broadcasts an internal payload withresult, but the legacy address channel intercepts verification_result and pushes event verification to clients.
Legacy client-facing event:
verification
- If the intercepted result is
{:error, %Ecto.Changeset{}}, the channel does not push a websocket message for that event.
3.2 eth_bytecode_db_lookup_started
Purpose:
- Signals that automated lookup in Ethereum Bytecode DB started.
addresses:<address_hash>addresses_old:<address_hash>
3.3 smart_contract_was_verified
Purpose:
- Signals that automated lookup/verification finished with a verified result.
addresses:<address_hash>addresses_old:<address_hash>
3.4 smart_contract_was_not_verified
Purpose:
- Signals that automated lookup/verification finished without verification.
addresses:<address_hash>addresses_old:<address_hash>
4. Event Producers (Server-Side)
contract_verification_result chain event
Produced by verification workers/helpers and then mapped to websocket verification_result:
- Solidity verification worker
- Vyper verification worker
- Stylus verification worker
- Solidity publish helper (including some error paths)
Automated source lookup lifecycle chain events
Produced by on-demand source lookup fetcher and mapped 1:1 to websocket event names:eth_bytecode_db_lookup_startedsmart_contract_was_verifiedsmart_contract_was_not_verified
5. Subscription Example (Phoenix JS)
V2 (recommended)
Legacy
6. Practical Client Flow
Recommended for automation clients:- Submit verification request via HTTP API.
- Immediately subscribe to
addresses:<address_hash>on/socket/v2. - Wait for
verification_resultfor final API-style outcome. - Optionally track automated lookup lifecycle with:
eth_bytecode_db_lookup_startedsmart_contract_was_verifiedsmart_contract_was_not_verified
- API response like “verification started” means the job was accepted, not completed.
- Final state should be taken from websocket events.
- Server currently broadcasts to both legacy and V2 address namespaces for backward compatibility.