How do you generate a NXT / Ardor address using javascript only?

0

I'm looking for a way to generate an nxt/ardor address using only a javascript library and without having to be online. Is there a js library that can generate a nxt/ardor account by passing in the secret passphrase as a parameter?

Patoshi パトシ

Posted 2016-12-22T19:57:18.603

Reputation: 8 911

Answers

1

Codepen Example: http://codepen.io/satoshinakamoto/pen/ObGwXy?editors=1010

Yes, you can generate the nxt/ardor address by using the following function call:

NRS.getAccountId('asdf'); //Generates the

NRS.convertNumericToRSAccountFormat(NRS.getAccountId('asdf')); //Converts that ID to RS (reed solomon) format

Found in html/ui/js/nrs.encryption.js

enter image description here

You will need the following html setup and js files to generate nxt addresses without the need to be online:

<!DOCTYPE html>
<head>
    <meta charset="UTF-8">
</head>
<body>

  <h2>Welcome</h2>


    <script src="js/3rdparty/jquery-2.2.0.min.js"></script>



    <script src="js/3rdparty/jsbn.js" type="text/javascript"></script>
    <script src="js/3rdparty/jsbn2.js" type="text/javascript"></script>

    <script src="js/util/extensions.js" type="text/javascript"></script>
    <script src="js/util/converters.js" type="text/javascript"></script>
    <script src="js/util/nxtaddress.js" type="text/javascript"></script>

    <script src="js/crypto/curve25519.js" type="text/javascript"></script>
    <script src="js/crypto/3rdparty/cryptojs/sha256.js" type="text/javascript"></script>


    <script src="js/nrs.js" type="text/javascript"></script>
    <script src="js/nrs.util.js" type="text/javascript"></script>
    <script src="js/nrs.encryption.js" type="text/javascript"></script>





    <script>

    $(document).ready(function() {


      hello = NRS.convertNumericToRSAccountFormat(NRS.getAccountId('ahmin'));   

      $('body').append(hello);


    });

    </script>

</body>
</html>

Patoshi パトシ

Posted 2016-12-22T19:57:18.603

Reputation: 8 911