-
Notifications
You must be signed in to change notification settings - Fork 21
/
run.bat
55 lines (48 loc) · 1.59 KB
/
run.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
@echo off
setlocal enabledelayedexpansion
set "execFile=modular-indexer-light.exe"
set "command=.\modular-indexer-light.exe"
set "configExampleFile=config.example.json"
set "configFile=config.json"
set "bitcoinRPC=https://bitcoin-mainnet-archive.allthatnode.com"
if not exist "%configExampleFile%" (
echo %configExampleFile% not found
pause
exit /b 1
)
copy /y %configExampleFile% %configFile%
if not exist "%execFile%" (
echo %execFile% not found
pause
exit /b 1
)
set /p endpoint=Please enter your Bitcoin RPC endpoint:
echo %endpoint% | findstr /r /c:"^http[s]*:\/\/.*" > nul
if %errorlevel% neq 0 (
echo Invalid Bitcoin RPC endpoint, default endpoint %bitcoinRPC% will be used.
set "endpoint=%bitcoinRPC%"
)
powershell -Command "(gc %configFile%) -replace '%bitcoinRPC%', '%endpoint%' | Out-File -encoding ASCII %configFile%"
set /p gasCoupon=Please enter your Gas Coupon:
set gasCoupon=!gasCoupon!
if not "!gasCoupon!"=="" (
if "!gasCoupon:~30,1!"=="" if not "!gasCoupon:~29,1!"=="" (
powershell -Command "(gc %configFile%) -replace 'YourGasCoupon', '!gasCoupon!' | Out-File -encoding ASCII %configFile%"
) else (
echo Invalid Gas Coupon
pause
exit /b 1
)
) else (
echo Gas Coupon required!
pause
exit /b 1
)
set /p name=Please enter your desired indexer name:
if "!name!"=="" (
echo Use randomly generated name
set /a name=%RANDOM%%RANDOM%
)
powershell -Command "(gc %configFile%) -replace 'YourOwnLightIndexerName', '!name!' | Out-File -encoding ASCII %configFile%"
echo start modular-indexer-light....
%command%