Closed awaik closed 1 year ago
Hi @awaik
When creating a descriptor from a string the descriptor should be correctly formed:
See this https://github.com/bitcoin/bitcoin/blob/master/doc/descriptors.md and https://bitcoindevkit.org/descriptors/
Updating your code to the following will work:
descriptorTest() async {
final mnemonic = await Mnemonic.fromString(
'puppy interest whip tonight dad never sudden response push zone pig patch');
final descriptorSecretKey = await DescriptorSecretKey.create(
network: Network.Testnet,
mnemonic: mnemonic,
);
final derivationPath = await DerivationPath.create(path: "m/44h/1h/0h");
final descriptorPrivateKey =
await descriptorSecretKey.derive(derivationPath);
final descriptorPublicKey = await descriptorPrivateKey.asPublic();
final Descriptor descriptorPrivate = await Descriptor.create(
descriptor: "pkh(${descriptorPrivateKey.toString()})",
network: Network.Testnet,
);
final Descriptor descriptorPublic = await Descriptor.create(
descriptor: "pkh(${descriptorPublicKey.asString()})",
network: Network.Testnet,
);
final descriptorPublicString = await descriptorPublic.asString();
final descriptorPrivateString = await descriptorPrivate.asString();
print(descriptorPublicString);
print(descriptorPrivateString);
}
Thank you, it works.
Hi! Can you please help - how to create descriptors with DerivationPath that is not pre-defined in the plugin.
For example, I create xprv + xpub
It works.
After that, I'm trying to create descriptors with
and got the error
Unhandled Exception: BdkException.miniscript(e: "))))