Skip to content
Cosmopediaby Unity Nodes
DiscussionsEthermintValidate cosmos address in solidity?Forum ↗

Validate cosmos address in solidity?

Ethermint2 posts1,361 views1 likesLast activity May 2021
KO
kombosOP
May 2021 1

i want to validate a cosmos address in solidity which should return true or false for valid or invalid respectively. I believe this would involve doing bech32 validation with the following checks:

  1. check if hrp is valid (“cosmos”)
  2. check if the subsequent character is “1”
  3. check the checksum validity

would these steps suffice or should there be more validations? also any source of contract logic for these checks (especially the third).

CA
catdotfish
May 2021

Hihi :paw_prints:
Technical support by Core Devs is provided within the cosmos Discord Server.
Please use this link to join the community and post your question in the #general-dev channel.

← Back to Discussions