diff --git a/.github/actions/make-docs/action.yml b/.github/actions/make-docs/action.yml new file mode 100644 index 00000000..86ab5546 --- /dev/null +++ b/.github/actions/make-docs/action.yml @@ -0,0 +1,22 @@ +# .github/actions/make-docs/action.yml +name: 'Build Documentation' +description: 'Archives and uploads signed binaries to a GitHub release' + +runs: + using: "composite" + steps: + - uses: actions/setup-python@v5 + with: + python-version: 3.x + - run: echo "cache_id=$(date -u '+%V')" >> $GITHUB_ENV + - uses: actions/cache@v4 + with: + key: mkdocs-material-${{ env.cache_id }} + path: ~/.cache + restore-keys: | + mkdocs-material- + + - if: runner.os == 'Linux' + run: | + sudo apt-get install -y libcairo2-dev libfreetype6-dev libffi-dev libjpeg-dev libpng-dev libz-dev pngquant + - run: pip install mkdocs-git-revision-date-localized-plugin cairosvg mkdocs-git-committers-plugin-2 mkdocs-git-authors-plugin mkdocs-material[imaging] diff --git a/.github/actions/upload-artifacts/action.yml b/.github/actions/upload-artifacts/action.yml index 2cefbdd3..b3872d6d 100644 --- a/.github/actions/upload-artifacts/action.yml +++ b/.github/actions/upload-artifacts/action.yml @@ -6,7 +6,7 @@ inputs: required: true description: 'The chain network name to use in filenames, mainnet or testnet' assets: - description: "A \\n separated string list of filenames to archive; if asset is a abs path, it's respected" + description: "A EOL separated string list of filenames to archive; if asset is a abs path, it's respected" required: false asset-type: required: true @@ -37,6 +37,20 @@ runs: fi echo "version=${VERSION}" >> "$GITHUB_OUTPUT" + if [ "${{ github.event_name }}" == "pull_request" ]; then + TAG_SUFFIX="-${{ github.event.number }}alpha" + PRERELEASE=true + elif [ "${{ inputs.chain-network }}" != "mainnet" ]; then + TAG_SUFFIX="-beta" + PRERELEASE=true + else + TAG_SUFFIX="" + PRERELEASE=false + fi + TAG_NAME="${VERSION}${TAG_SUFFIX}+${{ github.run_number }}" + echo "tag_name=${TAG_NAME}" >> "$GITHUB_OUTPUT" + echo "prerelease=${PRERELEASE}" >> "$GITHUB_OUTPUT" + # Format the output to be a multi-line string. # This is the correct way to pass a multi-line string in GITHUB_OUTPUT. echo "paths<> "$GITHUB_OUTPUT" @@ -70,7 +84,7 @@ runs: - name: Make Release uses: softprops/action-gh-release@v2 with: - tag_name: ${{ steps.asset.outputs.version }}${{ inputs.chain-network == 'mainnet' && '' || '-pre' }}+${{ github.run_number }} - prerelease: ${{ contains(inputs.chain-network, 'testnet') }} + tag_name: ${{ steps.asset.outputs.tag_name }} + prerelease: ${{ steps.asset.outputs.prerelease }} files: ${{ inputs.asset-directory }}/lethean-* - target_commitish: ${{ github.sha }} \ No newline at end of file + target_commitish: ${{ github.sha }} diff --git a/.github/workflows/_on-pr-fast.yml b/.github/workflows/_on-pr-fast.yml index 87d0734b..ee099f16 100644 --- a/.github/workflows/_on-pr-fast.yml +++ b/.github/workflows/_on-pr-fast.yml @@ -12,6 +12,7 @@ on: branches: - dev - main + - dev-* paths-ignore: - '**.md' diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml index 0a88fab3..53e63e03 100644 --- a/.github/workflows/build-docker.yml +++ b/.github/workflows/build-docker.yml @@ -18,7 +18,7 @@ on: jobs: build: name: "lthn/chain:${{ inputs.chain-network == 'testnet' && 'testnet' || 'latest' }}" - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - name: Checkout Project uses: actions/checkout@v4.2.2 @@ -39,6 +39,9 @@ jobs: - name: Build and push id: docker_build uses: docker/build-push-action@v6 + env: + DOCKER_BUILD_SUMMARY: false + DOCKER_BUILD_RECORD_UPLOAD: false with: file: utils/docker/images/lthn-chain/Dockerfile context: ${{ github.workspace }} @@ -46,7 +49,6 @@ jobs: build-args: | BUILD_TESTNET=${{ inputs.chain-network == 'testnet' && '1' || '0' }} THREADS=2 - BUILD_TARGET=gcc-linux-x86_64 BUILD_LOCAL=1 tags: lthn/chain:${{ inputs.chain-network == 'testnet' && 'testnet' || 'latest' }} diff --git a/.github/workflows/build-docs.yml b/.github/workflows/build-docs.yml index bd742fdf..336e75c3 100644 --- a/.github/workflows/build-docs.yml +++ b/.github/workflows/build-docs.yml @@ -27,8 +27,9 @@ jobs: with: key: ${{ github.ref }} path: .cache + - run: sudo apt-get install -y libcairo2-dev libfreetype6-dev libffi-dev libjpeg-dev libpng-dev libz-dev pngquant - - run: pip install mkdocs-git-revision-date-localized-plugin cairosvg mkdocs-git-committers-plugin-2 mkdocs-git-authors-plugin mkdocs-material[imaging] + - run: pip install mkdocs-git-revision-date-localized-plugin mkdocs-git-committers-plugin-2 mkdocs-git-authors-plugin mkdocs-material[imaging] - name: Build Offline Version run: make docs diff --git a/.github/workflows/build-linux-arm64.yml b/.github/workflows/build-linux-arm64.yml index 4269e3db..73fa8155 100644 --- a/.github/workflows/build-linux-arm64.yml +++ b/.github/workflows/build-linux-arm64.yml @@ -22,7 +22,7 @@ jobs: submodules: recursive - name: install dependencies - run: sudo apt-get install -y autotools-dev git build-essential + run: sudo apt-get install -y autotools-dev git build-essential libcairo2-dev libfreetype6-dev libffi-dev libjpeg-dev libpng-dev libz-dev pngquant - name: Cache SDK Folder uses: actions/cache@v4 @@ -30,6 +30,13 @@ jobs: path: ${{ github.workspace }}/build/sdk key: ${{ runner.os }}-${{ runner.arch }}-sdk + - uses: actions/setup-python@v5 + with: + python-version: 3.x + + - run: pip install mkdocs-material mkdocs-git-revision-date-localized-plugin mkdocs-git-committers-plugin-2 mkdocs-git-authors-plugin "mkdocs-material[imaging]" + + - name: Install Conan uses: conan-io/setup-conan@v1 with: diff --git a/.github/workflows/build-linux-intel.yml b/.github/workflows/build-linux-intel.yml index e5125b98..bb30c892 100644 --- a/.github/workflows/build-linux-intel.yml +++ b/.github/workflows/build-linux-intel.yml @@ -30,6 +30,11 @@ jobs: path: ${{ github.workspace }}/build/sdk key: ${{ runner.os }}-${{ runner.arch }}-sdk + - uses: actions/setup-python@v5 + with: + python-version: 3.x + - run: pip install mkdocs-material mkdocs-git-revision-date-localized-plugin mkdocs-git-committers-plugin-2 mkdocs-git-authors-plugin "mkdocs-material[imaging]" + - name: Install Conan uses: conan-io/setup-conan@v1 with: diff --git a/.github/workflows/build-macos-arm64.yml b/.github/workflows/build-macos-arm64.yml index dd53cb1e..24c3249d 100644 --- a/.github/workflows/build-macos-arm64.yml +++ b/.github/workflows/build-macos-arm64.yml @@ -29,6 +29,12 @@ jobs: path: ${{ github.workspace }}/build/sdk key: ${{ runner.os }}-${{ runner.arch }}-sdk + - uses: actions/setup-python@v5 + with: + python-version: 3.x + + - run: pip install mkdocs-material mkdocs-git-revision-date-localized-plugin mkdocs-git-committers-plugin-2 mkdocs-git-authors-plugin "mkdocs-material[imaging]" + - name: Install Conan uses: conan-io/setup-conan@v1 with: diff --git a/.github/workflows/build-macos-intel.yml b/.github/workflows/build-macos-intel.yml index 802e3834..15b50386 100644 --- a/.github/workflows/build-macos-intel.yml +++ b/.github/workflows/build-macos-intel.yml @@ -28,6 +28,11 @@ jobs: path: ${{ github.workspace }}/build/sdk key: ${{ runner.os }}-${{ runner.arch }}-sdk + - uses: actions/setup-python@v5 + with: + python-version: 3.x + - run: pip install mkdocs-material mkdocs-git-revision-date-localized-plugin mkdocs-git-committers-plugin-2 mkdocs-git-authors-plugin "mkdocs-material[imaging]" + - name: Install Conan uses: conan-io/setup-conan@v1 with: diff --git a/.github/workflows/build-windows-intel.yml b/.github/workflows/build-windows-intel.yml index 2f00e6c6..1d59e014 100644 --- a/.github/workflows/build-windows-intel.yml +++ b/.github/workflows/build-windows-intel.yml @@ -13,7 +13,7 @@ on: jobs: msvc-194: name: msvc-194-x86_64 - runs-on: windows-2022 + runs-on: windows-latest steps: - name: Checkout Project uses: actions/checkout@v4.2.2 @@ -27,6 +27,11 @@ jobs: path: ${{ github.workspace }}/build/sdk key: ${{ runner.os }}-${{ runner.arch }}-sdk + - uses: actions/setup-python@v5 + with: + python-version: 3.x + - run: pip install mkdocs-material mkdocs-git-revision-date-localized-plugin mkdocs-git-committers-plugin-2 mkdocs-git-authors-plugin "mkdocs-material[imaging]" + - name: Install Conan uses: conan-io/setup-conan@v1 with: diff --git a/CMakeLists.txt b/CMakeLists.txt index 4e301d0c..ecaf33c5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,5 @@ cmake_minimum_required(VERSION 3.16) +message(STATUS "Using CMake version: ${CMAKE_VERSION}") set(DISABLE_TOR TRUE CACHE BOOL "Disable TOR library(and related tor-connect submodule)") @@ -86,7 +87,7 @@ endif() set(USE_PCH FALSE CACHE BOOL "Use shared precompiled headers") set(DISABLE_TOR FALSE CACHE BOOL "Disable TOR library(and related tor-connect submodule)") -set(TESTNET FALSE CACHE BOOL "Compile for testnet") +set(TESTNET 0 CACHE BOOL "Build TESTNET") set(BUILD_GUI FALSE CACHE BOOL "Build qt-daemon") set(USE_BITCOIN_SECP256K1_FOR_ECDSA FALSE CACHE BOOL "Use bitcoin-secp256k1 library for validating ECDSA(instead of OpenSSL)") if(NOT USE_BITCOIN_SECP256K1_FOR_ECDSA) diff --git a/Makefile b/Makefile index 88b0a5c1..e0b51891 100644 --- a/Makefile +++ b/Makefile @@ -12,8 +12,10 @@ # Default to “unknown” – will be overwritten below. CPU_CORES := 1 TESTNET:= 0 +STATIC:= 0 BUILD_TYPE ?=Release BUILD_VERSION:=6.0.1 +BUILD_FOLDER:=build/release # ----------------------------------------------------------------- # Unix‑like systems (Linux, macOS, *BSD, etc.) @@ -69,7 +71,7 @@ endif # ----------------------------------------------------------------- CPU_CORES := $(or $(CPU_CORES),1) CPU_CORES := $(shell expr $(CPU_CORES) + 0 2>/dev/null || echo 1) -CONAN_CPU_COUNT=$(CPU_CORES) +#CONAN_CPU_COUNT=$(CPU_CORES) PROFILES := $(patsubst cmake/profiles/%,%,$(wildcard cmake/profiles/*)) @@ -77,28 +79,37 @@ SORTED_PROFILES := $(sort $(PROFILES)) CONAN_CACHE := $(CURDIR)/build/sdk DEFAULT_CONAN_PROFILE := $(CONAN_CACHE)/profiles/default CC_DOCKER_FILE?=utils/docker/images/lthn-chain/Dockerfile - +# Detect if we are on Windows +ifeq ($(OS), Windows_NT) + # If so, define a prefix to clear the problematic env vars + FIX_ENV := CFLAGS="" CXXFLAGS="" +else + # Otherwise, the prefix is empty + FIX_ENV := +endif all: help -release: conan-profile-detect - @echo "Building profile: release $(TESTNET)" - CONAN_HOME=$(CONAN_CACHE) conan install . --output-folder=build/release --build=missing -s build_type=$(BUILD_TYPE) - cmake -S . -B build/release -DCMAKE_TOOLCHAIN_FILE=build/release/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) -DTESTNET=$(TESTNET) -DBUILD_VERSION=$(BUILD_VERSION) - cmake --build build/release --config=$(BUILD_TYPE) --parallel=$(CPU_CORES) - (cd build/release && cpack) +release: docs build + (cd $(BUILD_FOLDER) && cpack) + +build: configure + cmake --build $(BUILD_FOLDER) --config=$(BUILD_TYPE) --parallel=$(CPU_CORES) debug: conan-profile-detect @echo "Building profile: debug" - CONAN_HOME=$(CONAN_CACHE) conan install . --output-folder=build/debug --build=missing -s build_type=Debug + $(FIX_ENV) CONAN_HOME=$(CONAN_CACHE) conan install . --output-folder=build/debug --build=missing -s build_type=Debug cmake -S . -B build/debug -DCMAKE_TOOLCHAIN_FILE=build/debug/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Debug -DTESTNET=$(TESTNET) cmake --build build/debug --config=Debug --parallel=$(CPU_CORES) -static: static-release -static-release: conan-profile-detect - @echo "Building profile: release-static" - CONAN_HOME=$(CONAN_CACHE) conan install . --output-folder=build/release-static --build=missing -s build_type=$(BUILD_TYPE) - cmake -S . -B build/release-static -DCMAKE_TOOLCHAIN_FILE=build/release-static/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) -D STATIC=ON -DTESTNET=$(TESTNET) - cmake --build build/release-static --config=$(BUILD_TYPE) --parallel=$(CPU_CORES) + +build-deps: conan-profile-detect + @echo "Build Dependencies: $(BUILD_TYPE) testnet=$(TESTNET)" + $(FIX_ENV) CONAN_HOME=$(CONAN_CACHE) conan install . --build=missing -s build_type=$(BUILD_TYPE) + +configure: build-deps + @echo "Running Configure: $(BUILD_TYPE) testnet=$(TESTNET)" + cmake -S . -B $(BUILD_FOLDER) -DCMAKE_TOOLCHAIN_FILE=$(BUILD_FOLDER)/generators/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) -DSTATIC=$(STATIC) -DTESTNET=$(TESTNET) -DBUILD_VERSION=$(BUILD_VERSION) + conan-profile-detect: @if [ ! -f "$(DEFAULT_CONAN_PROFILE)" ]; then \ @@ -110,9 +121,10 @@ conan-profile-detect: # Rule for each profile $(PROFILES): conan-profile-detect @echo "Building profile: $@" - CONAN_HOME=$(CONAN_CACHE) conan install . --output-folder=build/$@ -pr:b=$(DEFAULT_CONAN_PROFILE) -pr:h=cmake/profiles/$@ --build=missing -s build_type=$(BUILD_TYPE) - cmake -S . -B build/$@ -DCMAKE_TOOLCHAIN_FILE=build/$@/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) -DTESTNET=$(TESTNET) - cmake --build build/$@ --config=$(BUILD_TYPE) --parallel=$(CPU_CORES) + CFLAGS="" CXXFLAGS="" CONAN_HOME=$(CONAN_CACHE) conan install . -pr:h=cmake/profiles/$@ --build=missing -s build_type=$(BUILD_TYPE) + cmake -S . -B $(BUILD_FOLDER) -DCMAKE_TOOLCHAIN_FILE=$(BUILD_FOLDER)/generators/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) -DSTATIC=$(STATIC) -DTESTNET=$(TESTNET) -DBUILD_VERSION=$(BUILD_VERSION) + cmake --build $(BUILD_FOLDER) --config=$(BUILD_TYPE) --parallel=$(CPU_CORES) + (cd $(BUILD_FOLDER) && cpack) help: @echo "Available targets:" @@ -147,10 +159,6 @@ test-debug: cmake --build build/test-debug --config=Debug --parallel=$(CPU_CORES) $(MAKE) test -configure: - @echo "Running Config: release" - CONAN_HOME=$(CONAN_CACHE) conan install . --output-folder=build/release --build=missing -s build_type=$(BUILD_TYPE) - cmake -S . -B build/release -DCMAKE_TOOLCHAIN_FILE=build/release/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) docs: configure @echo "Building Documentation" @@ -160,29 +168,6 @@ docs-dev: configure @echo "Building Documentation" cmake --build build/release --target=serve_docs --config=Release -docker-chain-node: - @echo "Building docker image: lthn/chain" - docker buildx build -f $(CC_DOCKER_FILE) -t lthn/chain $(CURDIR) - -docker-cc-linux-amd64: - docker buildx build -f $(CC_DOCKER_FILE) --target build-artifacts --output type=local,dest=build/cc-linux-amd64 --platform linux/amd64 $(CURDIR) - -docker-cc-linux-armv7: - docker buildx build -f $(CC_DOCKER_FILE) --target build-artifacts --output type=local,dest=build/cc-linux-armv7 --platform linux/arm/v7 $(CURDIR) - -docker-cc-linux-arm64v8: - docker buildx build -f $(CC_DOCKER_FILE) --target build-artifacts --output type=local,dest=build/cc-linux-arm64v8 --platform linux/arm64/v8 $(CURDIR) - -docker-cc-linux-ppc64le: - docker buildx build -f $(CC_DOCKER_FILE) --target build-artifacts --output type=local,dest=build/cc-linux-ppc64le --platform linux/ppc64le $(CURDIR) - -docker-cc-linux-riscv64: - docker buildx build -f $(CC_DOCKER_FILE) --target build-artifacts --output type=local,dest=build/cc-linux-riscv64 --platform linux/riscv64 $(CURDIR) - -docker-cc-linux-s390x: - docker buildx build -f $(CC_DOCKER_FILE) --target build-artifacts --output type=local,dest=build/cc-linux-s390x --platform linux/s390x $(CURDIR) - - clean: rm -rf build diff --git a/cmake/CPackConfig.cmake b/cmake/CPackConfig.cmake index 4140328c..47f03de9 100644 --- a/cmake/CPackConfig.cmake +++ b/cmake/CPackConfig.cmake @@ -8,36 +8,36 @@ if(CMAKE_BUILD_TYPE STREQUAL "Release") set(CPACK_PACKAGE_CONTACT "${package_contact}") set(CPACK_PACKAGE_HOMEPAGE_URL "${package_website}") -# set(CPACK_PACKAGING_INSTALL_PREFIX "/usr/local") # Linux/macOS default -# if(WIN32) -# set(CPACK_PACKAGING_INSTALL_PREFIX "C:/Program Files/${PROJECT_NAME}") -# endif() + #set(CPACK_PACKAGING_INSTALL_PREFIX "/usr/local") # Linux/macOS default + #if(WIN32) + # set(CPACK_PACKAGING_INSTALL_PREFIX "C:/Program Files/${PROJECT_NAME}") + #endif() if(APPLE) if("${package_macos_installer}" STREQUAL "DMG") - set(CPACK_GENERATOR "DragNDrop") + # set(CPACK_GENERATOR "DragNDrop") # set(CPACK_DMG_BACKGROUND_IMAGE "${CMAKE_SOURCE_DIR}/resources/dmg_background.png") - set(CPACK_DMG_VOLUME_NAME "${CPACK_PACKAGE_NAME} ${CPACK_PACKAGE_VERSION}") - message(STATUS "Registered CPACK_GENERATOR: DragNDrop") + # set(CPACK_DMG_VOLUME_NAME "${CPACK_PACKAGE_NAME} ${CPACK_PACKAGE_VERSION}") + # message(STATUS "Registered CPACK_GENERATOR: DragNDrop") else () - set(CPACK_GENERATOR "productbuild") - set(CPACK_PRODUCTBUILD_IDENTIFIER "${package_macos_pkg_productbuild_identifier}") + # set(CPACK_GENERATOR "productbuild") + # set(CPACK_PRODUCTBUILD_IDENTIFIER "${package_macos_pkg_productbuild_identifier}") # set(CPACK_PRODUCTBUILD_SIGNING_IDENTITY "Developer ID Installer: Your Company (TEAMID)") - message(STATUS "Registered CPACK_GENERATOR: productbuild") + # message(STATUS "Registered CPACK_GENERATOR: productbuild") endif () elseif(WIN32) - set(CPACK_GENERATOR "WIX") - message(STATUS "Registered CPACK_GENERATOR: WIX") + # set(CPACK_GENERATOR "WIX") + # message(STATUS "Registered CPACK_GENERATOR: WIX") # set(CPACK_WIX_PRODUCT_ICON "${CMAKE_SOURCE_DIR}/resources/windows_icon.ico") # set(CPACK_WIX_LICENSE_RTF "${CMAKE_SOURCE_DIR}/LICENSE.rtf") # set(CPACK_WIX_UPGRADE_GUID "D3F5A9C1-4B2E-4F5A-9C71-123456789ABC") # change once per major version else() - set(CPACK_GENERATOR "DEB") - message(STATUS "Registered CPACK_GENERATOR: deb") - set(CPACK_DEBIAN_PACKAGE_MAINTAINER "${package_contact}") - set(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6 (>= 2.28)") - set(CPACK_DEBIAN_PACKAGE_SECTION "utils") - set(CPACK_DEBIAN_ARCHITECTURE "${CMAKE_SYSTEM_PROCESSOR}") + # set(CPACK_GENERATOR "DEB") + # message(STATUS "Registered CPACK_GENERATOR: deb") + # set(CPACK_DEBIAN_PACKAGE_MAINTAINER "${package_contact}") + # set(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6 (>= 2.28)") + # set(CPACK_DEBIAN_PACKAGE_SECTION "utils") + # set(CPACK_DEBIAN_ARCHITECTURE "${CMAKE_SYSTEM_PROCESSOR}") # post‑install script (e.g., to register a systemd service) # set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA # "${CMAKE_SOURCE_DIR}/scripts/postinstall.sh") @@ -59,7 +59,7 @@ if(CMAKE_BUILD_TYPE STREQUAL "Release") set(CPACK_PACKAGE_DIRECTORY "${CMAKE_BINARY_DIR}/packages") install(FILES README.md LICENSE.txt - DESTINATION "share/doc/${CPACK_PACKAGE_NAME}" + DESTINATION "share/doc/${PROJECT_NAME}" ) set(_arch "${CMAKE_SYSTEM_PROCESSOR}") diff --git a/cmake/profiles/msvc-194-x86_64 b/cmake/profiles/msvc-194-x86_64 index aea65d04..5d56b3b2 100644 --- a/cmake/profiles/msvc-194-x86_64 +++ b/cmake/profiles/msvc-194-x86_64 @@ -5,6 +5,4 @@ compiler.cppstd=17 compiler.runtime=static compiler.version=194 os=Windows - -[conf] -tools.cmake.cmaketoolchain:user_presets=False +build_type=Release \ No newline at end of file diff --git a/conanfile.py b/conanfile.py new file mode 100644 index 00000000..efed9a7b --- /dev/null +++ b/conanfile.py @@ -0,0 +1,48 @@ +import os + +from conan import ConanFile +from conan.tools.cmake import cmake_layout, CMakeDeps, CMakeToolchain, CMake + + +class BlockchainConan(ConanFile): + name = "blockchain" + version = "6.0.1" + settings = "os", "compiler", "build_type", "arch" + + options = { + "static": [True, False], + "testnet": [True, False] + } + default_options = { + "static": False, + "testnet": False + } + + requires = [ + "zlib/1.3.1", + "boost/1.85.0", + "openssl/3.2.0", + "miniupnpc/2.2.5", + "jwt-cpp/0.7.1" + ] + + def generate(self): + tc = CMakeToolchain(self) + tc.user_presets_path = False + tc.variables["STATIC"] = self.options.static + tc.variables["TESTNET"] = self.options.testnet + # tc.preprocessor_definitions["TESTNET"] = None + # tc.variables["BUILD_VERSION"] = self.options.build_version + tc.generate() + + deps = CMakeDeps(self) + deps.generate() + + def layout(self): + self.folders.generators = os.path.join("build", str(self.settings.build_type).lower(), "generators") + self.folders.build = os.path.join("build", str(self.settings.build_type).lower()) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() \ No newline at end of file diff --git a/conanfile.txt b/conanfile.txt deleted file mode 100644 index 1103965d..00000000 --- a/conanfile.txt +++ /dev/null @@ -1,10 +0,0 @@ -[requires] -zlib/1.3.1 -boost/1.85.0 -openssl/3.2.0 -miniupnpc/2.2.5 -jwt-cpp/0.7.1 - -[generators] -CMakeDeps -CMakeToolchain diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000..0653393a --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,27 @@ +version: '3.8' +services: + lethean-chain: + image: lthn/chain:testnet + build: + tags: + - lthn/chain:testnet + dockerfile: utils/docker/images/lthn-chain/Dockerfile + context: . + target: chain-service + args: + - BUILD_THREADS=1 + - BUILD_TESTNET=1 + - BUILD_STATIC=0 + - BUILD_BRANCH=dev + - BUILD_LOCAL=1 + - BUILD_REPO=https://github.com/letheanVPN/blockchain.git + - BUILD_FOLDER=build/release + - BUILD_TYPE=Release + ports: + - "36941:36941" + - "36942:36942" + volumes: + - lethean_data:/data + +volumes: + lethean_data: \ No newline at end of file diff --git a/src/config/currency_config.h.in b/src/config/currency_config.h.in index f3a735ce..6eabc558 100644 --- a/src/config/currency_config.h.in +++ b/src/config/currency_config.h.in @@ -34,7 +34,7 @@ #define CURRENCY_TX_MAX_ALLOWED_OUTS 2000 #define CURRENCY_TX_MIN_ALLOWED_OUTS 2 // effective starting HF4 Zarcanum #define CURRENCY_PUBLIC_ADDRESS_BASE58_PREFIX @address_prefix@ // addresses start with 'Zx' -#define CURRENCY_PUBLIC_INTEG_ADDRESS_BASE58_PREFIX 0x3678 // integrated addresses start with 'iZ' +#define CURRENCY_PUBLIC_INTEG_ADDRESS_BASE58_PREFIX @address_prefix_integrated@ // integrated addresses start with 'iZ' #define CURRENCY_PUBLIC_INTEG_ADDRESS_V2_BASE58_PREFIX @address_prefix_integrated@ // integrated addresses start with 'iZ' (new format) #define CURRENCY_PUBLIC_AUDITABLE_ADDRESS_BASE58_PREFIX @address_prefix_auditable@ // auditable addresses start with 'aZx' #define CURRENCY_PUBLIC_AUDITABLE_INTEG_ADDRESS_BASE58_PREFIX @address_prefix_auditable_integrated@ // auditable integrated addresses start with 'aiZX' diff --git a/src/config/default.cmake b/src/config/default.cmake index 5c9fbe1f..56929c50 100644 --- a/src/config/default.cmake +++ b/src/config/default.cmake @@ -1,6 +1,6 @@ # Tokenomics set(coin 1000000000000 CACHE STRING "COIN" ) -set(premine_amount 4000000000000000000 CACHE STRING "PREMINE_AMOUNT" ) +set(premine_amount 10000000000000000000 CACHE STRING "PREMINE_AMOUNT" ) set(tx_default_fee 10000000000 CACHE STRING "TX_DEFAULT_FEE" ) set(tx_minimum_fee 10000000000 CACHE STRING "TX_MINIMUM_FEE" ) set(currency_block_reward 1000000000000 CACHE STRING "CURRENCY_BLOCK_REWARD" ) diff --git a/src/genesis/.genesis.txt b/src/genesis/.genesis.txt deleted file mode 100644 index 99d5bea0..00000000 --- a/src/genesis/.genesis.txt +++ /dev/null @@ -1 +0,0 @@ -01010000018080a0cfc8e0c8e38a0103858421a2d287027bdde3db5e385b0c728f598ad1647c8e17036d3ef63f61bb98000516f971f914382e875df5655f591c8df7b126d95f5e8331613ba3f5c797f541839c136b49742074616b657320616476616e74616765206f6620746865206e6174757265206f6620696e666f726d6174696f6e206265696e67206561737920746f2073707265616420627574206861726420746f20737469666c652e202d205361746f736869204e616b616d6f746f15000b02660d0e0a0000 \ No newline at end of file diff --git a/src/genesis/.genesis_tn.txt b/src/genesis/.genesis_tn.txt new file mode 100644 index 00000000..a4a0e310 --- /dev/null +++ b/src/genesis/.genesis_tn.txt @@ -0,0 +1 @@ +01010000018080a0cfc8e0c8e38a01037313cc261a42a1a002c472cbe67c7873e4f9cf44a59bda3fdd8651d615d4e3a00005166f7fbc7dfa2809974084b92e8930353b7e93f8759979ff037984a1837fb3948a136b49742074616b657320616476616e74616765206f6620746865206e6174757265206f6620696e666f726d6174696f6e206265696e67206561737920746f2073707265616420627574206861726420746f20737469666c652e202d205361746f736869204e616b616d6f746f15000b02bcdd0e0a0000 \ No newline at end of file diff --git a/src/p2p/net_node.inl b/src/p2p/net_node.inl index 2f1df0e2..5f90c0d5 100644 --- a/src/p2p/net_node.inl +++ b/src/p2p/net_node.inl @@ -434,8 +434,8 @@ namespace nodetool { #ifndef TESTNET //TODO: - ADD_HARDCODED_SEED_NODE(std::string("0.0.0.0:") + std::to_string(P2P_DEFAULT_PORT)); - ADD_HARDCODED_SEED_NODE("116.202.82.115", P2P_DEFAULT_PORT); + ADD_HARDCODED_SEED_NODE("116.202.82.115", P2P_DEFAULT_PORT); // Hetzner + ADD_HARDCODED_SEED_NODE("34.13.212.174", P2P_DEFAULT_PORT); // Google //ADD_HARDCODED_SEED_NODE("94.130.137.230", P2P_DEFAULT_PORT); //ADD_HARDCODED_SEED_NODE("95.217.42.247", P2P_DEFAULT_PORT); //ADD_HARDCODED_SEED_NODE("94.130.160.115", P2P_DEFAULT_PORT); @@ -445,7 +445,8 @@ namespace nodetool //ADD_HARDCODED_SEED_NODE("144.76.183.143", P2P_DEFAULT_PORT); #else // TESTNET - ADD_HARDCODED_SEED_NODE("116.202.82.115", P2P_DEFAULT_PORT); + ADD_HARDCODED_SEED_NODE("116.202.82.115", P2P_DEFAULT_PORT); // Hetzner + ADD_HARDCODED_SEED_NODE("34.13.212.174", P2P_DEFAULT_PORT); // Google //ADD_HARDCODED_SEED_NODE("94.130.137.230", P2P_DEFAULT_PORT); //ADD_HARDCODED_SEED_NODE("95.217.42.247", P2P_DEFAULT_PORT); //ADD_HARDCODED_SEED_NODE("94.130.160.115", P2P_DEFAULT_PORT); @@ -705,7 +706,7 @@ namespace nodetool }else { LOG_PRINT_L0(" COMMAND_HANDSHAKE(AND CLOSE) INVOKED OK"); - //m_net_server.get_config_object().close(context_.m_connection_id); + // m_net_server.get_config_object().close(context_.m_connection_id); } }, P2P_DEFAULT_HANDSHAKE_INVOKE_TIMEOUT); diff --git a/utils/docker/images/lthn-chain/Dockerfile b/utils/docker/images/lthn-chain/Dockerfile index f32c9603..aecf275a 100644 --- a/utils/docker/images/lthn-chain/Dockerfile +++ b/utils/docker/images/lthn-chain/Dockerfile @@ -1,22 +1,15 @@ -# use --target=builder to return a docker image able to compile the software, probbly used with -v .:/code +# use --target=builder to return a docker image able to compile the software, probably used with -v .:/code FROM ubuntu:24.04 AS builder LABEL authors="snider" - -ARG THREADS=1 -ARG BUILD_BRANCH=dev -ARG BUILD_LOCAL=1 -ARG BUILD_REPO=https://github.com/letheanVPN/blockchain.git -ARG BUILD_TARGET=gcc-linux-x86_64 -ARG BUILD_FOLDER=build/release -ARG BUILD_TYPE=Release +ARG BUILD_THREADS=1 ARG BUILD_TESTNET=1 -ARG USE_CUSTOM_PROFILE=0 - - +ARG BUILD_STATIC=0 +ARG BUILD_LOCAL=1 ENV CONAN_HOME=/root/sdk +ARG BUILD_REPO=https://github.com/letheanVPN/blockchain.git +ARG BUILD_BRANCH=dev # CONAN: disables the generation of color escape characters. ENV NO_COLOR=1 -ENV BUILD_TARGET=${BUILD_TARGET} ENV DEBIAN_FRONTEND=noninteractive RUN apt update && apt -y upgrade @@ -26,39 +19,33 @@ RUN apt install -y build-essential pkgconf \ g++ llvm clang lld cmake python-is-python3 \ git python3 python3-pip python3-dev xz-utils gperf -RUN pip3 install conan --break-system-packages +RUN pip3 install conan mkdocs-git-revision-date-localized-plugin mkdocs-git-committers-plugin-2 mkdocs-git-authors-plugin mkdocs-material[imaging] --break-system-packages WORKDIR / # Copy the build context. -COPY . /tmp/local-src -RUN if [ "$BUILD_LOCAL" = "1" ]; then \ - mv /tmp/local-src /code; \ - else \ - rm -rf /tmp/local-src; \ +COPY . /code + +VOLUME /code/build/sdk + +RUN if [ "$BUILD_LOCAL" = "0" ]; then \ + rm -rf /code; \ git clone --recursive --branch ${BUILD_BRANCH} ${BUILD_REPO} code; \ fi WORKDIR /code -RUN conan profile detect --name=default --force +FROM builder AS build +ARG BUILD_THREADS=1 +ARG BUILD_STATIC=0 +ARG BUILD_FOLDER=build/release +ARG BUILD_TYPE=Release +ARG BUILD_TESTNET=1 -#RUN conan install . --output-folder=${BUILD_FOLDER} --build=missing -s build_type=${BUILD_TYPE} -pr:h=/code/cmake/profiles/$BUILD_TARGET -RUN set -eux; \ - BCMD="conan install . \ - --output-folder=${BUILD_FOLDER} \ - --build=missing \ - -s build_type=${BUILD_TYPE}"; \ - if [ "${USE_CUSTOM_PROFILE}" = "1" ]; then \ - BCMD="$BCMD -pr:h=/code/cmake/profiles/${BUILD_TARGET}"; \ - fi; \ - echo "Running: $BCMD"; \ - eval $BCMD; -RUN cmake -S /code -B ${BUILD_FOLDER} -DCMAKE_TOOLCHAIN_FILE=${BUILD_FOLDER}/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DTESTNET=${BUILD_TESTNET} - -RUN cmake --build ${BUILD_FOLDER} --config=${BUILD_TYPE} --parallel=${THREADS} +RUN make build CPU_CORES=${BUILD_THREADS} TESTNET=${BUILD_TESTNET} STATIC=${BUILD_STATIC} +#RUN cmake --build ${BUILD_FOLDER} --config=${BUILD_TYPE} --parallel=${THREADS} # minor cmd-fu; TESTNEt and MAINNET, in docker context, use MAIINNET binaries names. # do i like removing `-testnet`, no, but i dislike working around multiple names for ever more, so... @@ -69,17 +56,18 @@ RUN if [ "$BUILD_TESTNET" = "1" ]; then \ done; \ fi -# use --target=build-cache to return just the cache files -FROM scratch AS build-cache -COPY --from=builder ${CONAN_HOME} / - # use --target=build-artifacts to return the binaries FROM scratch AS build-artifacts -COPY --from=builder /code/build/release/src/lethean-* / +COPY --from=build /code/build/release/src/lethean-* / # use --target=chain-service to return a working chain node FROM ubuntu:24.04 AS chain-service COPY --from=build-artifacts --chmod=+x / /bin +EXPOSE 36941 +EXPOSE 36942 + RUN lethean-chain-node --help + +ENTRYPOINT ["lethean-chain-node", "--data-dir", "/data", "--disable-upnp", "--disable-debug-p2p-requests"] \ No newline at end of file