|
@ -29,11 +29,12 @@ Validating a Bitcoin address: |
|
|
var Address = require('bitcore/Address').class(); |
|
|
var Address = require('bitcore/Address').class(); |
|
|
|
|
|
|
|
|
var addr = new Address("1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa"); |
|
|
var addr = new Address("1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa"); |
|
|
|
|
|
|
|
|
try { |
|
|
try { |
|
|
addr.validate(); |
|
|
addr.validate(); |
|
|
console.log("Address is valid!"); |
|
|
console.log("Address is valid."); |
|
|
} catch(e) { |
|
|
} catch(e) { |
|
|
console.log("Address is not valid.") |
|
|
console.log(addr.data + " is not a valid address. " + e); |
|
|
} |
|
|
} |
|
|
``` |
|
|
``` |
|
|
|
|
|
|
|
|