You can find some examples of the GetWork protocol here.
Generally, the pool provides a block header that is to be hashed with various nonces, as well as some additional information, such as:
- hash1, which is always "0000000000000000000000000000000000000000000000000000000000000000000000800000000 0000000000000000000000000000000000000000000010000"
- midstate (deprecated), a value calculated by hashing half of the block header, used to speed up the process. Midstate is deprecated, as it is redundant data that can be calculated by the miner.
- target - the target that is to be used to determine if the header is hashed correctly
- Various other protocol extensions
The pool has to keep a track of the various block headers sent, as well as their corresponding blocks.
- Generally, the transactions that are included in the block are all the transactions that the pool knows about (with some exceptions, for example some pools exclude 0 fee transactions altogether).
- The order of the transactions can be random, but the coinbase transaction is most often the first transaction in the block.
- Most miners will work on different sets of transactions, but most often it will just differ by the coinbase transaction or their order.
- If a transaction is included in a block that gets overwritten by a fork it will be be treated as a new transaction to be considered for inclusion in the block. Provided there was no double-spend attempt, it should be included in the future blocks.