I am making an presentation about BTC's, and i am stuck in hashing blocks.
As far as i know - blocks contain informations about transactions, prev. hash, actual hash and merkle root of transactions(and other stuff which can be checked in blockexplorer ie.).
Problem is in - how and WHEN is the merkle root computed, and how is new hash computed?
I mean - it's like this? :
hash of block n+1 = hash(hash of block[n] + merkle root of transactions from current block(transaction + transaction +...+ transaction[n]) + nonce)
When any transaction appears in the network - what happens? It automatically change merkle root that is put into hashing algorithm to find number under desired target?
Or how does it go?
and how is transaction validation working? for example i've got 50 coins from block 10000 and now it's block 130000 and i want to spend it for something.
program check for all blocks between 10k and 130k that i actually own that money? and how he does that? step by step will be nice
Thanks for any advice:)