grondilu / libbitcoin-perl

bitcoin perl library
19 stars 12 forks source link

Generated address showing as invalid on any bitcoin Block Explorer #3

Open ghost opened 8 years ago

ghost commented 8 years ago

I used this lib to generate bitcoin private key and corresponding bitcoin address:

use lib "./lib"; use Bitcoin; my $private_key = random Bitcoin::Key; my $address = $private_key->address;

but when I try to query it on any Bitcoin block explorer, I got info that my address is invalid.

For example, generated private key: 92Fk6Zk2VEjE32swoWrVvJdV39VqHaBWR3tSYMyZxsjwYwRwSda corresponding address: mzitbXSyuN5hYMdRr9tZP9F97riBVq1y6r

BlockChain (https://blockchain.info/address/mzitbXSyuN5hYMdRr9tZP9F97riBVq1y6r) throws error: "Unrecognized Address Version 111".

(I am using perl version 5.18)

jes commented 8 years ago

That's a testnet address. You need to set the environment variable BITCOIN_TEST=no to generate mainnet addresses.