0

I need to validate Bitcoin addresses in an application I'm developing; I have found various code samples for various languages (even on StackOverflow), but none specific for the one I am using (C#); also, all of those samples seem to come from volunteers around the world, but I've been unable to find an "official" reference algorithm for address validation.

This links explains how an address is generated, but even it has some dubious statements, like "this is the most commonly used Bitcoin Address format" at the end of the article; also, it doesn't explain how to actually validate one if you're not doing the address generation.

What is the official, reference algorithm for checking the validity of a Bitcoin address?

Of course, I'm only interested in syntactic validity; I don't care if the address was ever actually used, if it has any Bitcoin balance, or if the user really is in possession of the associated private key.

Please avoid code samples, as they are language-specific; what I'm asking for is a detailed description of the steps required for validation, so that it can be implemented in any language of choice.

1

1 Answer 1

1

Please avoid code samples, as they are language-specific; what I'm asking for is a detailed description of the steps required for validation, so that it can be implemented in any language of choice.

You won't find any documentation other than the wiki which is generally out of date and incorrect, so code samples will have to do. Check the reference client Bitcoin Core, and some of the JavaScript implementations in BitcoinJS. It's not difficult, just base58 encoding with a version byte of 0x01 at the front and a truncated hash at the rear. P2SH transactions have a different version byte but are still valid in the same fashion.

2
  • ...are you seriously saying that there is no official documentation and all you can do is reverse-engineer it from the client software?!? :-o
    – Massimo
    Commented Mar 5, 2014 at 19:41
  • The Bitcoin Core software the documentation, and the wiki has some generally out of date technical details. I'm quite serious, but thankfully the core client is extremely readable. If you want to change things you can write some documentation, but nobody likes doing that.
    – user13413
    Commented Mar 5, 2014 at 19:43

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.