This package is intended for educational and development purposes. Do not use for production or with real Bitcoin transactions.
This repository explores the use of randomly generated hexadecimal numbers to create a bitcoin wallet address using the Elliptic Curve Digital Signature Algorithm. When Alice wants to buy a book from Bob, after all has been agreed upon, Bob needs to provide Alice with a bitcoin wallet address where the payments will be deposited. The transaction will be done on the blockchain, so Bob needs a bitcoin wallet address to receive payments. This repository covers how a bitcoin wallet address can be created from randomly generated private keys.
In cryptography, the Elliptic Curve Digital Signature Algorithm (ECDSA) offers a variant of the Digital Signature Algorithm (DSA) which uses elliptic-curve cryptography.
Bob signs a hash of a message with his private key, and then Alice proves with his public key. Bob also uses a random nonce value for the signature (K)
With ECDSA, Alice will sign a message with her private key, and then Bob will use her public key to verify that she signed the message (and that the message has not changed)
The diagram below illustrates the architecture and how the Bitcoin wallet addresses are created:
To achieve desired outcome, first we need to set-up the environment. For development purposes, you can use:
For getting randomly generated private keys, you can use:
Note: For production use, always ensure secure methods of private key generation.
• ECDSA Python Library - Implementation of the Elliptic Curve Cryptography • Hashlib - Contains hash algorithms for SHA256, RIPEMD160 • Codecs - For encoding and decoding • Base58 - For Base58Check encoding
pip install bitcoin-address-generator
from bitcoin_address_generator import generate_wallet
# Generate new wallet
private_key, public_key, address = generate_wallet()
print(f"Bitcoin Address: {address}")
# Generate new address
bitcoin-address-generator generate
# Validate address
bitcoin-address-generator validate <address>
If you have any feedback, please reach out to me at gs_wl889@icloud.com
Contributions are always welcome! See CONTRIBUTING.md for ways to get started. Please adhere to this project’s CODE_OF_CONDUCT.md.
This package is for educational purposes. See SECURITY.md for important security considerations.