Implementation
Uint8List derivePrivateKey(String seed, int index) {
//Derive master keys
crypto.Hmac hmac = crypto.Hmac(crypto.sha512, Uint8List(0));
crypto.Digest digest = hmac.convert(utf8.encode(seed));
final Uint8List masterKey = Uint8List.fromList(digest.bytes.sublist(0, 32));
final Uint8List masterEntropy =
Uint8List.fromList(digest.bytes.sublist(32, 64));
//Derive the final seed
hmac = crypto.Hmac(crypto.sha512, masterEntropy);
final Uint8List indexBuf = encodeInt32(index);
final Uint8List extendedSeed = concatUint8List([masterKey, indexBuf]);
digest = hmac.convert(extendedSeed);
final Uint8List hmacBuf = Uint8List.fromList(digest.bytes.sublist(0, 32));
return hmacBuf;
}