How are the latest transactions collected into new block to send them to miners for hashing? Which part of the network is responsible for giving miners the correct block to hash?
2 Answers
The mempool as it is called, stores transactions that are propagated by the peer to peer network. Miners have the ability to select which transactions they include in the block. It is beneficial for the miners to collect as many transactions as possible so they can obtain the most amount of fees that they can.
If you are running a node, you can call the getblocktemplate API and you'll actually see all the transactions within the mempool.
This site shows the mempool transactions. You then get your code to typically sort from highest fees to lowest fees, run other checks such as is it within the MAX_BLOCK_SIZE and then create a block header that is to be hashed.
Which part of the network is responsible for giving miners the correct block to hash?
That would be your network. You create the block header and send it somewhere to start the hashing process. That somewhere could be your laptop, it could be a dedicated miner connected to your laptop or it could be a dedicated miner connected to a raspberry pi that is connected to your home/local network.