You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
1.3 KiB
52 lines
1.3 KiB
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<title>Bitcore browser examples</title>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
</head>
|
|
<body>
|
|
<div id='content'></div>
|
|
<script src="../browser/bundle.js"></script>
|
|
|
|
<script type="text/javascript">
|
|
|
|
print = function(s){
|
|
var div = document.getElementById('content');
|
|
div.innerHTML += s + '<br />';
|
|
};
|
|
|
|
var Address = bitcore.Address.class();
|
|
|
|
var addrStrings = [
|
|
"1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa",
|
|
"1A1zP1eP5QGefi2DMPTfTL5SLmv7Dixxxx",
|
|
"A1zP1eP5QGefi2DMPTfTL5SLmv7Dixxxx",
|
|
"1600 Pennsylvania Ave NW",
|
|
].map(function(addr) {
|
|
return new Address(addr);
|
|
});
|
|
|
|
addrStrings.forEach(function(addr) {
|
|
|
|
try {
|
|
addr.validate();
|
|
print(addr.data + ": is a valid address");
|
|
} catch(e) {
|
|
print(addr.data + ": is not a valid address.");
|
|
}
|
|
|
|
});
|
|
|
|
|
|
var Key = bitcore.KeyModule.Key;
|
|
var k = Key.generateSync();
|
|
|
|
print ('Generated Key Pair:');
|
|
print ('Private:' + bitcore.buffertools.toHex(k.private));
|
|
print ('Public:' + bitcore.buffertools.toHex(k.public));
|
|
|
|
|
|
</script>
|
|
</body>
|
|
</html>
|
|
|