2024-06-25 20:17:48 +10:00
@ echo off
setlocal enabledelayedexpansion
call utils.bat
2024-09-27 20:11:15 -04:00
: : Check if LOCALIP is provided as an argument
if " %1 " neq " " (
set " LOCALIP= %1 "
) else if not defined LOCALIP (
2024-06-25 20:17:48 +10:00
call : get_ip LOCALIP
)
echo LOCAL IP: %LOCALIP%
if not defined BOOTSPR (
2024-10-01 23:28:59 +03:00
: : workshop
: : set "BOOTSPR=spr:CiUIAhIhAnBsex_7L5xKJQpmAuOtubQEtKsgCOXE2vaJoTJXrprbEgIDARo8CicAJQgCEiECcGx7H_svnEolCmYC4625tAS0qyAI5cTa9omhMleumtsQnbm0tAYaCwoJBMCoWP2RAh-aKkcwRQIhANjwAV9DGFe4zcMUEHjuTsGWAPc7WB7uoSS86HATwouqAiA8dFhsALCSLsQbSOPF1j7NF643oEmPEJAwU9dIwjM6TA"
set BOOTSPR = " spr:CiUIAhIhAiJvIcA_ZwPZ9ugVKDbmqwhJZaig5zKyLiuaicRcCGqLEgIDARo8CicAJQgCEiECIm8hwD9nA9n26BUoNuarCEllqKDnMrIuK5qJxFwIaosQ3d6esAYaCwoJBJ_f8zKRAnU6KkYwRAIgM0MvWNJL296kJ9gWvfatfmVvT-A7O2s8Mxp8l9c8EW0CIC-h-H-jBVSgFjg3Eny2u33qF7BDnWFzo7fGfZ7_qc9P "
2024-06-25 20:17:48 +10:00
)
if not exist eth.key (
echo eth.key does not exist. Please run generate.bat to create it.
exit /b 1
)
2024-09-27 20:11:15 -04:00
: : Set proper permissions for eth.key
echo Setting proper permissions for eth.key...
icacls eth.key /reset
icacls eth.key /inheritance:r
icacls eth.key /grant:r %USERNAME% :(R,F)
icacls eth.key /remove " Authenticated Users " " BUILTIN\Users "
icacls eth.key
if errorlevel 1 (
echo Failed to set permissions for eth.key. Please run this script as administrator.
exit /b 1
)
2024-06-25 20:17:48 +10:00
: : Set variables
2024-09-24 11:02:56 +02:00
set " VERSION=v0.1.4 "
2024-06-25 20:17:48 +10:00
set " OS=windows "
call : get_arch ARCH
set " DATA_DIR=data_client "
if not exist %DATA_DIR% mkdir %DATA_DIR%
icacls %DATA_DIR% /inheritance:r
icacls %DATA_DIR% /grant:r %USERNAME% :(OI)(CI)F
codex-%VERSION% -%OS% -%ARCH% .exe ^
--data-dir=%DATA_DIR% ^
--storage-quota=11811160064 ^
--nat=%LOCALIP% ^
--api-port=8080 ^
--disc-port=8090 ^
--listen-addrs=/ip4/0.0.0.0/tcp/8070 ^
--bootstrap-node=%BOOTSPR% ^
persistence ^
--eth-private-key=eth.key ^
2024-09-24 11:02:56 +02:00
--eth-provider=https://rpc.testnet.codex.storage
2024-06-25 20:17:48 +10:00
exit /b 0
: get_arch
set " arch_result=unknown "
for /f " tokens=2 delims=: " %% a in ( 'systeminfo ^| find "System Type"' ) do (
echo %% a | find " x64 " > nul
if not errorlevel 1 set " arch_result=amd64 "
echo %% a | find " ARM " > nul
if not errorlevel 1 set " arch_result=arm64 "
)
set " %1 = %arch_result% "
exit /b
: get_ip
for /f " tokens=2 delims=: " %% a in ( 'ipconfig ^| findstr /c:"IPv4 Address"' ) do (
set " %1 = %% a "
set " %1 =! %1 : =! "
goto : break
)
: break
2024-10-01 23:28:59 +03:00
exit /b