Ethereum: Understanding the Random Number Source for getnewaddress
In Bitcoin Core, the getnewaddress
function is a key component that generates new addresses for transactions. One of its key parameters is an optional argument called prng
, which stands for random number generator'. This parameter is used to specify the source of randomness for address generation. In this article, we will take a detailed look at how the Bitcoin Core API (bitcoind) uses the random number source for
getnewaddress.
Internal PRNG
Thegetnewaddressfunction in bitcoind uses an internal random number generator (PRNG). The implementation is based on the "Pseudo-Random Number Generator" algorithm, which is a widely used method for generating cryptographically secure pseudo-random numbers. This pseudo-random number generator (PRNG) is designed to generate unpredictable and uniformly distributed output, making it suitable for cryptographic applications.
Retrieved from/dev/randomor
/dev/urandom
Thegetnewaddressfunction in bitcoind retrieves data from the random number source
/dev/random(on Unix systems) or
/dev/urandom(on Windows). This means that the output of the
getnewaddresscommand is not cryptographically secure and can be easily predicted. The random numbers are generated using a non-deterministic algorithm, making them suitable for some applications.
Security Issues
The use of an internal PRNG in the bitcoindgetnewaddressfunction has raised security concerns among some users and developers. Although a random number generator (PRNG) is designed to produce unpredictable output, it can be predictable if the hardware or software configuration allows it.
Specifically, the following issues have been reported:
- Hardware attacks: If a user has a hardware random number generator (HRNG) connected, such as a trusted random number generator (TRNG), entering this entry intogetnewaddress
could potentially expose sensitive information. While most HRNGs are designed with security in mind, some older or less secure models may be vulnerable to attacks.
- Software attacks: Similarly, software attacks that exploit/dev/random
or
/dev/urandommay still pose a risk if the underlying system configuration is insecure.
Secure alternatives
To mitigate these threats, developers and users may consider implementing additional security measures:
- Secure hardware random number generator (SRNG)
: Using an SRNG, such as a trusted random number generator (TRNG), as input togetnewaddress
can ensure that the output is highly unpredictable and resistant to attacks.
- Using Secure Random Number Sources: Developers can also use secure random number sources such as/dev/urandom
or
/dev/randomfrom trusted sources. This ensures cryptographic security of the input.
Conclusion
Although thegetnewaddressfunction in the Bitcoin Core (bitcoind) API uses an internal random number generator (PRNG) to generate random numbers, its security has raised concerns among some users and developers. To mitigate these risks, it is recommended to use a hardware SRNG or secure random number sources such as
/dev/urandom` from trusted sources.
For more information on secure random number generation practices and implementing additional security measures, please review the following resources:
- [Bitcoin Core API Documentation](
- [Secure Random Number Generator (SRNG) Guidelines](
- [Trusted Random Number Generator (TRNG) Security Considerations](
Note: This article is for informational purposes only and should not be considered a substitute for professional advice or secure coding practices.
Deixe um comentário Cancelar resposta