# How a bitcoin transaction works

`1. A user needs to open the wallet application  and attempt to send the a certain crypto from sender to recipient .2. This transaction now awaiting to be picked up ,it hovers in a 'pool of unconfirmed transaction'3. Miners on the network select transactions from these pools and form them into a 'block'.4. By selecting transactions and adding them to their block miners create a block of transactions .To add this block of transactions to the blockchain ,the block first needs a signature(pow). This signature is created by solving a very complex mathematical problem that is unique to each block of transactions5.The miner who figures the signature , broadcasts it to the other miners 6.Now all miners verify the signature's legitimacy .If it every thing is legit , then the block can be added to the block chain .The other nodes accept the block and save it to their transaction data .7. After the block has been appended to the chain , every block after it counts it as 'confirmation', as in blockchain the block depend on the previous block's hashing.`

Mining aka hashing (proof of work consensus algorithm )

`The problem each miner faces is to find a hash output (aka signature) for the data in its block.`

A hash function can be defined as where the problem is very hard ,but the answer is very easy to verify. It takes an input string of alphanumeric and turns it in to a new 32 digit string existing out of random letters and numbers. Same string of input will always give the same string of output.

The condition to be added in a blockchain can be specified , such as if its signature , the hash output ,starts with a certain amount of zeros.

nonce is used by miners, nonce is used to change a part of the data inside their blocks which lead to change in the signature of the block .So every time we change a nonce , it changes the signature

Miners repeat this process of changing the nonce , until they meet the output which agrees with the signature requirements , for example if the value of nonce is 23 then only the block will have a digital signature starting with 4 zeros.

To solve this nonce and digital signature relationship, we need a lot of digital computational power , time and electricity . Hence we use Decentralization here.