Bitcoin Forum
August 25, 2024, 03:16:36 PM *
News: All versions of Windows are affected by a critical security bug; make sure you update.
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Taproot getting an address  (Read 54 times)
Sanka555 (OP)
Member
**
Offline Offline

Activity: 96
Merit: 36


View Profile
December 26, 2023, 10: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.
NotATether
Legendary
*
Offline Offline

Activity: 1708
Merit: 7179


In memory of o_e_l_e_o


View Profile WWW
January 25, 2024, 11: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.

Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!