user124717: I have come up recently with "how to mine bitcoin using python" or "how to mine bitcoin using golang" and as I have been observing all these source code, not only I'm confused but also have some questions.
Some developers using python keep saying that difficulty calculates the leading 0s on the hash which after coming to blockchain explorer I think it is not true as the current difficulty is wayy too high to be leading 0s on the hash which determines that "we mined a block". Also bitcoin wiki of difficulty just explains it plain short.
So how does it treats it? Does the mining software puts difficulty in the hashing algorithm?

user5406: The difficulty is really a human readable expression. Under the hood, the Bitcoin protocol uses the target. The target is a custom 4-byte float value encoding an exponent and a mantissa that is to represent a number used as the upper bound for the block hash of valid blocks.
The target is updated every 2016 blocks after the last block of a difficulty period has been found. It depends on the timestamps of the first and the last block of the difficulty period and the previous target:
new_target = old_target × (t_last - t_first)/14 days

Every full node that has seen these two blocks can calculate the new target.
Miners assemble unconfirmed transactions into block templates, create coinbase transactions and fill up the remaining header fields to produce block candidates, test each block candidate by hashing its header and comparing the candidate's hash to the target to determine whether a block has been found. The current target since height 693,504 is 0x17136aa2 which is a compact representation for 0x000000000000000000136aa20000000000000000000000000000000000000000. If I counted right, this hexadecimal number would translate to a binary number with 75 leading zeroes. At the current hashrate of about 109.7 EH/s, the network will try about 6.6×1022 block candidates until a block is found.

124717: <p>I have come up recently with <code>&quot;how to mine bitcoin using python&quot;</code> or <code>&quot;how to mine bitcoin using golang&quot;</code> and as I have been observing all these source code, not only I'm confused but also have some questions.</p>
<p>Some developers using python keep saying that <code>difficulty calculates the leading 0s on the hash</code> which after coming to blockchain explorer I think it is not true as the current difficulty is wayy too high to be <code>leading 0s</code> on the hash which determines that &quot;we mined a block&quot;. Also bitcoin wiki of difficulty just explains it plain short.</p>
<p>So how does it treats it? Does the mining software puts difficulty in the hashing algorithm?</p>
 5406: <p>The difficulty is really a human readable expression. Under the hood, the Bitcoin protocol uses the <em>target</em>. <a href="https://bitcoin.stackexchange.com/a/57186/5406">The target is a custom 4-byte float value encoding an exponent and a mantissa</a> that is to represent a number used as the upper bound for the block hash of valid blocks.</p>
<p>The target is updated every 2016 blocks after the last block of a difficulty period has been found. It depends on the timestamps of the first and the last block of the difficulty period and the previous target:</p>
<pre><code>new_target = old_target × (t_last - t_first)/14 days
</code></pre>
<p>Every full node that has seen these two blocks can calculate the new target.</p>
<p>Miners assemble unconfirmed transactions into block templates, create coinbase transactions and fill up the remaining header fields to produce block candidates, test each block candidate by hashing its header and comparing the candidate's hash to the target to determine whether a block has been found. The current target since height 693,504 is <code>0x17136aa2</code> which is a compact representation for <code>0x000000000000000000136aa20000000000000000000000000000000000000000</code>. If I counted right, this hexadecimal number would translate to a binary number with 75 leading zeroes. At the current hashrate of about 109.7 EH/s, the network will try about 6.6×10<sup>22</sup> block candidates until a block is found.</p>
