Why do precompiled contracts lead to Out of Gas on private blockchains?
Some tidbits are provided in the Solidity docs but can it be explained more?
It might be that you run into Out-of-Gas for
sha256
,ripemd160
orecrecover
on a private blockchain. The reason for this is that those are implemented as so-called precompiled contracts and these contracts only really exist after they received the first message (although their contract code is hardcoded). Messages to non-existing contracts are more expensive and thus the execution runs into an Out-of-Gas error. A workaround for this problem is to first send e.g. 1 Wei to each of the contracts before you use them in your actual contracts. This is not an issue on the official or test net.
What is happening that "these contracts only really exist after they received the first message (although their contract code is hardcoded)"?
How does sending 1 Wei make these contracts "really exist"?
Will allocating 1 wei in the genesis block of a private blockchain, for each of these contracts, avoid the Out of Gas?