mirror of
https://github.com/logos-storage/logos-storage-testnet-starter.git
synced 2026-01-07 16:03:12 +00:00
Accept user provided ethereum private key to save it locally
This commit is contained in:
parent
76d56a9548
commit
34c5c8fd2f
@ -6,7 +6,8 @@ key_file="eth.key"
|
|||||||
address_file="eth.address"
|
address_file="eth.address"
|
||||||
url=https://key.codex.storage
|
url=https://key.codex.storage
|
||||||
|
|
||||||
# Generate
|
# Generate remote
|
||||||
|
generate_remote() {
|
||||||
echo "Generating private key from remote <${url}>..."
|
echo "Generating private key from remote <${url}>..."
|
||||||
|
|
||||||
response=$(curl -s ${url})
|
response=$(curl -s ${url})
|
||||||
@ -21,3 +22,22 @@ address=$(cat ${address_file})
|
|||||||
echo " * your private key has been saved to ${PWD}/${key_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 has been saved to ${PWD}/${address_file}"
|
||||||
echo " * your ethereum address is ${address}"
|
echo " * your ethereum address is ${address}"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Use user provided private key
|
||||||
|
user_private_key() {
|
||||||
|
# Create file with required permissions
|
||||||
|
echo "${ETH_PRIVATE_KEY}" >"${key_file}"
|
||||||
|
chmod 600 "${key_file}"
|
||||||
|
|
||||||
|
echo "Using provided private key..."
|
||||||
|
echo " * your private key has been saved to ${PWD}/${key_file}"
|
||||||
|
echo " * please use your key address to get the tokens"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Save keyrair
|
||||||
|
if [[ -z "${ETH_PRIVATE_KEY}" ]]; then
|
||||||
|
generate_remote
|
||||||
|
else
|
||||||
|
user_private_key
|
||||||
|
fi
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user