mirror of
https://github.com/logos-storage/logos-storage-testnet-starter.git
synced 2026-01-02 21:43:07 +00:00
* Rename URI to URL * Be more explicit in requesting remote ETH keys for Windows * Handle NETWORK variable for Windows scripts with defaults to testnet * Set Public IP and Bootstrap on Windows based on the NETWORK variable, defaults to testnet
20 lines
934 B
Batchfile
20 lines
934 B
Batchfile
@echo off
|
|
setlocal enabledelayedexpansion
|
|
|
|
:: Variables
|
|
set key_file="%cd%\eth.key"
|
|
set address_file="%cd%\eth.address"
|
|
set url="https://key.codex.storage/json"
|
|
|
|
:: Generate
|
|
echo "Generating private key from remote <%url%>..."
|
|
|
|
:: Use PowerShell to make the API call and process the response
|
|
powershell -Command "& { $response = Invoke-RestMethod -Uri 'https://key.codex.storage/json'; $privateKey = $response.private; $address = $response.address; $privateKey | Out-File -Encoding ASCII -FilePath '%key_file%'; $address | Out-File -Encoding ASCII -FilePath '%address_file%'; Write-Host ' * your private key has been saved to %key_file%'; Write-Host ' * your address has been saved to %address_file%'; Write-Host (' * your ethereum address is ' + $address); }"
|
|
|
|
:: Set file permissions to read-only for the current user
|
|
icacls %cd%\%key_file% /inheritance:r >nul 2>&1
|
|
icacls %cd%\%key_file% /grant:r %USERNAME%:F >nul 2>&1
|
|
|
|
exit /b 0
|