1

I'm currently using this as a way to check if Monero addresses are valid in my application. However, it does not check sub-addresses and I'm trying to filter integrated addresses out.

I can't find any info on the web to check if a Monero subaddress is valid and it would be nice if I didn't have to use RPC.

2 Answers 2

1

You do not need to use the RPC to do things such as validating an address. See the source code for https://xmr.llcoins.net/addresstests.html, as that shows how you can decode an address using just javascript.

Also see https://monerodocs.org/public-address/standard-address/ and https://monerodocs.org/public-address/subaddress/.

1
1

Standard addresses and subaddresses have the exact same format, with the difference between them being the value of the "network byte".

For mainnet, and you don't mind being a bit hacky, you can run the code you point to. If it doesn't like the address, then check if it starts with '8'. If yes, replace 8 with 4 and try again. If it likes it, it was a subaddress.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.