I want to understand how the target value is adjusted or by whom in Bitcoin.
I know that the hash of a block + nonce must be lower or equal to the given target for mining.
Who sets this target ? If a miner puts transactions in a block, where can he see the target, where is it ? Is a target for any nodes the same. Is the target always the same in the whole network until someone finds the right hash ?
I read the white paper, I read several posts, but I stil don't get it.
The target is calculated by each node in the network independently.
Bitcoin is a decentralized system, so there is no authority that will set the target. The network is its own authority.
On this network, each participant (node) follows certain rules. These rules are the same for everyone, and govern how the network behaves. They include things such as the block size limit (block weight, in recent times), no double spends allowed (each output may only be spent once), difficulty adjustments to stay as close to a 10 minute block interval as possible (this is the target), and various other rules.
Every 2016 blocks (roughly 2 weeks), each node will look at the last 2016 blocks and calculate the average time spent mining a block. If this value is greater than ten minutes, the difficulty is reduced. If it is faster than ten minutes, the difficulty is increased. This readjustment allows the network to self regulate the mining target.
Since each node follows the same consensus rules, and all blocks are the same for all nodes, they will all arrive at the same difficulty value independently.
If a node were to miscalculate the target (or lie about it), and then produce a block based on their incorrect value, it may be rejected by the rest of the network for failing to meet the target requirements, and all the work invested into mining that block will be lost.