<blockquote>
  <p>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.</p>
</blockquote>

<p>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. </p>

CC BY-SA 3.0
2014-03-05T19:41:19.123Z
...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
CC BY-SA 3.0
2014-03-05T19:43:12.733Z
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
CC BY-SA 3.0
2014-03-05T19:36:17.277Z
2014-03-05T19:36:17.277Z
user13413
<p>I need to validate Bitcoin addresses in an application I'm developing; I have found <a href="http://rosettacode.org/wiki/Bitcoin/address_validation" rel="nofollow noreferrer">various code samples for various languages</a> (<a href="https://stackoverflow.com/questions/21559851/bitcoin-address-form-validation-javascript-and-php">even on StackOverflow</a>), 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.</p>

<p><a href="https://en.bitcoin.it/wiki/Technical_background_of_Bitcoin_addresses" rel="nofollow noreferrer">This links</a> explains how an address is generated, but even it has some dubious statements, like "this is the <em>most commonly used</em> 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.</p>

<p><strong>What is the official, reference algorithm for checking the validity of a Bitcoin address?</strong></p>

<p>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.</p>

<p>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.</p>

CC BY-SA 3.0
2014-03-05T22:18:59.503Z
While you indicated you weren't interested in code samples, this one is in C# and may have a solution for you: https://github.com/casascius/Bitcoin-Address-Utility/. I've been meaning to check it out myself.
ChrisW
<address>
What is the reference algorithm for validating a Bitcoin address?
Massimo
# What is the reference algorithm for validating a Bitcoin address?

(Asked by: username_0 on 2014-03-05)

I need to validate Bitcoin addresses in an application I'm developing; I have found [various code samples for various languages](http://rosettacode.org/wiki/Bitcoin/address_validation) ([even on StackOverflow](https://stackoverflow.com/questions/21559851/bitcoin-address-form-validation-javascript-and-php)), 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](https://en.bitcoin.it/wiki/Technical_background_of_Bitcoin_addresses) 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.

**Tags:** address

> **Comments:**
> **username_1**: While you indicated you weren't interested in code samples, this one is in C# and may have a solution for you: https://github.com/casascius/Bitcoin-Address-Utility/. I've been meaning to check it out myself.  

---

## 1 answers

### Answer by username_2 on 2014-03-05. Score: 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.

> **Comments:**
> **username_0**: ...are you seriously saying that there is no official documentation and all you can do is reverse-engineer it from the client software?!? :-o  
> **username_2**: 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.  

---

