CoreBitcoin icon indicating copy to clipboard operation
CoreBitcoin copied to clipboard

testnet extended keys/watch only testing?

Open Fonta1n3 opened this issue 7 years ago • 3 comments

Im unable to get testnet extended key (tpriv and tpub), only xpriv and xpub. Is this by design or am I missing something?

let keychain = mnemonic.keychain.bitcoinTestnet.derivedKeychain(withPath: "m/44'/0'/0'/0") let xpub = keychain?.bitcoinTestnet.extendedPublicKey let xpriv = keychain?.bitcoinTestnet.extendedPrivateKey

Thanks in advanced. I am trying to test that the xpriv receiving funds from watch only addresses actually receive the funds, without using real Bitcoin. It is proving a challenge. Any tips would be greatly appreciated.

Fonta1n3 avatar Jun 13 '18 18:06 Fonta1n3

Uh-oh, seems like it's a bug. I looked in the code and there are at least couple of places where we should set correct .network property on a keychain. Meanwhile, you can workaround the issue by setting keychain.network = BTCNetwork.testnet after you've derived your keychain. When these bugs are fixed, that would be an unnecessary no-op.

oleganza avatar Jun 13 '18 18:06 oleganza

Ho Oleg,

Just fyi.

Thanks for that advice, I tried to declare keychain.network = BTCNetwork.testnet but xcode gives use of unresolved identifier 'BTCNetwork' error.

I have tried inputting the testnet parameter everywhere I can but never get the tpriv.

Fonta1n3 avatar Jun 28 '18 22:06 Fonta1n3

Any updates on this? Using this library again for seed creation/derivation and need to test with tpub and still have the same issue. Have to hardcode a tpub for now which is not great.

Fonta1n3 avatar Dec 09 '19 03:12 Fonta1n3