I wanted to know why in Bitcoin, it is possible for a Wallet to have several addresses ?
A wallet is just a collection of key-pairs (private and public keys), thus addresses.
In the case that a Wallet has several Bitcoin Addresses, which of the Addresses ensures the sending of the Bitcoins to another Address ? Which of the Addresses of the Wallet carries out the transactions of sending of Bitcoin ?
No address "ensures" anything and you've asked the same question twice (just formulated differently). In Bitcoin, there are these things called inputs and outputs. If you receive 1 Bitcoin to address A which is in a wallet containing e.g. 10 addresses (all others are empty), you now have a unspent transaction output (UTXO). These outputs are then used as inputs for future transactions. This means, that in order to spend from this wallet, you need to take the UTXO from that address as an input for the transaction which you want to create. User-friendly or *convenient* wallets do this automatically. Some wallets such as Bitcoin Core have the option called Coin Control. This enables you to pick out specific inputs and combine in any way that you see fit (as long as it follows the consensus rules).
From the Stackexchange link below:
The way transactions are created is as follows:
- Take a number of unspent outputs from previous transactions and use them as inputs.
- Make a new output of which the output amount is equal or less than the sum of all input values. Your wallet will most probably make this output a pay-to-pubkey-hash output to the address you wanted to send money to.
- Because probably the inputs will not exactly match, you will add another output so that the sum of all new outputs is equal to the sum of the inputs. This output will also be a pay-to-pubkey-hash output to a new change address or to the same address as you are spending from (different wallet apps do this differently).
- Note that if the total output amount is less than the total input amount, the difference is considered the transaction fee and this will go to the miner of the block your transaction will appear in.
- Then lastly the wallet app has to prove it has the right to spend the inputs you used in the transaction. It can do this to provide an input script (technically it's called a scriptPubKey). For the common pay-to-pubkey-hash, this script will contain your public key and the signature you made with your private key. This input script is used by miners to verify if you have the right to make this transaction.
- The transaction is then broadcast to the Bitcoin network.
Read:
1) Wallet:
https://en.bitcoin.it/wiki/Wallet2) Input:
https://en.bitcoin.it/wiki/Transaction#Input3) Output:
https://en.bitcoin.it/wiki/Transaction#Output4) Why do outputs need to be spent entirely:
https://bitcoin.stackexchange.com/questions/20611/why-do-outputs-need-to-be-spent-entirely/20623[/list]