--snip--
So, when I send a bitcoin to somebody, the transaction goes to the mempool. The mempool is like a big pool where the transactions wait to be picked up. All the miners have access to the mempool to choose the transactions they want to put in their block.
More or less... It's actually your transaction going into the mempool of each node that choses to accept it (some nodes might reject transactions that have, for example, a low feerate). Each miner (or mining pool) has one or more nodes in the network, and they have access to the unconfirmed transactions in the mempool of their own nodes.
1) When a miner pick up a transaction in the mempool, the others miners can't take it ?
2) If all the miners can choose what they put in the block, they are all searching for a different hash to solve the block, right ? I'm saying this because with this simulator (
https://blockchaindemo.io/) The "Data" input represent the different transactions in it, no ?
1) that's incorrect. All miners in the world can try to solve a block containing exactly the same transaction. Miners don't have to communicate with eachother. You can run a node at home and setup a solo mining operation without telling anybody. You'd be getting the header of the latest valid block straight from your node, and you'd get the transactions from the mempool of your own node. If you'd ever solve a block, you'd just broadcast said block to the peers you are connected to and nobody would ever know you were the miner that solved the block in the first place.
2) well, they're all trying to find a header whose sha256d hash is under the current target. The thing is: if 2 miners would pick 100% exactly the same set of unconfirmed transactions, they'd still have to add the coinbase transaction which is paying the miners themselves to the merkle tree (which ends up in the header of the candidate block). And since 2 different miners won't fund the same address with the coinbase transaction, the headers those 2 miners are working on will never be 100% identical.
EDIT: on a sidenote to question2 => miners are not looking for "the" hash... There's looking for "a" hash that's under the current target... There are billions of valid hashes that are under a certain target. The thing is: eventough there are billions of valid hashes, it's still extremely hard to find one of those hashes since the number of possible hashes is waaaaaaaaaaaaaay bigger.
It's like filling a big swimmingpool with blue marbles and adding 100 red ones, then dive in wearing a blindfold and picking a single marble: eventough there are100 red ones, the odds of picking one is slim to none since there's are several million blue marbles in there.