A secure Rust implementation for generating Ethereum private keys and addresses. Implements the official Ethereum address algorithm with EIP-55 checksum encoding.
A pre-built binary for Apple Silicon (M1/M2) is available in the bin
directory. To use it:
- Clone this repository
- Navigate to the
bin
directory - Make the binary executable and run:
chmod +x generate-private-key
./generate-private-key
If you need to build for a different platform or want to compile from source:
[dependencies]
rand = "0.8"
secp256k1 = "0.28"
tiny-keccak = { version = "2.0", features = ["keccak"] }
hex = "0.4.3"
cargo build --release
The executable will be available at target/release/generate-private-key
- Cryptographically secure private key generation
- Secp256k1 public key derivation
- Keccak-256 hashing for address generation
- EIP-55 compliant checksum addresses
- Support for importing existing private keys
The program will output:
- A new private key (keep this secret!)
- The corresponding Ethereum address
- Uses
OsRng
for secure random number generation - Validates private keys against the secp256k1 curve order
- Implements address checksum for error detection
- Full test coverage including official test vectors
cargo test
MIT