I have an application where I create an HD wallet with a passphrase and save the public master key to the database for the user.
Then, I want the user to be able to back up the wallet to their own wallet, in this case I am using Wallet32. I restore the account in Wallet32, which uses a key path of m/44'/0'/0'/
On my application side, I am creating the keypath like so (in c#):
KeyPath newKeyPath = new KeyPath("44/0/0/0/0" + nextDerivation); var childKey = pubkey.Derive(newKeyPath);
The nextDerivsation variable just increments with each purchase. When the derived public key is created on the application side, it doesn't match up with a derived public key in wallet32. So, if a payment is made through the application, Wallet32 doesn't pick it up.
I am using the C# NBitcoin library. When I try to add the apostrophes in the keyPath string like so:
KeyPath newKeyPath = new KeyPath("44'/0'/0'/0/0" + nextDerivation); var childKey = pubkey.Derive(newKeyPath);
Then I get an "invalid input format" error. I am unsure as to whether those apostrophes are necessary or not, but when I input that same derivation path into the Bip32 generator, then I can create the same public keys. I can send a payment to the derived address and wallet32 picks it up.
Can anyone point me in the right direction on what I need to use for the KeyPath in the NBitcoin library to obtain the same results?