We rely on the centralized substrate-telemetry to collect the telemetry of the chain. This provides real-time data but comes with associated costs and maintenance.
One alternative for collecting telemetry is a fully decentralized p2p application.
p2p network discovery
In the subp2p-explorer experiment, we are able to crawl the network of any substrate-based chain. After crawling the network for a few minutes, we have enough details to describe a snapshot of the p2p network, including geolocation of peers.
Peer 12D3KooWAdHQjjtvXvkMWMKZYdrnGWG7PQ2Fy4wmUPQEXh9hvcic: Location
{ city: "Ashburn", accuracy_radius: Some(1000), latitude: Some(39.0469), longitude: Some(-77.4903), metro_code: Some(511), time_zone: Some("America/New_York") }
The tool is also capable of:
- crawling the p2p network and collect
identify
protocol information - validate the connectivity of bootnodes from a chainSpec
- submit extrinsics on the p2p network directly
In practice, a small application could submit multiple Kademlia queries to obtain a network snapshot.
We currently miss on the p2p network a protocol dedicated for telemetry.
/genesis/telemetry
Introducing a new p2p notification protocol, that is enabled by default on all substrate based-chains, and disabled when the node is started with -no-telemetry
The protocol is using the /genesis/telemetry/1
id string, and exposes telemetry data including node version, kernel version, OS, cpu etc (Polkadot Telemetry).
Extra block information could be obtained by the decoding the handshake of /genesis/block-announces/1
(BlockAnnouncesHandshake) that contains the best block and the genesis hash.
Light Client
This service could run entirely in the browser, compiling any rust code that collects the data to WASM. One option for doing this is using smoldot, which is already used from within browser environments.
Authority Data
The authority data can be successfully extracted via the AuthorityDiscoveryApi
runtime API.
UI
The substrate-telemetry UI could be reused for this decentralized application.
Would love to hear your thoughts on this
(@tomaka @bkchr @altonen @jsdw)