An updated answer.
First, check out the block subsidy calculation: https://github.com/bitcoin/bitcoin/blob/master/src/validation.cpp#L1068
CAmount GetBlockSubsidy(int nHeight, const Consensus::Params& consensusParams)
int halvings = nHeight / consensusParams.nSubsidyHalvingInterval;
// Force block reward to zero when right shift is undefined.
Obviously the choice was somewhat arbitrary as well as largely unexplained. This is true of several other constants chosen by Satoshi Nakamoto.
According to What is the length of largest known reorganization in bitcoin?
the value overflow incident in August 2010 [...] caused a re-org of 53 blocks
So having the maturity be 100 blocks rather than 50, or less,...
It is 100, because that's what Bitcoin's creator set it to. It's part of the system's consensus rules now, and cannot easily be changed. It also doesn't really hurt.
In retrospect, it is likely too high. The purpose of the maturity is making sure that when a deep reorganization takes places, no transactions that directly or indirectly spend coinbase outputs ...
why it's defined 100 and not 50?
50 will not be safe in my opinion considering blocks are mined quickly sometimes so 50 can be mined in few hours. 100 blocks takes almost a day which is good enough time to realise forks, attacks etc. and respond accordingly.
In fact this number should be increased to 200 or more. What is the correct number for maturity is ...
I am not sure how this is actually implemented in the code, but you can approximate the new target (nBits) value with data from the prior 2016th block. Note that as described above nBits is the 32-bit compact encoding of the 256-bit target value.
Here shows the new difficulty (d_new) as:
d_new = d_old * 2 weeks / t_old
where 'old' signifies the previous 2016 ...
addressHash is the data output by pybtc. The data is a hash of the public key or script. It is contained in the address. And also parts of scriptPubkey(locking script).
For P2PKH and P2WPKH, it is Hash160(public key)
For P2SH, it is Hash160(script)
For P2WSH, it is SHA256(script)