title: Dogecoin address validation, on nodejs
body: <p>i'm trying to validate a dogecoin address using node.js javascript.</p>
  
  <p>But i'm still trying to understand, the algorithm.</p>
  
  <p>my current node.js version is <strong>v0.10.22</strong></p>
  
  <p>from what i was able to understand (correct me if i'm wrong) its a dogecoin address is no different from a bitcoin address.</p>
  
  <p>So i try to do the following</p>
  
  <ol>
  <li>Base58 decode the address</li>
  <li>calculate sha256 of the returned result of a sha256 of the decoded address (two times sha256)</li>
  <li>do a comparison of the first 4 bytes of sha256 result with the last 4 bytes of the decoded address <em>(i think i'm making a mistake here) ..</em></li>
  </ol>
  
  <p>when i attempted to write this to javascript the base58 decoded result is correct, when i try to create a buffer from the decoded value , it throws error pointing that the value is <em>not</em> correct</p>
  
  <p><code>var decodedHex = new Buffer(decodedBase58Result,'hex')</code></p>
  
  <p>the above throws an error, if i do <code>decodedBase58Result.toString()</code> which will stringify the number the script continues but doesn't return expected result.</p>
  
  <p>So, is there a solution to this? <strong>without depending on third-party api calls</strong>
  <hr/>
  <strong>Update:</strong>
  i researched a lot and i found a client-side validator, with a small piece of code i made an npm package </p>
  
  <ul>
  <li><a href="https://www.npmjs.org/package/cryptoaddress-validator" rel="nofollow">NPM package</a></li>
  <li><a href="https://github.com/geophoenix/cryptoaddress-validator" rel="nofollow">GitHub</a></li>
  </ul>
  
  <p>which validates the address without relying on any third party api/service calls.</p>