Post
Topic
Board Development & Technical Discussion
Merits 1 from 1 user
Topic OP
Private key and filling change in bitcoin core v0.1
by
Tfs
on 05/03/2025, 08:41:46 UTC
⭐ Merited by ABCbits (1)
Hello,

In bitcoin core v0.1 in the file main.cpp starting at line 2514 there is a function CreatTransaction there is a part as follows

// Fill vin
                foreach(CWalletTx* pcoin, setCoins)
                    for (int nOut = 0; nOut < pcoin->vout.size(); nOut++)
                        if (pcoin->vout[nOut].IsMine())
                            wtxNew.vin.push_back(CTxIn(pcoin->GetHash(), nOut));

I believe this is where a new adress is created for the change, is that correct? If so, how is it created exactly? I mean I am scanning the code to find where exactly is computed the private key of the change adress.