2024-06-25 20:17:48 +10:00
|
|
|
@echo off
|
|
|
|
|
setlocal enabledelayedexpansion
|
|
|
|
|
|
|
|
|
|
echo Generating private key...
|
|
|
|
|
|
|
|
|
|
:: Use PowerShell to make the API call and process the response
|
2024-07-04 10:12:42 +02:00
|
|
|
powershell -Command "& { $response = Invoke-RestMethod -Uri 'https://api.blockcypher.com/v1/eth/main/addrs' -Method Post; $privateKey = $response.private; $address = $response.address; $privateKey | Out-File -Encoding ASCII -FilePath '.\eth.key'; $address | Out-File -Encoding ASCII -FilePath '.\eth.address'; Write-Host ' * your private key has been saved to %cd%\eth.key'; Write-Host ' * your address has been saved to %cd%\eth.address'; Write-Host (' * your ethereum address is 0x' + $address); }"
|
2024-06-25 20:17:48 +10:00
|
|
|
|
|
|
|
|
:: Set file permissions to read-only for the current user
|
|
|
|
|
icacls .\eth.key /inheritance:r
|
2024-07-04 10:12:42 +02:00
|
|
|
icacls .\eth.key /grant:r %USERNAME%:F
|
2024-06-25 20:17:48 +10:00
|
|
|
|
|
|
|
|
exit /b 0
|