Bitcoin Forum
September 30, 2025, 03:41:40 AM *
News: Latest Bitcoin Core release: 29.0 [Torrent]
 
  Home Help Search Login Register More  
  Show Posts
Pages: [1]
1  Bitcoin / Bitcoin Technical Support / Re: HD wallets and change addresses on: March 12, 2020, 08:42:58 AM
The wallet part mentioned by you is absolutely correct. I have been going through Github repos of many HD wallets such as Trust, Electrum, Atomic, etc and also created some testnet wallets on them too. I was just confused as to how they manage and sign the txs on the runtime. The codes are too complex and I can understand the overall picture but struggle to code such thing. Your explanations made things clear and I am now hoping to go forward with this info
2  Bitcoin / Bitcoin Technical Support / Re: HD wallets and change addresses on: March 12, 2020, 05:04:51 AM

- All addresses are exactly equal. The wallet (internally) categorize them for convenience.
Usually user chooses an address amount "receiving addresses" for example at m/x'/y'/z'/0/0 and receives some coins in the corresponding address. Then moves to next address m/x'/y'/z'/0/1 to receive again, and so on.

Thank you for the clarification, I can not understand well how the things are working



- When the user wants to spend they spend the same coins using the same key (m/x'/y'/z'/0/0 and m/x'/y'/z'/0/1) but they send all the leftover to an address created by a new key like m/x'/y'/z'/1/0 then next spend's remainder goes to the address created from key at m/x'/y'/z'/1/1 and so on.

Suppose I receive 1 btc to m/x'/y'/z'/0/0. Now I send 0.2 btc to someone else. So I will now have 0.8 btc in m/x'/y'/z'/1/0. Then I again recive 1 btc which will go to m/x'/y'/z'/0/1. Now suppose I want to spend all my btc. So do I have to sign txs using the PKs of both m/x'/y'/z'/1/0 and m/x'/y'/z'/0/1?


Thank you for the help
3  Bitcoin / Bitcoin Technical Support / Re: HD wallets and change addresses on: March 11, 2020, 12:09:35 PM
So to spend those amounts in change address, do I have to sign the txs using the PK of  m/x'/y'/z'/1 or  m/x'/y'/z'/0?
If so, are  m/x'/y'/z'/0 addresses just for receiving and  m/x'/y'/z'/1 addresses just for sending?
Thank you for the help
4  Bitcoin / Bitcoin Technical Support / HD wallets and change addresses on: March 11, 2020, 09:43:42 AM
I am reading all theory of how HD wallets generate change addresses after a tx but have never seen how to programmatically work with it. I am currently working to genarate a POC of HD wallet which supports a change address feature. I have ideas how this all work but have no idea how to start programmatically.

I have some questions which I was hoping I can get resolved

    I know how to generate a change address, but how will I keep track of what account is using which change address?

    If the user wants to send some btcs to someone else, then would it from chnage address or do I have to generate a new address to spent that?

Any help is appreciated. Let me know if I can add some more details if necessary
Pages: [1]
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!