Ranging from a bit distant, the cash are transferred to the Bitcoin Addresses, that are actually hashes of public keys. They are often spent utilizing their respective personal keys (which is used to generate the general public key and the general public key hash) which is saved within the Pockets.
Your steadiness is the sum of unspent transaction outputs (UTXOs) in your Addresses. You’ll be able to test them manually: within the Bitcoin Core consumer go to Assist > Debug > Console, to test Addresses kind
listaccounts, to test UTXOs kind
While you wish to ship cash to an Tackle your Bitcoin software program goes trough all of your unspent transaction outputs and tries to seek out the very best mixture to fill that quantity (together with transaction payment) utilizing as few as doable. Within the easiest case one UTXO has sufficient coin so solely that will probably be used, in different circumstances extra will probably be mixed.
That is the “in” a part of the transaction.
After this the Bitcoin software program will add the “out” half the place the vacation spot Tackle (or Addresses) you provided will probably be current with the quantity(s). As a UTXO can solely be used up as soon as, all of it have to be transferred. From the remaining the transaction payment will probably be paid and the remaining is the change, that will probably be despatched again to a newly generated Tackle of yours (and this may enhance the “fragmentation” of your Pockets). The change seems as properly within the “out” half (so it is going to enhance the scale of the transaction and due to this fact the payment), whereas the transaction payment will probably be left within the transaction with no output.
After this the Bitcoin software program will calculate the transaction payment required primarily based on the setting you employ (payment quantity/byte), replace the suitable quantities (transaciton payment and change) and the transaction is able to be despatched.