diff --git a/.github/workflows/commit-macos-arm64.yml b/.github/workflows/commit-macos-arm64.yml index d2d105b..c3e3e30 100644 --- a/.github/workflows/commit-macos-arm64.yml +++ b/.github/workflows/commit-macos-arm64.yml @@ -22,14 +22,14 @@ jobs: mkdir artifacts mvn clean compile package -DskipTests cp target/MyLocalTon.jar artifacts/MyLocalTon-arm64.jar - java -jar artifacts/MyLocalTon-arm64.jar nogui debug + java -jar artifacts/MyLocalTon-arm64.jar nogui debug test-binaries - name: Build & Test arm64-aarch64 testnet timeout-minutes: 10 run: | mvn clean compile package -DskipTests -Dton_branch=testnet cp target/MyLocalTon.jar artifacts/MyLocalTon-arm64-testnet.jar - java -jar artifacts/MyLocalTon-arm64-testnet.jar nogui debug + java -jar artifacts/MyLocalTon-arm64-testnet.jar nogui debug test-binaries - name: Upload artifacts uses: actions/upload-artifact@master diff --git a/.github/workflows/commit-macos-x86-64.yml b/.github/workflows/commit-macos-x86-64.yml index 5e0a6c3..46040ec 100644 --- a/.github/workflows/commit-macos-x86-64.yml +++ b/.github/workflows/commit-macos-x86-64.yml @@ -22,14 +22,14 @@ jobs: mkdir artifacts mvn clean compile package -DskipTests cp target/MyLocalTon.jar artifacts/MyLocalTon-x86-64.jar - java -jar artifacts/MyLocalTon-x86-64.jar nogui debug + java -jar artifacts/MyLocalTon-x86-64.jar nogui debug test-binaries - name: Build & Test x86-64 testnet timeout-minutes: 10 run: | mvn clean compile package -DskipTests -Dton_branch=testnet cp target/MyLocalTon.jar artifacts/MyLocalTon-x86-64-testnet.jar - java -jar artifacts/MyLocalTon-x86-64-testnet.jar nogui debug + java -jar artifacts/MyLocalTon-x86-64-testnet.jar nogui debug test-binaries - name: Upload artifacts uses: actions/upload-artifact@master diff --git a/.github/workflows/commit-ubuntu-x86-64.yml b/.github/workflows/commit-ubuntu-x86-64.yml index fd66dc2..499e323 100644 --- a/.github/workflows/commit-ubuntu-x86-64.yml +++ b/.github/workflows/commit-ubuntu-x86-64.yml @@ -22,14 +22,14 @@ jobs: mkdir artifacts mvn clean compile package -DskipTests cp target/MyLocalTon.jar artifacts/MyLocalTon-x86-64.jar - java -jar artifacts/MyLocalTon-x86-64.jar nogui debug + java -jar artifacts/MyLocalTon-x86-64.jar nogui debug test-binaries - name: Build & Test x86-64 testnet timeout-minutes: 10 run: | mvn clean compile package -DskipTests -Dton_branch=testnet cp target/MyLocalTon.jar artifacts/MyLocalTon-x86-64-testnet.jar - java -jar artifacts/MyLocalTon-x86-64-testnet.jar nogui debug + java -jar artifacts/MyLocalTon-x86-64-testnet.jar nogui debug test-binaries - name: Upload artifacts uses: actions/upload-artifact@master diff --git a/.github/workflows/commit-windows-x86-64.yml b/.github/workflows/commit-windows-x86-64.yml index 4d84950..eaaed4a 100644 --- a/.github/workflows/commit-windows-x86-64.yml +++ b/.github/workflows/commit-windows-x86-64.yml @@ -22,14 +22,14 @@ jobs: mkdir artifacts mvn clean compile package -DskipTests cp target/MyLocalTon.jar artifacts/MyLocalTon-x86-64.jar - java -jar artifacts/MyLocalTon-x86-64.jar nogui debug + java -jar artifacts/MyLocalTon-x86-64.jar nogui debug test-binaries - name: Build & Test x86-64 testnet timeout-minutes: 10 run: | mvn clean compile package -DskipTests -Dton_branch=testnet cp target/MyLocalTon.jar artifacts/MyLocalTon-x86-64-testnet.jar - java -jar artifacts/MyLocalTon-x86-64-testnet.jar nogui debug + java -jar artifacts/MyLocalTon-x86-64-testnet.jar nogui debug test-binaries - name: Upload artifacts uses: actions/upload-artifact@master diff --git a/README.md b/README.md index 7eb373f..9ab0ab4 100644 --- a/README.md +++ b/README.md @@ -39,31 +39,28 @@ In case you are using MacPorts instead of Homebrew on Mac please execute the fol ## Java installation -If you are new to Java, please follow this guide on how to install OpenJDK 17: - -- On Ubuntu - https://techviewleo.com/install-java-openjdk-on-ubuntu-linux/ -- On Windows - https://java.tutorials24x7.com/blog/how-to-install-openjdk-17-on-windows -- On MacOS - https://knasmueller.net/how-to-install-java-openjdk-17-on-macos-big-sur - -In case you have several versions of Java use the following command in order to select the default Java version: - -`sudo update-alternatives --config java` +| Linux | MacOS | Windows | +|---------------------------------------|-------------------------------|----------------------------------------------| +| ```sudo apt install openjdk-17-jdk``` | ```brew install openjdk@17``` | ```choco install openjdk --version=17.0.2``` | ## Microsoft Visual C++ Redistributable installation (for Windows only) Please install Microsoft Visual C++ Redistributable 2015 (and above) x64. https://docs.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist?view=msvc-170 -## Installation and usage +## MyLocalTon installation + +| Archicture | Linux / MacOS | Windows | +|------------|--------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------| +| x86-64 | ```wget https://github.com/neodix42/MyLocalTon/releases/latest/download/MyLocalTon-x86-64.jar``` | [download](https://github.com/neodix42/MyLocalTon/releases/latest/download/MyLocalTon-x86-64.jar) | +| arm64 | ```wget https://github.com/neodix42/MyLocalTon/releases/latest/download/MyLocalTon-arm64.jar``` | [download](https://github.com/neodix42/MyLocalTon/releases/latest/download/MyLocalTon-arm64.jar) | -Go to https://github.com/neodiX42/MyLocalTon/releases. Open Assets section and download MyLocalTon for your architecture +## MyLocalTon usage -Open console and execute the following command: +`java -jar MyLocalTon-x86-64.jar [nogui] [ton-http-api] [explorer] [ip.addr.xxx.xxx] [test-binaries] [debug]` + +for ARM64 architecture use: -`java -jar MyLocalTon-x86-64.jar` or `java -jar MyLocalTon-arm64.jar` ## Upgrade @@ -113,4 +110,8 @@ pip3 install --user ton-http-api wget https://www.python.org/ftp/python/3.12.0/python-3.12.0-amd64.exe python -m ensurepip --upgrade start pip3 install -U ton-http-api -``` \ No newline at end of file +``` + +## Star History + +[![Star History Chart](https://api.star-history.com/svg?repos=neodix42/MyLocalTon&type=Date)](https://star-history.com/#neodix42/mylocalton&Date) diff --git a/src/main/java/org/ton/main/App.java b/src/main/java/org/ton/main/App.java index 892caff..1329f9d 100644 --- a/src/main/java/org/ton/main/App.java +++ b/src/main/java/org/ton/main/App.java @@ -9,10 +9,12 @@ import javafx.stage.StageStyle; import javafx.stage.WindowEvent; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.tuple.Pair; import org.ton.actions.MyLocalTon; import org.ton.db.DbPool; import org.ton.executors.dhtserver.DhtServer; import org.ton.executors.validatorengine.ValidatorEngine; +import org.ton.executors.validatorengine.ValidatorEngineExecutor; import org.ton.settings.MyLocalTonSettings; import org.ton.settings.Node; import org.ton.ui.controllers.MainController; @@ -22,9 +24,11 @@ import java.awt.*; import java.io.IOException; +import java.util.Arrays; import java.util.List; import java.util.Objects; import java.util.concurrent.Executors; +import java.util.concurrent.Future; import static java.util.Objects.isNull; import static java.util.Objects.nonNull; @@ -95,7 +99,7 @@ public static void setRoot(String fxml) throws IOException { scene.setRoot(fxmlLoader.load()); } - public static void main(MyLocalTonSettings settings, MyLocalTon myLocalTon) throws Throwable { + public static void main(MyLocalTonSettings settings, MyLocalTon myLocalTon, String[] args) throws Throwable { // start GUI if (!GraphicsEnvironment.isHeadless()) { @@ -106,6 +110,25 @@ public static void main(MyLocalTonSettings settings, MyLocalTon myLocalTon) thro Node genesisNode = settings.getGenesisNode(); genesisNode.extractBinaries(); + if (!Arrays.asList(args).isEmpty()) { + for (String arg : args) { + + if (arg.equalsIgnoreCase("test-binaries")) { + Pair> validator = new ValidatorEngineExecutor().execute(genesisNode, "-V"); +// Future f = validator.getRight(); + log.info("test feature code {}", validator.getRight().get()); + log.info("test exit code {}", validator.getLeft().exitValue()); + if (validator.getLeft().exitValue() != 0) { + System.out.println("Simple binary test failed."); + System.exit(10); + } else { + System.out.println("Simple binary test passed."); + System.exit(0); + } + } + } + } + // initialize DB dbPool = new DbPool(settings); diff --git a/src/main/java/org/ton/main/Main.java b/src/main/java/org/ton/main/Main.java index 2b470e5..0ce2af4 100644 --- a/src/main/java/org/ton/main/Main.java +++ b/src/main/java/org/ton/main/Main.java @@ -63,6 +63,16 @@ public static void main(String[] args) throws Throwable { System.setProperty("java.awt.headless", "true"); } + if (arg.equalsIgnoreCase("ton-http-api")) { + log.info("enabling ton-http-api on start (default port 8081)"); + settings.getUiSettings().setEnableTonHttpApi(true); + } + + if (arg.equalsIgnoreCase("explorer")) { + log.info("enabling ton-blockchain explorer on start (default port 8000)"); + settings.getUiSettings().setEnableBlockchainExplorer(true); + } + if (InetAddresses.isInetAddress(arg)) { log.info("listening on public IP " + arg); settings.getGenesisNode().setPublicIp(arg); @@ -88,7 +98,7 @@ public static void main(String[] args) throws Throwable { log.info("Starting application at path {}", MyLocalTonUtils.getMyPath()); - App.main(settings, myLocalTon); + App.main(settings, myLocalTon, args); } else { log.error("Instance already running.");