Crypto

This document outlines the crypto we use to make keypairs, wallets and addresses. We use the ED25519 curve in Axentro.

The following examples are written in Javascript and use these libraries:

Creating a keypair

var generateValidKeyPair = function myself() {
  var nacl = all_crypto.tweetnacl;
  var keyPair = nacl.sign.keyPair();
  var fullPrivateKey = toHexString(keyPair.secretKey);
  var publicKey = toHexString(keyPair.publicKey);
  var privateKey = fullPrivateKey.replace(publicKey, "");

  return {
    hexPrivateKey: privateKey,
    hexPublicKey: publicKey
  };
};

function toHexString(byteArray) {
  return Array.prototype.map.call(byteArray, function(byte) {
    return ('0' + (byte & 0xFF).toString(16)).slice(-2);
  }).join('');
}

Network Prefix

The network prefix is added to the address to make the final walle address and can be either:

  • Mainnet network prefix is: M0

  • Testnet network prefix is: T0

Creating a wallet address

Once you have a keypair you can use the public key and the network prefix to make a wallet address:

WIF (Wallet Information Format)

In the Axentro standard wallet format we put the private key in WIF format. You can build the WIF like this:

Getting items out

From a WIF we can get the private key and network type:

From a private key we can get the public key

Last updated

Was this helpful?