2024-06-25 20:17:48 +10:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -e
|
|
|
|
|
2024-07-30 20:50:20 +03:00
|
|
|
# Variables
|
|
|
|
key_file="eth.key"
|
|
|
|
address_file="eth.address"
|
2024-10-03 00:05:28 +03:00
|
|
|
url=https://key.codex.storage
|
2024-10-02 20:52:34 +02:00
|
|
|
|
2024-07-30 20:50:20 +03:00
|
|
|
# Generate
|
2024-10-03 00:05:28 +03:00
|
|
|
echo "Generating private key from remote <${url}>..."
|
2024-06-25 20:17:48 +10:00
|
|
|
|
2024-10-03 08:11:52 +03:00
|
|
|
response=$(curl -s ${url})
|
2024-07-30 20:50:20 +03:00
|
|
|
awk -F ': ' '/private/ {print $2}' <<<"${response}" >"${key_file}"
|
|
|
|
awk -F ': ' '/address/ {print $2}' <<<"${response}" >"${address_file}"
|
2024-06-25 20:17:48 +10:00
|
|
|
|
2024-07-30 20:50:20 +03:00
|
|
|
# Permissions
|
|
|
|
chmod 600 "${key_file}"
|
2024-06-25 16:02:33 -04:00
|
|
|
|
2024-07-30 20:50:20 +03:00
|
|
|
# Show
|
|
|
|
address=$(cat ${address_file})
|
|
|
|
echo " * your private key has been saved to ${PWD}/${key_file}"
|
|
|
|
echo " * your ethereum address has been saved to ${PWD}/${address_file}"
|
|
|
|
echo " * your ethereum address is ${address}"
|