Skip to content

Instantly share code, notes, and snippets.

@secwang
Created December 14, 2022 08:04
Show Gist options
  • Select an option

  • Save secwang/4cac16a45855d1584f01cb551285ab04 to your computer and use it in GitHub Desktop.

Select an option

Save secwang/4cac16a45855d1584f01cb551285ab04 to your computer and use it in GitHub Desktop.
generate eth paper wallet
#!/usr/bin/env bash
#brew install sha3sum
# Generate the private and public keys
openssl ecparam -name secp256k1 -genkey -noout | openssl ec -text -noout > key
# Extract the public key and remove the EC prefix 0x04
cat key | grep pub -A 5 | tail -n +2 | tr -d '\n[:space:]:' | sed 's/^04//' > pub
# Extract the private key and remove the leading zero byte
cat key | grep priv -A 3 | tail -n +2 | tr -d '\n[:space:]:' | sed 's/^00//' > priv
# Generate the hash and take the address part
cat pub | keccak-256sum -x -l | tr -d ' -' | tail -c 41 | awk '{print "0x"$1}'> address
echo "Address:"
cat address
printf "\n"
echo "priv:"
cat priv
rm key
rm pub
rm priv
rm address
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment