Skip to content

Instantly share code, notes, and snippets.

@toschdev
Created July 4, 2017 09:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save toschdev/c5e12d5122238612ad2650bc4ad9c4cc to your computer and use it in GitHub Desktop.
Save toschdev/c5e12d5122238612ad2650bc4ad9c4cc to your computer and use it in GitHub Desktop.
Lisk calculate publicKey and address from passphrase
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Lisk passphrase to publicKey</title>
</head>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
<body>
<div class="container">
<form class="form-signin">
<h2 class="form-signin-heading">Passphrase to PublicKey</h2>
<label for="inputPassphrase" class="sr-only">Passphrase</label>
<input type="password" id="inputPassphrase" class="form-control" placeholder="YourSecretPassphrase" required="" autofocus="">
<br/>
<button class="btn btn-lg btn-primary btn-block" type="submit" id="calc">Calculate</button>
</form>
<div class="row">
<div class="col-md-12">
<h3>Output</h3>
<div class="jumbotron">
<b>PublicKey: </b> <span id="pubKey"></span>
<br/>
<b>Address:</b> <span id="address"></span>
<br/>
</div>
</div>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.2.1.min.js"
integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4="
crossorigin="anonymous"></script>
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<script src="https://gitcdn.xyz/repo/LiskHQ/lisk-js/development/dist/lisk-js.js"></script>
<script>
$("#calc").on("click", function (e) {
e.preventDefault();
var keys = lisk.crypto.getPrivateAndPublicKeyFromSecret($("#inputPassphrase").val());
$("#pubKey").html(keys.publicKey);
var address = lisk.crypto.getAddressFromPublicKey(keys.publicKey);
$("#address").html(address);
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment