libbitcoin-perl icon indicating copy to clipboard operation
libbitcoin-perl copied to clipboard

Generated address showing as invalid on any bitcoin Block Explorer

Open ghost opened this issue 9 years ago • 1 comments

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)

ghost avatar Jul 31 '16 14:07 ghost

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

jes avatar Aug 28 '16 10:08 jes