Skip to content

Useful Queries

Andrew Plaza edited this page Aug 30, 2021 · 12 revisions

List of some queries I've found to be useful.

Get all encoded storage items under a specific prefix (Example queries for SystemAccount)

-- Query for all storage items under a specific key prefix

SELECT encode(storage::bytea, 'hex'), block_num FROM
(SELECT storage.key, storage.storage, storage.block_num, blocks.spec FROM storage, blocks
WHERE
	storage.key like (E'\\x26aa394eea5630e07c48ae0c9558cef7b99d880ec681799c0cf30e8886371da9')::bytea||'%'
AND
	blocks.block_num = storage.block_num
AND
	blocks.spec = 2023) as z
    ORDER BY block_num

Clone this wiki locally