Author

Topic: Taproot getting an address (Read 60 times)

legendary
Activity: 1568
Merit: 6660
bitcoincleanup.com / bitmixlist.org
January 25, 2024, 06:14:33 AM
#2
Hi, I don't think generation of Taproot keys is supported in BitcoinJ yet: https://github.com/bitcoinj/bitcoinj/issues/1949

Read the last message by msgilligan:

Quote
WIP PR #3342 adds P2TR support to bitcoinj keychains. The comment on that PR explains what additional work is needed.

And also from reading the release notes, it seems like you can send a transaction amount to someone else's taproot address, which is simple because the scriptpubkey is very similar to Segwit v0, but you can't receive addreses to your own taproot address in BitcoinJ (because that feature doesn't exist) or spend them.
member
Activity: 96
Merit: 36
December 26, 2023, 05:29:01 AM
#1
getting an address

I use bitcoin to easily get a bitcoin address from Seed

Quote
byte[] seed = PBKDF2SHA512.derive(seedCode, "mnemonic", 2048, 64);
      DeterministicKey deterministicKey = HDKeyDerivation.createMasterPrivateKey(seed);
      deterministicKey = HDKeyDerivation.createMasterPrivateKey(seed);
      deterministicKey = HDKeyDerivation.deriveChildKey(deterministicKey, new ChildNumber(0, true));
      deterministicKey = HDKeyDerivation.deriveChildKey(deterministicKey, new ChildNumber(0, false));
      for (int i = 0; i <= deep; i++) {
         temp = (Address.fromKey(MainNetParams.get(),
               HDKeyDerivation.deriveChildKey(deterministicKey, new ChildNumber(i, false)),
               Script.ScriptType.P2WPKH)).toString();
         adressAndseed.add(temp + " " + seedCode);
      }

how do I change this code to get a taproot type address? the latest version of bitcoinJ does not help

Tell me please.
Jump to: