You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Although the Zilliqa protocol utilizes 20-byte base16 checksum addresses on the backend, bech32 addresses are widely adopted in the Zilliqa ecosystem by wallets and SDKs. As a result, bech32 addresses are only visible to end users.
For reference, ViewBlock explorer for Zilliqa supports bech32 addresses. See this example. We should also have similar support for bech32 addresses in Blockscout.
UI customizations
For the MVP, we should add support to convert EVM hex addresses (base16) to bech32 format. This change will affect every component that displays raw EVM addresses (0x...). In my vision, the 0x... address components can become clickable, triggering the conversion to bech32 format when clicked. For example 0x87df0306F147e752805261156d5a00d912786B18 should become zil1qzra7qcx79r7w55q2fs32m26qrv3y7rtrk8hjl7 when clicked and vice versa.
Implementation details
To handle the conversion, we can use the bech32 npm package. As I found out, It’s a widely adopted library for this task.
Zilliqa bech32 address structure
Human-readable prefix
Separator
bech32 formatted address
Checksum
Example 1
zil
1
02n74869xnvdwq3yh8p0k9jjgtejruft
268tg8
Example 2
zil
1
48fy8yjxn6jf5w36kqc7x73qd3ufuu24
a4u8t9
Example 3
zil
1
fdv7u7rll9epgcqv9xxh9lhwq427nsql
58qcs9
The prefix for the Zilliqa mainnet is zil, and for the developer testnet, it’s also zil.
The last six characters form a checksum, which contains no additional information.
For further details, refer to the Zilliqa Address Standard (Bech32) documentation here.
Test Cases
base16 Address
bech32 Address
0x7Aa7eA9f4534d8D70224b9c2FB165242F321F12b
zil102n74869xnvdwq3yh8p0k9jjgtejruft268tg8
0x1d19918a737306218b5cbb3241fcdcbd998c3a72
zil1r5verznnwvrzrz6uhveyrlxuhkvccwnju4aehf
To create additional test cases, you can use this online converter, which also is open-source and available on GitHub.
Further bech32 support
It would be cool if we extend this feature to handle bech32 addresses in URLs, allowing links like https://zilliqa.blockscout.com/address/zil102n74869xnvdwq3yh8p0k9jjgtejruft268tg8 to redirect to the correct address page.
The text was updated successfully, but these errors were encountered:
Motivation
Although the Zilliqa protocol utilizes 20-byte
base16
checksum addresses on the backend,bech32
addresses are widely adopted in the Zilliqa ecosystem by wallets and SDKs. As a result,bech32
addresses are only visible to end users.For reference, ViewBlock explorer for Zilliqa supports
bech32
addresses. See this example. We should also have similar support forbech32
addresses in Blockscout.UI customizations
For the MVP, we should add support to convert EVM hex addresses (
base16
) tobech32
format. This change will affect every component that displays raw EVM addresses (0x...
). In my vision, the0x...
address components can become clickable, triggering the conversion tobech32
format when clicked. For example0x87df0306F147e752805261156d5a00d912786B18
should becomezil1qzra7qcx79r7w55q2fs32m26qrv3y7rtrk8hjl7
when clicked and vice versa.Implementation details
To handle the conversion, we can use the bech32 npm package. As I found out, It’s a widely adopted library for this task.
Zilliqa
bech32
address structurebech32
formatted addresszil
1
02n74869xnvdwq3yh8p0k9jjgtejruft
268tg8
zil
1
48fy8yjxn6jf5w36kqc7x73qd3ufuu24
a4u8t9
zil
1
fdv7u7rll9epgcqv9xxh9lhwq427nsql
58qcs9
zil
, and for the developer testnet, it’s alsozil
.For further details, refer to the Zilliqa Address Standard (Bech32) documentation here.
Test Cases
base16
Addressbech32
Address0x7Aa7eA9f4534d8D70224b9c2FB165242F321F12b
zil102n74869xnvdwq3yh8p0k9jjgtejruft268tg8
0x1d19918a737306218b5cbb3241fcdcbd998c3a72
zil1r5verznnwvrzrz6uhveyrlxuhkvccwnju4aehf
To create additional test cases, you can use this online converter, which also is open-source and available on GitHub.
Further
bech32
supportIt would be cool if we extend this feature to handle
bech32
addresses in URLs, allowing links likehttps://zilliqa.blockscout.com/address/zil102n74869xnvdwq3yh8p0k9jjgtejruft268tg8
to redirect to the correct address page.The text was updated successfully, but these errors were encountered: