You can bech32 decode an address to check the address in raw form (for a given payment address, assume first 58 chars will be the same).
Thus:
echo addr1q8hsff3uwtphx7dtya7unjwjwug52e5jvqp09je6pwqx8k4jvuxrw2x5rr7e258a33yzkrhhlrrc5ezvd2z7qtdq0gasme44c9 | bech32 | cut -b -58
# 01ef04a63c72c37379ab277dc9c9d277114566926002f2cb3a0b8063da
Now, to "query a chain" , let's assume you're using dbsync
. You would be able to query tx_out table for all values in address_raw
field that start with 01ef04a63c72c37379ab277dc9c9d277114566926002f2cb3a0b8063da
as below:
select address_raw from tx_out where ENCODE(address_raw,'hex') LIKE '01ef04a63c72c37379ab277dc9c9d277114566926002f2cb3a0b8063da%';
# address_raw
# ----------------------------------------------------------------------------------------------------------------------
# \x01ef04a63c72c37379ab277dc9c9d277114566926002f2cb3a0b8063dab2670c3728d418fd9550fd8c482b0ef7f8c78a644c6a85e02da07a3b
# \x01ef04a63c72c37379ab277dc9c9d277114566926002f2cb3a0b8063dab2670c3728d418fd9550fd8c482b0ef7f8c78a644c6a85e02da07a3b
# \x01ef04a63c72c37379ab277dc9c9d277114566926002f2cb3a0b8063dab2670c3728d418fd9550fd8c482b0ef7f8c78a644c6a85e02da07a3b
# \x01ef04a63c72c37379ab277dc9c9d277114566926002f2cb3a0b8063dab2670c3728d418fd9550fd8c482b0ef7f8c78a644c6a85e02da07a3b
# \x01ef04a63c72c37379ab277dc9c9d277114566926002f2cb3a0b8063dab2670c3728d418fd9550fd8c482b0ef7f8c78a644c6a85e02da07a3b
# \x01ef04a63c72c37379ab277dc9c9d277114566926002f2cb3a0b8063dab2670c3728d418fd9550fd8c482b0ef7f8c78a644c6a85e02da07a3b
# \x01ef04a63c72c37379ab277dc9c9d277114566926002f2cb3a0b8063dab2670c3728d418fd9550fd8c482b0ef7f8c78a644c6a85e02da07a3b
# \x01ef04a63c72c37379ab277dc9c9d277114566926002f2cb3a0b8063dab2670c3728d418fd9550fd8c482b0ef7f8c78a644c6a85e02da07a3b
# \x01ef04a63c72c37379ab277dc9c9d277114566926002f2cb3a0b8063dab2670c3728d418fd9550fd8c482b0ef7f8c78a644c6a85e02da07a3b
# \x01ef04a63c72c37379ab277dc9c9d277114566926002f2cb3a0b8063dab2670c3728d418fd9550fd8c482b0ef7f8c78a644c6a85e02da07a3b
# \x01ef04a63c72c37379ab277dc9c9d277114566926002f2cb3a0b8063dab2670c3728d418fd9550fd8c482b0ef7f8c78a644c6a85e02da07a3b
# \x01ef04a63c72c37379ab277dc9c9d277114566926002f2cb3a0b8063dab2670c3728d418fd9550fd8c482b0ef7f8c78a644c6a85e02da07a3b
# \x01ef04a63c72c37379ab277dc9c9d277114566926002f2cb3a0b8063dab2670c3728d418fd9550fd8c482b0ef7f8c78a644c6a85e02da07a3b
# \x01ef04a63c72c37379ab277dc9c9d277114566926002f2cb3a0b8063dab2670c3728d418fd9550fd8c482b0ef7f8c78a644c6a85e02da07a3b
# (14 rows)
#
# Time: 10639.159 ms (00:10.639)
#
PS: Note that this is a list of all used addresses on chain that use the mentioned payment key (as ofcourse - just creating an address can have unlimited possibilities off-chain).