deriveBIP32Ec8 function

Future<NodeWithAddress> deriveBIP32Ec8({
  1. required List<int> derivationPath,
  2. required Uint8List seed,
})

Implementation

Future<NodeWithAddress> deriveBIP32Ec8({
  required List<int> derivationPath,
  required Uint8List seed,
}) async {
  final String derivationPathString = _derivationPathToString(derivationPath);

  bip32.BIP32 seedNode = bip32.BIP32.fromSeed(seed);
  final bip32.BIP32 childNode = seedNode.derivePath(derivationPathString);

  const compressed = false; // needed for address backwards compat
  final publicKey = ecc.pointFromScalar(childNode.privateKey!, compressed)!;
  final address = pubKeyToAddress(
    publicKey,
    AddressType.legacy,
    EurocoinNetwork,
  );

  return ChangeNode(
    bip32Node: childNode,
    address: address,
    derivationPath: "", //
    addresses: {AddressType.legacy: address},
    walletPurpose: HDWalletPurpose.BIP44,
    publicKey: childNode.publicKey.toHex,
  );
}