### Build and Install Tonlib C++ Library Source: https://github.com/ston-fi/ton/blob/master/example/cpp/README.md This snippet provides shell commands to navigate to the Ton sources, create a build directory, configure CMake for a release build with a specific installation prefix, and then build and install the Tonlib library. ```Shell cd mkdir build cd build cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH=../example/cpp/tonlib .. cmake --build . --target install ``` -------------------------------- ### Build Tonlib C++ Examples Source: https://github.com/ston-fi/ton/blob/master/example/cpp/README.md This snippet shows the shell commands required to navigate to the C++ example directory, create a build directory, configure CMake to find the previously installed Tonlib library, and then build the examples. ```Shell cd /example/cpp mkdir build cd build cmake -DCMAKE_BUILD_TYPE=Release -DTonlib_DIR=/example/cpp/tonlib/lib/cmake/Tonlib .. cmake --build . ``` -------------------------------- ### Install lite-client Executable (CMake) Source: https://github.com/ston-fi/ton/blob/master/lite-client/CMakeLists.txt Configures the installation rule for the `lite-client` executable. It specifies that the executable should be installed to the `bin` directory during the installation process. ```CMake install(TARGETS lite-client RUNTIME DESTINATION bin) ``` -------------------------------- ### Install create-hardfork Executable Source: https://github.com/ston-fi/ton/blob/master/create-hardfork/CMakeLists.txt Configures the installation rule for the `create-hardfork` executable target. It specifies that the built runtime executable should be installed into the `bin` directory within the installation prefix. ```CMake install(TARGETS create-hardfork RUNTIME DESTINATION bin) ``` -------------------------------- ### Install Executable (CMake) Source: https://github.com/ston-fi/ton/blob/master/blockchain-explorer/CMakeLists.txt Defines the installation rule for the `blockchain-explorer` executable, specifying that it should be placed in the `bin` subdirectory of the installation prefix. ```CMake install(TARGETS blockchain-explorer RUNTIME DESTINATION bin) ``` -------------------------------- ### Install rldp-http-proxy Executable (CMake) Source: https://github.com/ston-fi/ton/blob/master/rldp-http-proxy/CMakeLists.txt Configures the installation of the `rldp-http-proxy` executable target. It will be installed as a runtime component to the 'bin' destination directory. ```CMake install(TARGETS rldp-http-proxy RUNTIME DESTINATION bin) ``` -------------------------------- ### Install HTTP Proxy Executable (CMake) Source: https://github.com/ston-fi/ton/blob/master/http/CMakeLists.txt This command sets up an installation rule for the `http-proxy` executable, specifying that it should be installed as a runtime component into the `bin` directory. ```CMake install(TARGETS http-proxy RUNTIME DESTINATION bin) ``` -------------------------------- ### Install DHT Server Executable (CMake) Source: https://github.com/ston-fi/ton/blob/master/dht-server/CMakeLists.txt Configures the installation rule for the `dht-server` executable, specifying that it should be installed as a runtime binary in the `bin` directory during the installation step. ```CMake install(TARGETS dht-server RUNTIME DESTINATION bin) ``` -------------------------------- ### Installing Storage Targets (CMake) Source: https://github.com/ston-fi/ton/blob/master/storage/CMakeLists.txt Configures the installation of the 'storage-cli', 'storage-daemon', and 'storage-daemon-cli' runtime targets. They are specified to be installed into the 'bin' destination directory. ```CMake install(TARGETS storage-cli storage-daemon storage-daemon-cli RUNTIME DESTINATION bin) ``` -------------------------------- ### Install Native Executable Target in CMake Source: https://github.com/ston-fi/ton/blob/master/tolk/CMakeLists.txt This command configures the installation of the 'tolk' executable target. It specifies that the runtime executable should be installed to the 'bin' directory relative to the installation prefix. ```CMake install(TARGETS tolk RUNTIME DESTINATION bin) ``` -------------------------------- ### Install Build Artifacts Source: https://github.com/ston-fi/ton/blob/master/crypto/CMakeLists.txt Installs the fift, func, create-state, and tlbc targets to the bin destination, the fift/lib directory to lib/fift, and the smartcont directory to share/ton. ```CMake install(TARGETS fift func create-state tlbc RUNTIME DESTINATION bin) install(DIRECTORY fift/lib/ DESTINATION lib/fift) install(DIRECTORY smartcont DESTINATION share/ton) ``` -------------------------------- ### Install Executable Targets - CMake Source: https://github.com/ston-fi/ton/blob/master/utils/CMakeLists.txt Configures the installation process to place the 'generate-random-id' and 'proxy-liteserver' executables into the 'bin' directory during the CMake install step. ```CMake install(TARGETS generate-random-id proxy-liteserver RUNTIME DESTINATION bin) ``` -------------------------------- ### Install MetalLB - Kubernetes Source: https://github.com/ston-fi/ton/blob/master/docker/README.md Command to apply the official MetalLB manifest from its GitHub repository. This installs the MetalLB controller and components into the metallb-system namespace. ```Shell kubectl apply -f https://raw.githubusercontent.com/metallb/metallb/v0.14.5/config/manifests/metallb-native.yaml ``` -------------------------------- ### Installing Tonlib CLI Executable - CMake Source: https://github.com/ston-fi/ton/blob/master/tonlib/CMakeLists.txt Installs the tonlib-cli executable to the standard binary destination directory. ```CMake install(TARGETS tonlib-cli RUNTIME DESTINATION bin) ``` -------------------------------- ### Install Validator Engine Console Executable (CMake) Source: https://github.com/ston-fi/ton/blob/master/validator-engine-console/CMakeLists.txt Sets up the installation rule for the `validator-engine-console` executable. It specifies that the executable should be installed to the `bin` directory during the CMake installation process. ```CMake install(TARGETS validator-engine-console RUNTIME DESTINATION bin) ``` -------------------------------- ### Configuring CMake Project with Tonlib Source: https://github.com/ston-fi/ton/blob/master/example/cpp/CMakeLists.txt This snippet sets up the basic CMake project, finds the required Tonlib package, and defines two executable targets ('tonjson_example' and 'tonlib_example') with their source files, linked libraries, and C++ standard versions. ```CMake cmake_minimum_required(VERSION 3.1 FATAL_ERROR) project(TonExample VERSION 1.0 LANGUAGES CXX) find_package(Tonlib 0.5 REQUIRED) add_executable(tonjson_example tonjson_example.cpp) target_link_libraries(tonjson_example PRIVATE Tonlib::TonlibJson) set_property(TARGET tonjson_example PROPERTY CXX_STANDARD 11) add_executable(tonlib_example tonlib_example.cpp) target_link_libraries(tonlib_example PRIVATE Tonlib::Tonlib) set_property(TARGET tonlib_example PROPERTY CXX_STANDARD 14) ``` -------------------------------- ### Install Emulator Library in CMake Source: https://github.com/ston-fi/ton/blob/master/emulator/CMakeLists.txt Defines installation rules for the `emulator` target, specifying that archive and library files should be installed in the `lib` destination directory. ```CMake install(TARGETS emulator ARCHIVE DESTINATION lib LIBRARY DESTINATION lib) ``` -------------------------------- ### Installing WebAssembly Build Dependencies on Ubuntu Source: https://github.com/ston-fi/ton/blob/master/README.md This snippet updates package lists and installs essential build tools, libraries (like zlib, secp256k1, microhttpd, sodium), and LLVM version 16 on Ubuntu, required for compiling TON to WebAssembly. ```Bash sudo apt-get update sudo apt-get install -y build-essential git cmake ninja-build zlib1g-dev libsecp256k1-dev libmicrohttpd-dev libsodium-dev wget https://apt.llvm.org/llvm.sh chmod +x llvm.sh sudo ./llvm.sh 16 all ``` -------------------------------- ### Example Synchronization Log Output (Log) Source: https://github.com/ston-fi/ton/blob/master/docker/README.md Illustrates log messages indicating the node is actively downloading state and key blocks, showing progress towards synchronization. ```log failed to download key blocks: [Error : 652 : adnl query timeout] last key block is [ w=-1 s=9223372036854775808 seq=34879845 rcEsfLF3E80PqQPWesW+rlOY2EpXd5UDrW32SzRWgus= C1Hs+q2Vew+WxbGL6PU1P6R2iYUJVJs4032CTS/DQzI= ] getnextkey: [Error : 651 : not inited] downloading state (-1,8000000000000000,38585739):9E86E166AE7E24BAA22762766381440C625F47E2B11D72967BB58CE8C90F7EBA:5BFFF759380097DF178325A7151E9C0571C4E452A621441A03A0CECAED970F57: total=1442840576 (71MB/s) finished downloading state (-1,8000000000000000,38585739):9E86E166AE7E24BAA22762766381440C625F47E2B11D72967BB58CE8C90F7EBA:5BFFF759380097DF178325A7151E9C0571C4E452A621441A03A0CECAED970F57: total=4520747390 getnextkey: [Error : 651 : not inited] getnextkey: [Error : 651 : not inited] ``` -------------------------------- ### Example Initial Log Output (Log) Source: https://github.com/ston-fi/ton/blob/master/docker/README.md Shows typical log messages seen during the initial phase of a TON node startup, indicating it's trying to connect and download data. Errors like "no nodes" or "adnl query timeout" are expected initially. ```log failed to download proof link: [Error : 651 : no nodes] ``` -------------------------------- ### Install tonlibjson Targets Source: https://github.com/ston-fi/ton/blob/master/tonlib/CMakeLists.txt Installs the 'tonlibjson' and 'TonlibJson' targets to standard library, archive, runtime, and include destinations, exporting them under the 'Tonlib' name. ```CMake install(TARGETS tonlibjson TonlibJson EXPORT Tonlib LIBRARY DESTINATION lib ARCHIVE DESTINATION lib RUNTIME DESTINATION bin INCLUDES DESTINATION include ) ``` -------------------------------- ### Example lite-client Output (Synced) (Log) Source: https://github.com/ston-fi/ton/blob/master/docker/README.md Shows the expected output from `lite-client last` when the node is fully synchronized, displaying the server version, time, and the latest masterchain block information. ```log conn ready server version is 1.1, capabilities 7 server time is 1719306580 (delta 0) last masterchain block is (-1,8000000000000000,20435927):47A517265B25CE4F2C8B3058D46343C070A4B31C5C37745390CE916C7D1CE1C5:279F9AA88C8146257E6C9B537905238C26E37DC2E627F2B6F1D558CB29A6EC82 server time is 1719306580 (delta 0) zerostate id set to -1:823F81F306FF02694F935CF5021548E3CE2B86B529812AF6A12148879E95A128:67E20AC184B9E039A62667ACC3F9C00F90F359A76738233379EFA47604980CE8 ``` -------------------------------- ### Installing Tonlib Headers - CMake Source: https://github.com/ston-fi/ton/blob/master/tonlib/CMakeLists.txt Installs various header files required by the tonlib library and its dependencies into the specified include directories. ```CMake install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/tonlib/Client.h DESTINATION include/tonlib/) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../tl/generate/auto/tl/tonlib_api.h DESTINATION include/auto/tl/) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../tl/tl/TlObject.h DESTINATION include/tl/) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../tdutils/td/utils/int_types.h DESTINATION include/td/utils/) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../tdutils/td/utils/Slice-decl.h DESTINATION include/td/utils/) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../tdutils/td/utils/Slice.h DESTINATION include/td/utils/) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../tdutils/td/utils/common.h DESTINATION include/td/utils/) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../tdutils/td/utils/unique_ptr.h DESTINATION include/td/utils/) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../tdutils/td/utils/check.h DESTINATION include/td/utils/) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../tdutils/td/utils/SharedSlice.h DESTINATION include/td/utils/) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../tdutils/td/utils/port/platform.h DESTINATION include/td/utils/port) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/../tdutils/td/utils/config.h DESTINATION include/td/utils/) ``` -------------------------------- ### Install Validator Engine Executable (CMake) Source: https://github.com/ston-fi/ton/blob/master/validator-engine/CMakeLists.txt Configures the installation rule for the `validator-engine` executable, specifying that it should be installed as a runtime binary in the `bin` directory. ```CMake install(TARGETS validator-engine RUNTIME DESTINATION bin) ``` -------------------------------- ### Running TON Node Docker Container (Host Network) Source: https://github.com/ston-fi/ton/blob/master/docker/README.md This command starts a Docker container for a TON node using the host's network stack (`--network host`). It mounts a volume for the database, sets environment variables for the public IP, enables the Lite server, and specifies the dump URL for synchronization. This method simplifies networking but shares the host's network interface. ```bash docker run -d --name ton-node -v /data/db:/var/ton-work/db \ -e "PUBLIC_IP=" \ -e "LITESERVER=true" \ -e "DUMP_URL=https://dump.ton.org/dumps/latest.tar.lz" \ --network host \ -it ghcr.io/ton-blockchain/ton ``` -------------------------------- ### Installing Generated Headers - CMake Source: https://github.com/ston-fi/ton/blob/master/tonlib/CMakeLists.txt Installs generated JSON headers and the tonlibjson export header into the tonlib include directory. ```CMake install(FILES ${TONLIB_JSON_HEADERS} ${CMAKE_CURRENT_BINARY_DIR}/tonlib/tonlibjson_export.h DESTINATION include/tonlib/) ``` -------------------------------- ### Install TON Build Dependencies on Ubuntu Source: https://github.com/ston-fi/ton/blob/master/README.md Installs essential build tools, libraries (zlib1g, libsecp256k1, libmicrohttpd, libsodium), and LLVM 16 required for compiling TON binaries on Ubuntu 20.04, 22.04, and 24.04 for x86-64 and aarch64 architectures. ```bash sudo apt-get update sudo apt-get install -y build-essential git cmake ninja-build zlib1g-dev libsecp256k1-dev libmicrohttpd-dev libsodium-dev wget https://apt.llvm.org/llvm.sh chmod +x llvm.sh sudo ./llvm.sh 16 all ``` -------------------------------- ### Installing tddb Libraries (CMake) Source: https://github.com/ston-fi/ton/blob/master/tddb/CMakeLists.txt Configures the installation rules for the `tddb` and `tddb_utils` libraries, specifying their destinations for library files, archives, runtime binaries, and include headers. ```CMake install(TARGETS tddb tddb_utils EXPORT TdTargets LIBRARY DESTINATION lib ARCHIVE DESTINATION lib RUNTIME DESTINATION bin INCLUDES DESTINATION include ) ``` -------------------------------- ### Compile TON Binaries on Ubuntu Source: https://github.com/ston-fi/ton/blob/master/README.md Copies the native Ubuntu build script into the current directory, makes it executable, and runs it to compile the TON binaries. This step assumes that the necessary dependencies have been installed. ```bash cp assembly/native/build-ubuntu-shared.sh . chmod +x build-ubuntu-shared.sh ./build-ubuntu-shared.sh ``` -------------------------------- ### Example lite-client Output (Not Synced) (Log) Source: https://github.com/ston-fi/ton/blob/master/docker/README.md Shows the expected output from `lite-client last` when the node's lite server is running but the node is not yet fully synchronized with the network. ```log conn ready failed query: [Error : 652 : adnl query timeout] cannot get server version and time (server too old?) server version is too old (at least 1.1 with capabilities 1 required), some queries are unavailable fatal error executing command-line queries, skipping the rest ``` -------------------------------- ### Installing tdutils Library (CMake) Source: https://github.com/ston-fi/ton/blob/master/tdutils/CMakeLists.txt Configures the installation rules for the tdutils library, specifying destination directories for the library and archive files and exporting the target. ```CMake install(TARGETS tdutils EXPORT TdTargets LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" ) ``` -------------------------------- ### Generating and Installing Package Config - CMake Source: https://github.com/ston-fi/ton/blob/master/tonlib/CMakeLists.txt Generates a basic package version file and installs it along with the main package configuration file, enabling other projects to find and use the installed Tonlib library via CMake's find_package mechanism. ```CMake include(CMakePackageConfigHelpers) write_basic_package_version_file("TonlibConfigVersion.cmake" VERSION ${TON_VERSION} COMPATIBILITY ExactVersion ) install(FILES "TonlibConfig.cmake" "${CMAKE_CURRENT_BINARY_DIR}/TonlibConfigVersion.cmake" DESTINATION lib/cmake/Tonlib ) ``` -------------------------------- ### Install TDActor Library (CMake) Source: https://github.com/ston-fi/ton/blob/master/tdactor/CMakeLists.txt This command specifies installation rules for the `tdactor` target, exporting it as `TdTargets` and defining destination paths for the library, archive, runtime, and include files. ```CMake install(TARGETS tdactor EXPORT TdTargets LIBRARY DESTINATION lib ARCHIVE DESTINATION lib RUNTIME DESTINATION bin INCLUDES DESTINATION include ) ``` -------------------------------- ### Run TON Docker Container for Troubleshooting (Shell) Source: https://github.com/ston-fi/ton/blob/master/docker/README.md Starts a TON node Docker container in interactive mode with a bash entrypoint, mounting the data volume and setting environment variables, but without immediately starting the validator engine, for troubleshooting purposes. ```Shell docker run -it -v /data/db:/var/ton-work/db \ -e "HOST_IP=" \ -e "PUBLIC_IP=" \ -e "LITESERVER=true" \ -p 43677:43677/udp \ -p 43678:43678/tcp \ -p 43679:43679/tcp \ --entrypoint /bin/bash \ ghcr.io/ton-blockchain/ton ``` -------------------------------- ### Configuring Shared Library Installation - CMake Source: https://github.com/ston-fi/ton/blob/master/tonlib/CMakeLists.txt Conditionally configures the installation of the shared tonlib library, setting the SOVERSION and exporting targets for use by other CMake projects, unless building for Emscripten or as a static library. ```CMake if (NOT USE_EMSCRIPTEN AND NOT TONLIBJSON_STATIC) install(EXPORT Tonlib FILE TonlibTargets.cmake NAMESPACE Tonlib:: DESTINATION lib/cmake/Tonlib ) # Add SOVERSION to shared libraries set_property(TARGET tonlibjson PROPERTY SOVERSION ${TON_VERSION}) endif() ``` -------------------------------- ### Installing ADNL Proxy Executable in CMake Source: https://github.com/ston-fi/ton/blob/master/adnl/CMakeLists.txt This snippet configures the installation rule for the `adnl-proxy` executable, specifying that it should be placed in the `bin` destination directory. This is conditional. ```CMake if (NOT TON_ONLY_TONLIB) install(TARGETS adnl-proxy RUNTIME DESTINATION bin) endif() ``` -------------------------------- ### Installing Android Tonlib Build Dependencies on Ubuntu Source: https://github.com/ston-fi/ton/blob/master/README.md This snippet updates package lists and installs essential build tools and libraries on Ubuntu, including automake, libtool, texinfo, autoconf, libgflags-dev, zlib1g-dev, libssl-dev, libreadline-dev, libmicrohttpd-dev, pkg-config, libgsl-dev, python3, python3-dev, libsodium-dev, and libsecp256k1-dev, necessary for building the TON tonlib library for Android. ```Bash sudo apt-get update sudo apt-get install -y build-essential git cmake ninja-build automake libtool texinfo autoconf libgflags-dev \ zlib1g-dev libssl-dev libreadline-dev libmicrohttpd-dev pkg-config libgsl-dev python3 python3-dev \ libtool autoconf libsodium-dev libsecp256k1-dev ``` -------------------------------- ### Conditional Installation of Other Targets Source: https://github.com/ston-fi/ton/blob/master/tonlib/CMakeLists.txt Installs various other TON-related targets (libraries and utilities) if the TON_USE_ABSEIL option is not enabled. Includes conditional handling for the 'wingetopt' target on Windows. ```CMake if (NOT TON_USE_ABSEIL) if (WIN32) set(WINGETOPT_TARGET wingetopt) endif() install(TARGETS tdnet keys crc32c tdactor adnllite tl_api tl-utils tl_lite_api tl-lite-utils ton_crypto ton_crypto_core ton_block smc-envelope ${WINGETOPT_TARGET} tdutils tl_tonlib_api tonlib lite-client-common tddb_utils emulator_static Tonlib EXPORT Tonlib LIBRARY DESTINATION lib ARCHIVE DESTINATION lib RUNTIME DESTINATION bin ) ``` -------------------------------- ### Configure TDUtils Build Options and Dependencies Source: https://github.com/ston-fi/ton/blob/master/tdutils/CMakeLists.txt This snippet defines a build option for MIME type conversion, checks for the availability of getopt based on the operating system, sets a default installation directory for libraries, finds necessary external packages like ZLIB, OpenSSL, CRC32C, and ABSL using PkgConfig and find_package, sets internal flags (TD_HAVE_*) based on whether dependencies are found, configures a C++ header file from a template, and adds a subdirectory to the build. ```CMake option(TDUTILS_MIME_TYPE "Generate mime types conversion (gperf is required)" ON) if (WIN32) if (WINGETOPT_FOUND) set(TD_HAVE_GETOPT 1) endif() else() set(TD_HAVE_GETOPT 1) endif() if (NOT DEFINED CMAKE_INSTALL_LIBDIR) set(CMAKE_INSTALL_LIBDIR "lib") endif() find_package(PkgConfig REQUIRED) if (NOT ZLIB_FOUND) pkg_check_modules(ZLIB zlib) endif() if (ZLIB_FOUND) set(TD_HAVE_ZLIB 1) message(STATUS "Found ZLIB: ${ZLIB_INCLUDE_DIR} ${ZLIB_LIBRARIES}") # OpenSSL internally depends on zlib if (NOT OPENSSL_FOUND) find_package(OpenSSL) endif() if (OPENSSL_FOUND) set(TD_HAVE_OPENSSL 1) endif() endif() if (CRC32C_FOUND) set(TD_HAVE_CRC32C 1) endif() if (ABSL_FOUND) set(TD_HAVE_ABSL 1) endif() configure_file(td/utils/config.h.in td/utils/config.h @ONLY) add_subdirectory(generate) ``` -------------------------------- ### Running TON Node Docker Container (Port Mapping) Source: https://github.com/ston-fi/ton/blob/master/docker/README.md This command starts a Docker container for a TON node using Docker's default bridge network and explicit port mapping. It mounts a volume, sets environment variables for public IP, dump URL, and various service ports (validator, console, lite server), and maps host ports to container ports for UDP and TCP traffic. This provides network isolation. ```bash docker run -d --name ton-node -v /data/db:/var/ton-work/db \ -e "PUBLIC_IP=" \ -e "DUMP_URL=https://dump.ton.org/dumps/latest.tar.lz" \ -e "VALIDATOR_PORT=443" \ -e "CONSOLE_PORT=88" \ -e "LITE_PORT=443" \ -e "LITESERVER=true" \ -p 443:443/udp \ -p 88:88/tcp \ -p 443:443/tcp \ -it ghcr.io/ton-blockchain/ton ``` -------------------------------- ### Configuring ton_crypto_core Static Library in CMake Source: https://github.com/ston-fi/ton/blob/master/crypto/CMakeLists.txt Defines the `ton_crypto_core` static library, sets its public include directories for both build and install interfaces, links necessary libraries like OpenSSL, tdutils, tddb_utils, and conditionally links system libraries like `dl` and `z` on non-Windows platforms. ```CMake add_library(ton_crypto_core STATIC ${TON_CRYPTO_CORE_SOURCE}) target_include_directories(ton_crypto_core PUBLIC $ $) target_link_libraries(ton_crypto_core PUBLIC ${OPENSSL_CRYPTO_LIBRARY} tdutils tddb_utils) if (NOT WIN32) target_link_libraries(ton_crypto_core PUBLIC dl z) endif() target_include_directories(ton_crypto_core SYSTEM PUBLIC $) ``` -------------------------------- ### Compiling TON to WebAssembly with Emscripten Source: https://github.com/ston-fi/ton/blob/master/README.md This snippet navigates to the WebAssembly build directory, makes the build script executable, and runs it to compile TON binaries for the WebAssembly target using Emscripten. ```Bash cd assembly/wasm chmod +x fift-func-wasm-build-ubuntu.sh ./fift-func-wasm-build-ubuntu.sh ``` -------------------------------- ### Link Libraries to create-hardfork Executable Source: https://github.com/ston-fi/ton/blob/master/create-hardfork/CMakeLists.txt Links a comprehensive list of required libraries to the `create-hardfork` executable target. This includes various internal TON libraries (like `overlay`, `tdutils`, `adnl`, etc.) and external dependencies (`git`, `jemalloc`). ```CMake target_link_libraries(create-hardfork overlay tdutils tdactor adnl tl_api dht rldp catchain validatorsession full-node validator-hardfork ton_validator validator-hardfork fift-lib memprof git ${JEMALLOC_LIBRARIES}) ``` -------------------------------- ### Building TON Native Binaries on Windows Source: https://github.com/ston-fi/ton/blob/master/README.md This snippet copies the Windows build script to the root directory and then executes it to compile TON native binaries for Windows (x86-64). Requires MS Visual Studio 2022 and CMake in PATH. ```Bash copy assembly\native\build-windows.bat . build-windows.bat ``` -------------------------------- ### Configuring Benchmark Executable with CMake Source: https://github.com/ston-fi/ton/blob/master/tdfec/benchmark/CMakeLists.txt These CMake commands set up the build process for a benchmark executable. It first defines the executable from its source file, then adds the current source directory to the public include paths for build interfaces, and finally links the executable with the required 'tdfec' library. ```CMake add_executable(benchmark-fec benchmark.cpp ) ``` ```CMake target_include_directories(benchmark-fec PUBLIC $) ``` ```CMake target_link_libraries(benchmark-fec PRIVATE tdfec) ``` -------------------------------- ### Configuring funcfiftlib Executable CMake Source: https://github.com/ston-fi/ton/blob/master/crypto/CMakeLists.txt Defines the `funcfiftlib` executable, sets include directories, links necessary libraries (`fift-lib`, `src_parser`, `git`), and configures various Emscripten-specific link options like exported methods/functions, module name, error handling, filesystem, optimization, main function handling, modularization, memory limits, and growth. ```CMake add_executable(funcfiftlib funcfiftlib/funcfiftlib.cpp ${FUNC_LIB_SOURCE}) target_include_directories(funcfiftlib PUBLIC $) target_link_libraries(funcfiftlib PUBLIC fift-lib src_parser git) target_link_options(funcfiftlib PRIVATE -sEXPORTED_RUNTIME_METHODS=FS,ccall,cwrap,UTF8ToString,stringToUTF8,lengthBytesUTF8,addFunction,removeFunction,setValue) target_link_options(funcfiftlib PRIVATE -sEXPORTED_FUNCTIONS=_func_compile,_version,_malloc,_free,_setThrew) target_link_options(funcfiftlib PRIVATE -sEXPORT_NAME=CompilerModule) target_link_options(funcfiftlib PRIVATE -sERROR_ON_UNDEFINED_SYMBOLS=0) target_link_options(funcfiftlib PRIVATE -sFILESYSTEM=1 -lnodefs.js) target_link_options(funcfiftlib PRIVATE -Oz) target_link_options(funcfiftlib PRIVATE -sIGNORE_MISSING_MAIN=1) target_link_options(funcfiftlib PRIVATE -sAUTO_NATIVE_LIBRARIES=0) target_link_options(funcfiftlib PRIVATE -sMODULARIZE=1) target_link_options(funcfiftlib PRIVATE -sTOTAL_MEMORY=33554432) target_link_options(funcfiftlib PRIVATE -sALLOW_MEMORY_GROWTH=1) target_link_options(funcfiftlib PRIVATE -sALLOW_TABLE_GROWTH=1) ``` -------------------------------- ### NetBSD Foundation Software License Source: https://github.com/ston-fi/ton/blob/master/third-party/wingetopt/README.md This section presents the license from The NetBSD Foundation, Inc. It details the conditions for redistribution and use in source and binary forms, includes a disclaimer of implied warranties, and limits liability for damages. ```License Copyright (c) 2000 The NetBSD Foundation, Inc. All rights reserved. This code is derived from software contributed to The NetBSD Foundation by Dieter Baron and Thomas Klausner. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ``` -------------------------------- ### Get Indexed Cell Depth (Alternative) (TVM Assembly) Source: https://github.com/ston-fi/ton/blob/master/doc/GlobalVersions.md Returns the ith depth of a cell, taking the cell and index i from the stack. This is an alternative to i CDEPTHI. ```TVM Assembly CDEPTHIX (cell i - depth) ``` -------------------------------- ### Build proxy-liteserver Executable - CMake Source: https://github.com/ston-fi/ton/blob/master/utils/CMakeLists.txt Defines the 'proxy-liteserver' executable, linking it to a comprehensive set of libraries for utilities, actors, networking (adnl, dht), TL schema, crypto, git, and lite client common functionalities. ```CMake add_executable(proxy-liteserver proxy-liteserver.cpp) target_link_libraries(proxy-liteserver tdutils tdactor adnl dht tl_api ton_crypto git lite-client-common) ``` -------------------------------- ### Get Indexed Cell Hash (Alternative) (TVM Assembly) Source: https://github.com/ston-fi/ton/blob/master/doc/GlobalVersions.md Returns the ith hash of a cell, taking the cell and index i from the stack. This is an alternative to i CHASHI. ```TVM Assembly CHASHIX (cell i - hash) ``` -------------------------------- ### Configuring funcfiftlib Build Options CMake Source: https://github.com/ston-fi/ton/blob/master/crypto/CMakeLists.txt Continues configuring the `funcfiftlib` target by embedding a file (`fiftlib`), including a pre-js script, and setting compile/link options related to exception handling. ```CMake target_link_options(funcfiftlib PRIVATE --embed-file ${CMAKE_CURRENT_SOURCE_DIR}/fift/lib@/fiftlib) target_link_options(funcfiftlib PRIVATE --pre-js ${CMAKE_CURRENT_SOURCE_DIR}/funcfiftlib/funcfiftlib-prejs.js) target_link_options(funcfiftlib PRIVATE -fexceptions) target_compile_options(funcfiftlib PRIVATE -fexceptions -fno-stack-protector) endif() ``` -------------------------------- ### Get Cell Level (TVM Assembly) Source: https://github.com/ston-fi/ton/blob/master/doc/GlobalVersions.md Returns the level of a given cell. This operation is part of the cell operations suite for working with Merkle proofs. ```TVM Assembly CLEVEL (cell - level) ``` -------------------------------- ### Link Dependencies for lite-client Executable (CMake) Source: https://github.com/ston-fi/ton/blob/master/lite-client/CMakeLists.txt Links the specified libraries, including the `lite-client-common` static library, to the `lite-client` executable. These dependencies are necessary for the executable to build and run correctly. ```CMake target_link_libraries(lite-client tdutils tdactor adnllite tl_api tl_lite_api tl-lite-utils terminal lite-client-common git) ``` -------------------------------- ### Build TON Docker Image from Sources - Docker - Shell Source: https://github.com/ston-fi/ton/blob/master/docker/README.md These commands clone the TON source repository recursively, navigate into the directory, and then build the Docker image using the Dockerfile present in the root of the repository. ```Shell git clone --recursive https://github.com/ton-blockchain/ton.git cd ton docker build . ``` -------------------------------- ### Get Cell Level Mask (TVM Assembly) Source: https://github.com/ston-fi/ton/blob/master/doc/GlobalVersions.md Returns the level mask of a given cell. This operation is used in the context of cell operations for Merkle proofs. ```TVM Assembly CLEVELMASK (cell - level_mask) ``` -------------------------------- ### Adding udp_ping_pong Executable (CMake) Source: https://github.com/ston-fi/ton/blob/master/tdnet/CMakeLists.txt Defines an executable target named `udp_ping_pong` using the source file `example/udp_ping_pong.cpp`. ```CMake add_executable(udp_ping_pong example/udp_ping_pong.cpp) ``` -------------------------------- ### Get Service Endpoints - Kubernetes Source: https://github.com/ston-fi/ton/blob/master/docker/README.md Command to list the endpoints for all services in the Kubernetes cluster. Used to verify that the service endpoints for the validator engine were correctly created and assigned IPs/ports. ```Shell kubectl get endpoints ``` -------------------------------- ### Get Indexed Cell Depth (TVM Assembly) Source: https://github.com/ston-fi/ton/blob/master/doc/GlobalVersions.md Returns the ith depth of a cell, where i is a small integer (0-3) provided before the cell on the stack. This is part of cell operations. ```TVM Assembly i CDEPTHI (cell - depth) ``` -------------------------------- ### Get Indexed Cell Hash (TVM Assembly) Source: https://github.com/ston-fi/ton/blob/master/doc/GlobalVersions.md Returns the ith hash of a cell, where i is a small integer (0-3) provided before the cell on the stack. This is part of cell operations. ```TVM Assembly i CHASHI (cell - hash) ``` -------------------------------- ### Linking Dependencies to Storage CLI Executable (CMake) Source: https://github.com/ston-fi/ton/blob/master/storage/CMakeLists.txt Links the 'storage-cli' executable target to the 'storage' library and numerous other dependencies required for its functionality, including network, DHT, and utility libraries, plus JEMALLOC. ```CMake target_link_libraries(storage-cli storage overlay tdutils tdactor adnl tl_api dht rldp rldp2 fift-lib memprof terminal git ${JEMALLOC_LIBRARIES}) ``` -------------------------------- ### Link Dependencies for lite-client-common (CMake) Source: https://github.com/ston-fi/ton/blob/master/lite-client/CMakeLists.txt Links the specified public libraries (`tdactor`, `adnllite`, `tl_api`, `tl_lite_api`, `tl-lite-utils`, `ton_crypto`) to the `lite-client-common` static library. These dependencies are required for the common library's functionality. ```CMake target_link_libraries(lite-client-common PUBLIC tdactor adnllite tl_api tl_lite_api tl-lite-utils ton_crypto) ``` -------------------------------- ### Setting Minimum CMake Version (CMake) Source: https://github.com/ston-fi/ton/blob/master/example/android/CMakeLists.txt Specifies the minimum required version of CMake (3.16) to build the project. CMake will exit with a fatal error if the installed version is older. ```CMake cmake_minimum_required(VERSION 3.16 FATAL_ERROR) ``` -------------------------------- ### Setting Source Files for tl-lite-utils CMake Source: https://github.com/ston-fi/ton/blob/master/tl-utils/CMakeLists.txt Defines the source files for the `tl-lite-utils` static library using the `set` command in CMake. These files include header and source files required for the library. ```CMake set(TL_LITE_UTILS_SOURCE common-utils.hpp lite-utils.hpp lite-utils.cpp ) ``` -------------------------------- ### Build opcode-timing Executable - CMake Source: https://github.com/ston-fi/ton/blob/master/utils/CMakeLists.txt Defines the 'opcode-timing' executable, linking it specifically to the 'ton_crypto' library for performance measurement, and sets the public include directories. ```CMake add_executable(opcode-timing opcode-timing.cpp ) target_link_libraries(opcode-timing ton_crypto) target_include_directories(pack-viewer PUBLIC $/..) ``` -------------------------------- ### Generate provider-code.h Header (CMake) Source: https://github.com/ston-fi/ton/blob/master/storage/storage-daemon/CMakeLists.txt Adds a custom build command to generate the `smartcont/provider-code.h` header file. It uses the `embed-provider-code` executable with `smartcont/storage-provider-code.boc` as input, specifying dependencies and the output file. ```CMake add_custom_command( WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMMAND embed-provider-code smartcont/storage-provider-code.boc smartcont/provider-code.h COMMENT "Generate provider-code.h" DEPENDS embed-provider-code smartcont/storage-provider-code.boc OUTPUT smartcont/provider-code.h ) ``` -------------------------------- ### Listen on TCP Port with Netcat (Shell) Source: https://github.com/ston-fi/ton/blob/master/docker/README.md Starts a netcat listener on a specified TCP port (e.g., 30003) inside a container or machine to check if incoming TCP connections can be received. ```Shell nc -l 30003 ``` -------------------------------- ### Listen on UDP Port with Netcat (Shell) Source: https://github.com/ston-fi/ton/blob/master/docker/README.md Starts a netcat listener on a specified UDP port (e.g., 30001) inside a container or machine to check if incoming UDP traffic can be received. ```Shell nc -ul 30001 ``` -------------------------------- ### Define create-state Executable Source: https://github.com/ston-fi/ton/blob/master/crypto/CMakeLists.txt Defines an executable named create-state from the block/create-state.cpp source file. Configures its include directories and links it against ton_crypto, fift-lib, git, and optionally tonlib based on build flags. Links against wingetopt if found. ```CMake add_executable(create-state block/create-state.cpp) target_include_directories(create-state PUBLIC $ $) if (INTERNAL_COMPILE) target_link_libraries(create-state PUBLIC ton_crypto fift-lib tonlib git) else() if (TONLIB_COMPILE) target_link_libraries(create-state PUBLIC ton_crypto fift-lib tonlib git) else() target_link_libraries(create-state PUBLIC ton_crypto fift-lib git) endif() endif() if (WINGETOPT_FOUND) target_link_libraries_system(create-state wingetopt) endif() ``` -------------------------------- ### Get Node IP (Calico) - Kubernetes Source: https://github.com/ston-fi/ton/blob/master/docker/README.md Command to find the IPv4 address of a Kubernetes node when using the Calico network driver. Requires replacing with the actual node name. ```Shell kubectl describe node | grep IPv4Address ``` -------------------------------- ### Defining prepare_cross_compiling Custom Target (CMake) Source: https://github.com/ston-fi/ton/blob/master/CMakeLists.txt Defines a custom target named 'prepare_cross_compiling' that depends on various code generation targets (tl_generate_common, tlb_generate_block, gen_fif, tdmime_auto) used in the cross-compilation setup. ```CMake if (NOT CMAKE_CROSSCOMPILING) if (TDUTILS_MIME_TYPE) set(TDMIME_AUTO tdmime_auto) endif() add_custom_target(prepare_cross_compiling DEPENDS tl_generate_common tlb_generate_block gen_fif ${TDMIME_AUTO}) endif() ``` -------------------------------- ### Adding tcp_ping_pong Executable (CMake) Source: https://github.com/ston-fi/ton/blob/master/tdnet/CMakeLists.txt Defines an executable target named `tcp_ping_pong` using the source file `example/tcp_ping_pong.cpp`. ```CMake add_executable(tcp_ping_pong example/tcp_ping_pong.cpp) ``` -------------------------------- ### Get Node IP (Flannel) - Kubernetes Source: https://github.com/ston-fi/ton/blob/master/docker/README.md Commands to find the public IP address of a Kubernetes node when using the Flannel network driver. Requires replacing with the actual node name. ```Shell kubectl get nodes kubectl describe node | grep public-ip ``` -------------------------------- ### Conditionally Configure Dependencies (CMake) Source: https://github.com/ston-fi/ton/blob/master/blockchain-explorer/CMakeLists.txt Configures include directories and links libraries based on the `NIX` option and whether `libmicrohttpd` (`MHD`) is found. It handles cases for both `NIX` enabled/disabled and `MHD` found/not found, including using `PkgConfig` when needed. ```CMake if (NIX) if (MHD_FOUND) target_include_directories(blockchain-explorer PUBLIC ${MHD_INCLUDE_DIR}) target_link_libraries(blockchain-explorer tdactor adnllite tl_lite_api tl-lite-utils ton_crypto ${MHD_LIBRARY}) else() find_package(PkgConfig REQUIRED) pkg_check_modules(MHD libmicrohttpd) target_include_directories(blockchain-explorer PUBLIC ${MHD_INCLUDE_DIR} ${MHD_STATIC_INCLUDE_DIRS}) target_link_libraries(blockchain-explorer tdactor adnllite tl_lite_api tl-lite-utils ton_crypto ${MHD_LIBRARIES} ${MHD_STATIC_LIBRARIES}) endif() elif (MHD_FOUND) target_include_directories(blockchain-explorer PUBLIC ${MHD_INCLUDE_DIR}) target_link_libraries(blockchain-explorer tdactor adnllite tl_lite_api tl-lite-utils ton_crypto ${MHD_LIBRARY}) else() find_package(MHD) target_include_directories(blockchain-explorer PUBLIC ${MHD_INCLUDE_DIR}) target_link_libraries(blockchain-explorer tdactor adnllite tl_lite_api tl-lite-utils ton_crypto ${MHD_LIBRARY}) endif() ``` -------------------------------- ### Configuring and Adding CRC32C Dependency in CMake Source: https://github.com/ston-fi/ton/blob/master/CMakeLists.txt Configures build options for the CRC32C library, disables tests, benchmarks, glog usage, and installation. Adds the CRC32C library as a subdirectory, including a fix for AArch64 builds with non-MSVC compilers. ```CMake set(CRC32C_BUILD_TESTS OFF CACHE BOOL "Build CRC32C's unit tests") set(CRC32C_BUILD_BENCHMARKS OFF CACHE BOOL "Build CRC32C's benchmarks") set(CRC32C_USE_GLOG OFF CACHE BOOL "Build CRC32C's tests with Google Logging") set(CRC32C_INSTALL OFF CACHE BOOL "Install CRC32C's header and library") message("Add crc32c") function(crc32_scope) set(CMAKE_POLICY_VERSION_MINIMUM "3.10") if (NOT MSVC) # fix aarch64 build @ crc32c/src/crc32c_arm64_linux_check.h set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error=address") endif() add_subdirectory(third-party/crc32c EXCLUDE_FROM_ALL) endfunction() crc32_scope() set(CRC32C_FOUND 1) ``` -------------------------------- ### Create Static Keyring Library (CMake) Source: https://github.com/ston-fi/ton/blob/master/keyring/CMakeLists.txt Creates a static library target named 'keyring' using the source files defined in the KEYRING_SOURCE variable. ```CMake add_library(keyring STATIC ${KEYRING_SOURCE}) ``` -------------------------------- ### Getting Public IP Address using curl Source: https://github.com/ston-fi/ton/blob/master/docker/README.md This command uses `curl` to query the `ifconfig.me` service to retrieve the host's public IPv4 address. This is needed to configure the TON node with the correct external IP. ```bash curl -4 ifconfig.me ``` -------------------------------- ### Configuring mintless-proof-generator Executable CMake Source: https://github.com/ston-fi/ton/blob/master/crypto/CMakeLists.txt Defines the `mintless-proof-generator` executable and links it privately against `ton_crypto`, `git`, and the libraries specified by `${JEMALLOC_LIBRARIES}`. ```CMake add_executable(mintless-proof-generator util/mintless-proof-generator.cpp) target_link_libraries(mintless-proof-generator PRIVATE ton_crypto git ${JEMALLOC_LIBRARIES}) ``` -------------------------------- ### Structure of the c7 Tuple in TON TVM Source: https://github.com/ston-fi/ton/blob/master/doc/GlobalVersions.md Describes the structure and contents of the c7 tuple, which holds inbound message parameters for smart contract execution. It details the 18 elements, their types, and specific values for external messages, tick-tock transactions, and get methods. ```Description c7 tuple (18 elements): 17: tuple with inbound message parameters (Asm opcode: INMSGPARAMS) - bounce (boolean) - bounced (boolean) - src_addr (slice) - fwd_fee (int) - created_lt (int) - created_at (int) - orig_value (int) - value (int) - value_extra (cell or null) - state_init (cell or null) Notes: - For external messages, tick-tock transactions, get methods: bounce, bounced, fwd_fee, created_lt, created_at, orig_value, value are 0, value_extra is null. - For tick-tock transactions, get methods: src_addr is addr_none. ``` -------------------------------- ### Linking Dependencies to Storage Library (CMake) Source: https://github.com/ston-fi/ton/blob/master/storage/CMakeLists.txt Links the 'storage' library target to several required libraries including utility, actor, database, crypto, and API libraries, along with JEMALLOC for memory management. ```CMake target_link_libraries(storage tdutils tdactor tddb ton_crypto tl_api ${JEMALLOC_LIBRARIES}) ``` -------------------------------- ### Configuring fift Executable in CMake Source: https://github.com/ston-fi/ton/blob/master/crypto/CMakeLists.txt Defines the `fift` executable, links the `fift-lib` and `git` libraries, and conditionally links the `wingetopt` library if found. ```CMake add_executable(fift fift/fift-main.cpp) target_link_libraries(fift PUBLIC fift-lib git) if (WINGETOPT_FOUND) target_link_libraries_system(fift wingetopt) endif() ``` -------------------------------- ### Define lite-client Executable (CMake) Source: https://github.com/ston-fi/ton/blob/master/lite-client/CMakeLists.txt Defines an executable target named `lite-client` using the specified source and header files. This is the main program target that will be built. ```CMake add_executable(lite-client lite-client.cpp lite-client.h ext-client.h ext-client.cpp) ``` -------------------------------- ### Set Overlay Include Directories (CMake) Source: https://github.com/ston-fi/ton/blob/master/overlay/CMakeLists.txt Specifies the public include directories for the `overlay` library, including the current source directory, its parent directory, and the include directory found for OpenSSL. ```CMake target_include_directories(overlay PUBLIC $ $/.. ${OPENSSL_INCLUDE_DIR} ) ``` -------------------------------- ### Configuring Sodium Integration for ton_crypto_core in CMake Source: https://github.com/ston-fi/ton/blob/master/crypto/CMakeLists.txt Sets public include directories for the `ton_crypto_core` target, integrating the Sodium library's include paths. ```CMake target_include_directories(ton_crypto_core PUBLIC $) ``` -------------------------------- ### Build pack-viewer Executable - CMake Source: https://github.com/ston-fi/ton/blob/master/utils/CMakeLists.txt Defines the 'pack-viewer' executable, linking it to libraries for TL schema, cryptography, keys, validator, and database access, and sets the public include directories. ```CMake add_executable(pack-viewer pack-viewer.cpp ) target_link_libraries(pack-viewer tl_api ton_crypto keys validator tddb) target_include_directories(pack-viewer PUBLIC $/..) ``` -------------------------------- ### Compile Tonlib for Android Manually (Bash) Source: https://github.com/ston-fi/ton/blob/master/example/android/README.md Provides a sequence of bash commands to clone the TON repository, copy the Android build script, make it executable, and run it to compile Tonlib libraries for Android. ```bash git clone --recursive https://github.com/ton-blockchain/ton.git cd ton cp assembly/android/build-android-tonlib.sh . chmod +x build-android-tonlib.sh sudo -E ./build-android-tonlib.sh ``` -------------------------------- ### Configuring tlbc Executable CMake Source: https://github.com/ston-fi/ton/blob/master/crypto/CMakeLists.txt Defines the `tlbc` executable, sets include directories, links the `src_parser` library, and conditionally links the `wingetopt` system library if `WINGETOPT_FOUND` is true. ```CMake add_executable(tlbc tl/tlbc.cpp) target_include_directories(tlbc PUBLIC $) target_link_libraries(tlbc PUBLIC src_parser) if (WINGETOPT_FOUND) target_link_libraries_system(tlbc wingetopt) endif() ``` -------------------------------- ### Define Build Option NIX (CMake) Source: https://github.com/ston-fi/ton/blob/master/blockchain-explorer/CMakeLists.txt Defines a boolean option named `NIX` which controls whether a static build is used. It includes a help string and defaults to `OFF`. ```CMake option(NIX "Use \"ON\" for a static build." OFF) ``` -------------------------------- ### Setting Source Files for tl-utils CMake Source: https://github.com/ston-fi/ton/blob/master/tl-utils/CMakeLists.txt Defines the source files for the `tl-utils` static library using the `set` command in CMake. These files include header and source files required for the library. ```CMake set(TL_UTILS_SOURCE common-utils.hpp tl-utils.hpp tl-utils.cpp ) ``` -------------------------------- ### Add Executable Target (CMake) Source: https://github.com/ston-fi/ton/blob/master/blockchain-explorer/CMakeLists.txt Creates the `blockchain-explorer` executable target using the source files listed in the `BLOCHAIN_EXPLORER_SOURCE` variable. ```CMake add_executable(blockchain-explorer ${BLOCHAIN_EXPLORER_SOURCE}) ``` -------------------------------- ### Configuring secp256k1 Integration for ton_crypto_core in CMake Source: https://github.com/ston-fi/ton/blob/master/crypto/CMakeLists.txt Sets public include directories for the `ton_crypto_core` target, integrating the secp256k1 library's include paths. ```CMake target_include_directories(ton_crypto_core PUBLIC $) ```