Squid Substrate metadata explorer
Reference page of the squid-substrate-metadata-explorer command line tool

Installation

The Squid substrate metadata explorer tool is part of Subsquid SDK and is used for extracting metadata information about a specific chain.
This is useful for monitoring Runtime updates for a chain and how Events and Extrinsics definitions might have changed, consequently. The result of blockchain exploration is saved in a JSON file.
Note: in the context of this guide, we assume the Development Environment has been already set up and that npm is used, although other options are available.
To install substrate metadata explorer tool, simply run this in a console.
1
npm install @subsquid/squid-substrate-metadata-explorer
Copied!
Once installed, check available commands by running
1
npx squid-substrate-metadata-explorer --help
Copied!
Which will print out a help.
1
Usage: squid-substrate-metadata-explorer squid-substrate-metadata-explorer --chain <ws://> --out <file> [options]
2
3
Explores chain spec versions.
4
5
It scans the chain and finds all blocks where new spec version was introduced.
6
The result of exploration is saved in a json file:
7
8
[
9
{
10
"specVersion": 1,
11
"blockNumber": 10,
12
"blockHash": "0x..",
13
"metadata": "0x.."
14
},
15
...
16
]
17
18
If the output file already exists, exploration will start from the last known block.
19
The resulting file will be updated with new data.
20
21
Options:
22
--chain <ws://> chain rpc endpoint
23
--out <file> output file
24
--archive <url> squid substrate archive (significantly speedups exploration)
25
-h, --help display help for command
Copied!

Options for squid-substrate-metadata-explorer command

Argument
Description
Required
-h or --help
display help for command
--chain
chain RPC endpoint
yes
--out <file>
name of the file the output should be written to
yes
--archive <url>
squid substrate archive (significantly speedups exploration)
no

Output file structure

The output JSON file contains a series of objects, each representing the various spec versions encountered. It typically has this structure:
1
[
2
{
3
"specVersion": 1,
4
"blockNumber": 10,
5
"blockHash": "0x..",
6
"metadata": "0x.."
7
},
8
...
9
]
Copied!
This is a brief description of the various fields:
Key
Description
specVersion
version number of the encountered spec
blockNumber
number of the starting block of current spec
blockHash
hash of the starting block of the current spec
metadata
encoded metadata of the given spec
For a more in-depth explanation of the subject, head over to the dedicated page and for a practical guide, take a look at the dedicated Recipe.