Post
Topic
Board Development & Technical Discussion
Re: Python code for validating bitcoin address
by
matmar10
on 28/11/2012, 09:02:58 UTC
I too have PHP and Java code for validating and generating Bitcoin addresses that have been tested and known to work.

PHP Example Link: https://github.com/Xenland/Bitcoin-Pseudocode-Client/blob/gh-pages/examples/php/verify_bitcoin_address.php

Java Example Source Link: https://github.com/Xenland/Bitcoin-Pseudocode-Client/blob/gh-pages/examples/java/Commandline%20Generate%20Bitcoin%20Address/src/commandline/CommandLine.java

I Also have an English explanation of how to verify a Bitcoin address (Part of the Bitcoin Pseudocode client project)
http://xenland.github.com/Bitcoin-Pseudocode-Client/verifyaddress.html


Thanks for this contribution! I ran the test fixtures for valid and invalid public keys listed below, with a few of my own known keys added; I got the following result:

There was 1 failure:

1) Lmh\BitcoinTransferBundle\Tests\BitcoinAddressValidatorTest::testInvalid
Test invalid public key '37qgekLpCCHrQuSjvX3fs496FWTGsHFHizjJAs6NPcR47aefnnCWECAhHV6E3g4YN7u7Yuwod5Y' returns 1 error.
Failed asserting that 0 matches expected 1.

/Users/matmar10/Projects/bitcoinbymobile/src/Lmh/BitcoinTransferBundle/Tests/BitcoinAddressValidatorTest.php:69

FAILURES!
Tests: 2, Assertions: 22, Failures: 1.

By the way, your PHP code had an undefined variable throwing an error and also an unused variable; I'll send you a git push request.