deriveAddress method

String deriveAddress(
  1. String seed,
  2. int index, {
  3. String curve = 'P256',
  4. String hashAlgo = 'sha256',
})

Derive an address @param {String} seed TransactionChain seed @param {int} index Number of transaction in the chain @param {String} curve Elliptic curve to use ("ed25519", "P256", "secp256k1") @param {String} hashAlgo Hash algorithm ("sha256", "sha512", "sha3-256", "sha3-512", "blake2b")

Implementation

String deriveAddress(String seed, int index,
    {String curve = 'P256', String hashAlgo = 'sha256'}) {
  final KeyPair keypair = crypto.deriveKeyPair(seed, index, curve: curve);
  return uint8ListToHex(crypto.hash(keypair.publicKey, algo: hashAlgo));
}