{"id":13823085,"url":"https://github.com/scala-network/Scala","last_synced_at":"2025-07-08T16:31:10.609Z","repository":{"id":38708663,"uuid":"474057686","full_name":"scala-network/Scala","owner":"scala-network","description":" Distributed wealth for all devices. ","archived":false,"fork":false,"pushed_at":"2025-05-05T16:33:16.000Z","size":57541,"stargazers_count":12,"open_issues_count":1,"forks_count":4,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-05-05T17:39:10.017Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/scala-network.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"docs/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-03-25T15:10:05.000Z","updated_at":"2024-11-06T11:31:48.000Z","dependencies_parsed_at":"2023-11-20T01:29:37.519Z","dependency_job_id":"0b3fef41-bcb5-4a9a-8fe6-f740e5b0d478","html_url":"https://github.com/scala-network/Scala","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"purl":"pkg:github/scala-network/Scala","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scala-network%2FScala","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scala-network%2FScala/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scala-network%2FScala/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scala-network%2FScala/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/scala-network","download_url":"https://codeload.github.com/scala-network/Scala/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scala-network%2FScala/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264304538,"owners_count":23587980,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-04T09:00:20.792Z","updated_at":"2025-07-08T16:31:08.612Z","avatar_url":"https://github.com/scala-network.png","language":"C++","readme":"# Scala\n\nCopyright (c) 2021-2023, Haku Labs MTÜ\n\nCopyright (c) 2014-2023, The Monero Project\n\nPortions Copyright (c) 2012-2013 The Cryptonote developers.\n\n[\u003cimg src=\"https://scalaproject.io/img/card.jpg\"\u003e](https://scalaproject.io)\n\nScala is a privacy-focused cryptocurrency project linking distributed technologies to build a globally scalable and mobile-friendly ecosystem. We provide an opaque blockchain, untraceable payments, unlinkable transactions, and blockchain-analysis resistance.\n\nOur vision is to distribute wealth for everyone and every device. We want to be the people’s coin. To achieve this goal, we focus on implementing solutions that are mobile-friendly and energy-efficient. There are about 4 billion mobile devices in the world, and we want to make sure that our ecosystem takes that into account. We also take a lot of time to improve the user experience so that our applications can be used easily by anyone.\n\nObviously, our goal is also to bring useful utilities and to solve real-world problems, in a way that is economically viable for the project and to sustain our growth. We take advantage of next-gen technologies such as IPFS and custom software to provide the utility of data storage and we use the proven CryptoNote protocol for providing the financial aspects.\n\n## Table of Contents\n\n- [Scala](#scala)\n  - [Table of Contents](#table-of-contents)\n  - [Development resources](#development-resources)\n  - [Vulnerability response](#vulnerability-response)\n  - [Announcements](#announcements)\n  - [Translations](#translations)\n  - [Introduction](#introduction)\n  - [About this project](#about-this-project)\n  - [Supporting the project](#supporting-the-project)\n  - [License](#license)\n  - [Contributing](#contributing)\n  - [Scheduled software/network upgrades](#scheduled-softwarenetwork-upgrades)\n  - [Release staging schedule and protocol](#release-staging-schedule-and-protocol)\n  - [Compiling scala from source](#compiling-scala-from-source)\n    - [Dependencies](#dependencies)\n    - [Cloning the repository](#cloning-the-repository)\n    - [Build instructions](#build-instructions)\n      - [On Linux and macOS](#on-linux-and-macos)\n      - [On the Raspberry Pi](#on-the-raspberry-pi)\n      - [*Note for Raspbian Jessie users:*](#note-for-raspbian-jessie-users)\n      - [On Windows:](#on-windows)\n    - [On FreeBSD:](#on-freebsd)\n    - [On OpenBSD:](#on-openbsd)\n    - [On NetBSD:](#on-netbsd)\n    - [On Solaris:](#on-solaris)\n    - [Building portable statically linked binaries](#building-portable-statically-linked-binaries)\n    - [Cross Compiling](#cross-compiling)\n    - [Gitian builds](#gitian-builds)\n  - [Installing scala from a package](#installing-scala-from-a-package)\n  - [Running scalad](#running-scalad)\n  - [Internationalization](#internationalization)\n  - [Using Tor](#using-tor)\n    - [Using Tor on Tails](#using-tor-on-tails)\n  - [Pruning](#pruning)\n  - [Debugging](#debugging)\n    - [Obtaining stack traces and core dumps on Unix systems](#obtaining-stack-traces-and-core-dumps-on-unix-systems)\n      - [To run scala within gdb:](#to-run-scala-within-gdb)\n    - [Analysing memory corruption](#analysing-memory-corruption)\n      - [ASAN](#asan)\n      - [valgrind](#valgrind)\n    - [LMDB](#lmdb)\n- [Known Issues](#known-issues)\n  - [Protocols](#protocols)\n    - [Socket-based](#socket-based)\n    - [Blockchain-based](#blockchain-based)\n\n## Development resources\n\n- Web: [scalaproject.io](https://scalaproject.io)\n- Mail: [hello@scalaproject.io](mailto:hello@scalaproject.io)\n- GitHub: [https://github.com/scala-network/](https://github.com/scala-network/)\n\n## Vulnerability response\n\nPlease contact us privately at [hello@scalaproject.io](mailto:hello@scalaproject.io) to report security issues. \n\n## Announcements\n\nAll critical announcements regarding the Scala project will be made on the following outlets:\n\n- [Scala Discord](https://chat.scalaproject.io)\n- [Scala Telegram](https://t.me/scalaofficial)\n\n## Introduction\n\nScala is a private, secure, untraceable, decentralised digital currency. You are your bank, you control your funds, and nobody can trace your transfers unless you allow them to do so.\n\n**Privacy:** scala uses a cryptographically sound system to allow you to send and receive funds without your transactions being easily revealed on the blockchain (the ledger of transactions that everyone has). This ensures that your purchases, receipts, and all transfers remain private by default.\n\n**Security:** Using the power of a distributed peer-to-peer consensus network, every transaction on the network is cryptographically secured. Individual wallets have a 25-word mnemonic seed that is only displayed once and can be written down to backup the wallet. Wallet files should be encrypted with a strong passphrase to ensure they are useless if ever stolen.\n\n**Untraceability:** By taking advantage of ring signatures, a special property of a certain type of cryptography, scala is able to ensure that transactions are not only untraceable but have an optional measure of ambiguity that ensures that transactions cannot easily be tied back to an individual user or computer.\n\n**Decentralization:** The utility of scala depends on its decentralised peer-to-peer consensus network - anyone should be able to run the scala software, validate the integrity of the blockchain, and participate in all aspects of the scala network using consumer-grade commodity hardware. Decentralization of the scala network is maintained by software development that minimizes the costs of running the scala software and inhibits the proliferation of specialized, non-commodity hardware.\n\n## About this project\n\nThis is the core implementation of scala. It is open source and completely free to use without restrictions, except for those specified in the license agreement below. There are no restrictions on anyone creating an alternative implementation of scala that uses the protocol and network in a compatible manner.\n\nAs with many development projects, the repository on GitHub is considered to be the \"staging\" area for the latest changes. Before changes are merged into that branch on the main repository, they are tested by individual developers in their own branches, submitted as a pull request, and then subsequently tested by contributors who focus on testing and code reviews. That having been said, the repository should be carefully considered before using it in a production environment, unless there is a patch in the repository for a particular show-stopping issue you are experiencing. It is generally a better idea to use a tagged release for stability.\n\n**Anyone is welcome to contribute to scala's codebase!** If you have a fix or code change, feel free to submit it as a pull request directly to the \"master\" branch. In cases where the change is relatively small or does not affect other parts of the codebase, it may be merged in immediately by any one of the collaborators. On the other hand, if the change is particularly large or complex, it is expected that it will be discussed at length either well in advance of the pull request being submitted, or even directly on the pull request.\n\n## Supporting the project\n\nFor information on how scala funds its development, please read [this](https://wiki.scalaproject.io/general/funding) on our wiki.\n\nCore development funding and/or some supporting services are also graciously provided by sponsors:\n\n[\u003cimg width=\"150\" src=\"https://resources.jetbrains.com/storage/products/company/brand/logos/jb_beam.png\"/\u003e](https://www.jetbrains.com/)\n\n## License\n\nSee [LICENSE](LICENSE).\n\n## Contributing\n\nIf you want to help out, see [CONTRIBUTING](docs/CONTRIBUTING.md) for a set of guidelines.\n\n## Scheduled software/network upgrades\n\nscala uses a scheduled software/network upgrade (hard fork) mechanism to implement new features into the scala software and network. This means that users of scala (end users and service providers) should run current versions and upgrade their software when new releases are available. Software upgrades occur when new features are developed and implemented in the codebase. Network upgrades occur in tandem with software upgrades that modify the consensus rules of the scala network. The required software for network upgrades will be available prior to the scheduled network upgrade date. Please check the repository prior to this date for the proper scala software version. Below is the historical schedule and the projected schedule for the next upgrade.\n\nDates are provided in the format DD-MM-YYYY. The \"Minimum\" is the software version that follows the new consensus rules. The \"Recommended\" version may include bug fixes and other new features that do not affect the consensus rules.\n\n\n| Software upgrade block height | Date      | Fork version | Minimum scala version | Recommended scala version | Details                                                               |\n|-------------------------------|-----------|--------------|-----------------------|---------------------------|-----------------------------------------------------------------------|\n| 1                             | 1-08-2020 | v4.1.0       | v4.1.0                | v7.9.0                    | Genesis block                                                         |\n| X                             | X         | v8.0.0       | v8.0.0                | v8.0.0                    | Diardi V2, multiple proof of work, new bulletproofs, new reward curve |\n\nX's indicate that these details have not been determined as of commit date.\n\n\\* indicates estimate as of commit date\n\n## Release staging schedule and protocol\n\nApproximately three months prior to a scheduled software upgrade, a branch from master will be created with the new release version tag. Pull requests that address bugs should then be made to both master and the new release branch. Pull requests that require extensive review and testing (generally, optimizations and new features) should *not* be made to the release branch.\n\n## Compiling scala from source\n\n### Dependencies\n\nThe following table summarizes the tools and libraries required to build. A\nfew of the libraries are also included in this repository (marked as\n\"Vendored\"). By default, the build uses the library installed on the system\nand ignores the vendored sources. However, if no library is found installed on\nthe system, then the vendored source will be built and used. The vendored\nsources are also used for statically-linked builds because distribution\npackages often include only shared library binaries (`.so`) but not static\nlibrary archives (`.a`).\n\n| Dep          | Min. version  | Vendored | Debian/Ubuntu pkg    | Arch pkg     | Void pkg           | Fedora pkg          | Optional | Purpose         |\n| ------------ | ------------- | -------- | -------------------- | ------------ | ------------------ | ------------------- | -------- | --------------- |\n| GCC          | 5             | NO       | `build-essential`    | `base-devel` | `base-devel`       | `gcc`               | NO       |                 |\n| CMake        | 3.5           | NO       | `cmake`              | `cmake`      | `cmake`            | `cmake`             | NO       |                 |\n| pkg-config   | any           | NO       | `pkg-config`         | `base-devel` | `base-devel`       | `pkgconf`           | NO       |                 |\n| Boost        | 1.58          | NO       | `libboost-all-dev`   | `boost`      | `boost-devel`      | `boost-devel`       | NO       | C++ libraries   |\n| OpenSSL      | basically any | NO       | `libssl-dev`         | `openssl`    | `openssl-devel`    | `openssl-devel`     | NO       | sha256 sum      |\n| libzmq       | 4.2.0         | NO       | `libzmq3-dev`        | `zeromq`     | `zeromq-devel`     | `zeromq-devel`      | NO       | ZeroMQ library  |\n| OpenPGM      | ?             | NO       | `libpgm-dev`         | `libpgm`     |                    | `openpgm-devel`     | NO       | For ZeroMQ      |\n| libnorm[2]   | ?             | NO       | `libnorm-dev`        |              |                    |                     | YES      | For ZeroMQ      |\n| libunbound   | 1.4.16        | NO       | `libunbound-dev`     | `unbound`    | `unbound-devel`    | `unbound-devel`     | NO       | DNS resolver    |\n| libsodium    | ?             | NO       | `libsodium-dev`      | `libsodium`  | `libsodium-devel`  | `libsodium-devel`   | NO       | cryptography    |\n| libunwind    | any           | NO       | `libunwind8-dev`     | `libunwind`  | `libunwind-devel`  | `libunwind-devel`   | YES      | Stack traces    |\n| liblzma      | any           | NO       | `liblzma-dev`        | `xz`         | `liblzma-devel`    | `xz-devel`          | YES      | For libunwind   |\n| libreadline  | 6.3.0         | NO       | `libreadline6-dev`   | `readline`   | `readline-devel`   | `readline-devel`    | YES      | Input editing   |\n| expat        | 1.1           | NO       | `libexpat1-dev`      | `expat`      | `expat-devel`      | `expat-devel`       | YES      | XML parsing     |\n| GTest        | 1.5           | YES      | `libgtest-dev`[1]    | `gtest`      | `gtest-devel`      | `gtest-devel`       | YES      | Test suite      |\n| ccache       | any           | NO       | `ccache`             | `ccache`     | `ccache`           | `ccache`            | YES      | Compil. cache   |\n| Doxygen      | any           | NO       | `doxygen`            | `doxygen`    | `doxygen`          | `doxygen`           | YES      | Documentation   |\n| Graphviz     | any           | NO       | `graphviz`           | `graphviz`   | `graphviz`         | `graphviz`          | YES      | Documentation   |\n| lrelease     | ?             | NO       | `qttools5-dev-tools` | `qt5-tools`  | `qt5-tools`        | `qt5-linguist`      | YES      | Translations    |\n| libhidapi    | ?             | NO       | `libhidapi-dev`      | `hidapi`     | `hidapi-devel`     | `hidapi-devel`      | YES      | Hardware wallet |\n| libusb       | ?             | NO       | `libusb-1.0-0-dev`   | `libusb`     | `libusb-devel`     | `libusbx-devel`     | YES      | Hardware wallet |\n| libprotobuf  | ?             | NO       | `libprotobuf-dev`    | `protobuf`   | `protobuf-devel`   | `protobuf-devel`    | YES      | Hardware wallet |\n| protoc       | ?             | NO       | `protobuf-compiler`  | `protobuf`   | `protobuf`         | `protobuf-compiler` | YES      | Hardware wallet |\n| libudev      | ?             | NO       | `libudev-dev`        | `systemd`    | `eudev-libudev-devel` | `systemd-devel`  | YES      | Hardware wallet |\n\n[1] On Debian/Ubuntu `libgtest-dev` only includes sources and headers. You must\nbuild the library binary manually. This can be done with the following command `sudo apt-get install libgtest-dev \u0026\u0026 cd /usr/src/gtest \u0026\u0026 sudo cmake . \u0026\u0026 sudo make`\nthen:\n\n* on Debian:\n  `sudo mv libg* /usr/lib/`\n* on Ubuntu:\n  `sudo mv lib/libg* /usr/lib/`\n\n[2] libnorm-dev is needed if your zmq library was built with libnorm, and not needed otherwise\n\nInstall all dependencies at once on Debian/Ubuntu:\n\n```\nsudo apt update \u0026\u0026 sudo apt install build-essential cmake pkg-config libssl-dev libzmq3-dev libunbound-dev libsodium-dev libunwind8-dev liblzma-dev libreadline6-dev libexpat1-dev libpgm-dev qttools5-dev-tools libhidapi-dev libusb-1.0-0-dev libprotobuf-dev protobuf-compiler libudev-dev libboost-chrono-dev libboost-date-time-dev libboost-filesystem-dev libboost-locale-dev libboost-program-options-dev libboost-regex-dev libboost-serialization-dev libboost-system-dev libboost-thread-dev python3 ccache doxygen graphviz\n```\n\nInstall all dependencies at once on Arch:\n```\nsudo pacman -Syu --needed base-devel cmake boost openssl zeromq libpgm unbound libsodium libunwind xz readline expat gtest python3 ccache doxygen graphviz qt5-tools hidapi libusb protobuf systemd\n```\n\nInstall all dependencies at once on Fedora:\n```\nsudo dnf install gcc gcc-c++ cmake pkgconf boost-devel openssl-devel zeromq-devel openpgm-devel unbound-devel libsodium-devel libunwind-devel xz-devel readline-devel expat-devel gtest-devel ccache doxygen graphviz qt5-linguist hidapi-devel libusbx-devel protobuf-devel protobuf-compiler systemd-devel\n```\n\nInstall all dependencies at once on openSUSE:\n\n```\nsudo zypper ref \u0026\u0026 sudo zypper in cppzmq-devel libboost_chrono-devel libboost_date_time-devel libboost_filesystem-devel libboost_locale-devel libboost_program_options-devel libboost_regex-devel libboost_serialization-devel libboost_system-devel libboost_thread-devel libexpat-devel libminiupnpc-devel libsodium-devel libunwind-devel unbound-devel cmake doxygen ccache fdupes gcc-c++ libevent-devel libopenssl-devel pkgconf-pkg-config readline-devel xz-devel libqt5-qttools-devel patterns-devel-C-C++-devel_C_C++\n```\n\nInstall all dependencies at once on macOS with the provided Brewfile:\n\n```\nbrew update \u0026\u0026 brew bundle --file=contrib/brew/Brewfile\n```\n\nFreeBSD 12.1 one-liner required to build dependencies:\n\n```\npkg install git gmake cmake pkgconf boost-libs libzmq4 libsodium unbound\n```\n\n### Cloning the repository\n\nClone recursively to pull-in needed submodule(s):\n\n```\ngit clone --recursive https://github.com/scala-network/scala\n```\n\nIf you already have a repo cloned, initialize and update:\n\n```\ncd scala \u0026\u0026 git submodule init \u0026\u0026 git submodule update\n```\n\n*Note*: If there are submodule differences between branches, you may need \nto use `git submodule sync \u0026\u0026 git submodule update` after changing branches\nto build successfully.\n\n### Build instructions\n\nscala uses the CMake build system and a top-level [Makefile](Makefile) that\ninvokes cmake commands as needed.\n\n#### On Linux and macOS\n\n* Install the dependencies\n* Change to the root of the source code directory, change to the most recent release branch, and build:\n\n    ```bash\n    cd scala\n    make\n    ```\n\n    *Optional*: If your machine has several cores and enough memory, enable\n    parallel build by running `make -j\u003cnumber of threads\u003e` instead of `make`. For\n    this to be worthwhile, the machine should have one core and about 2GB of RAM\n    available per thread.\n\n    *Note*: The instructions above will compile the most stable release of the\n    scala software. If you would like to use and test the most recent software,\n    use `git checkout master`. The master branch may contain updates that are\n    both unstable and incompatible with release software, though testing is always\n    encouraged.\n\n* The resulting executables can be found in `build/release/bin`\n\n* Add `PATH=\"$PATH:$HOME/scala/build/release/bin\"` to `.profile`\n\n* Run scala with `scalad --detach`\n\n* **Optional**: build and run the test suite to verify the binaries:\n\n    ```bash\n    make release-test\n    ```\n\n    *NOTE*: `core_tests` test may take a few hours to complete.\n\n* **Optional**: to build binaries suitable for debugging:\n\n    ```bash\n    make debug\n    ```\n\n* **Optional**: to build statically-linked binaries:\n\n    ```bash\n    make release-static\n    ```\n\nDependencies need to be built with -fPIC. Static libraries usually aren't, so you may have to build them yourself with -fPIC. Refer to their documentation for how to build them.\n\n* **Optional**: build documentation in `doc/html` (omit `HAVE_DOT=YES` if `graphviz` is not installed):\n\n    ```bash\n    HAVE_DOT=YES doxygen Doxyfile\n    ```\n\n* **Optional**: use ccache not to rebuild translation units, that haven't really changed. scala's CMakeLists.txt file automatically handles it\n\n    ```bash\n    sudo apt install ccache\n    ```\n\n#### On the Raspberry Pi\n\nTested on a Raspberry Pi Zero with a clean install of minimal Raspbian Stretch (2017-09-07 or later) from https://www.raspberrypi.org/downloads/raspbian/. If you are using Raspian Jessie, [please see note in the following section](#note-for-raspbian-jessie-users).\n\n* `apt-get update \u0026\u0026 apt-get upgrade` to install all of the latest software\n\n* Install the dependencies for scala from the 'Debian' column in the table above.\n\n* Increase the system swap size:\n\n    ```bash\n    sudo /etc/init.d/dphys-swapfile stop  \n    sudo nano /etc/dphys-swapfile  \n    CONF_SWAPSIZE=2048\n    sudo /etc/init.d/dphys-swapfile start\n    ```\n\n* If using an external hard disk without an external power supply, ensure it gets enough power to avoid hardware issues when syncing, by adding the line \"max_usb_current=1\" to /boot/config.txt\n\n* Clone scala and checkout the most recent release version:\n\n    ```bash\n    git clone https://github.com/scala-network/scala.git\n    cd scala\n    git checkout v0.18.1.2\n    ```\n\n* Build:\n\n    ```bash\n    USE_SINGLE_BUILDDIR=1 make release\n    ```\n\n* Wait 4-6 hours\n\n* The resulting executables can be found in `build/release/bin`\n\n* Add `export PATH=\"$PATH:$HOME/scala/build/release/bin\"` to `$HOME/.profile`\n\n* Run `source $HOME/.profile`\n\n* Run scala with `scalad --detach`\n\n* You may wish to reduce the size of the swap file after the build has finished, and delete the boost directory from your home directory\n\n#### *Note for Raspbian Jessie users:*\n\nIf you are using the older Raspbian Jessie image, compiling scala is a bit more complicated. The version of Boost available in the Debian Jessie repositories is too old to use with scala, and thus you must compile a newer version yourself. The following explains the extra steps and has been tested on a Raspberry Pi 2 with a clean install of minimal Raspbian Jessie.\n\n* As before, `apt-get update \u0026\u0026 apt-get upgrade` to install all of the latest software, and increase the system swap size\n\n    ```bash\n    sudo /etc/init.d/dphys-swapfile stop\n    sudo nano /etc/dphys-swapfile\n    CONF_SWAPSIZE=2048\n    sudo /etc/init.d/dphys-swapfile start\n    ```\n\n\n* Then, install the dependencies for scala except for `libunwind` and `libboost-all-dev`\n\n* Install the latest version of boost (this may first require invoking `apt-get remove --purge libboost*-dev` to remove a previous version if you're not using a clean install):\n\n    ```bash\n    cd\n    wget https://sourceforge.net/projects/boost/files/boost/1.72.0/boost_1_72_0.tar.bz2\n    tar xvfo boost_1_72_0.tar.bz2\n    cd boost_1_72_0\n    ./bootstrap.sh\n    sudo ./b2\n    ```\n\n* Wait ~8 hours\n\n    ```bash    \n    sudo ./bjam cxxflags=-fPIC cflags=-fPIC -a install\n    ```\n\n* Wait ~4 hours\n\n* From here, follow the [general Raspberry Pi instructions](#on-the-raspberry-pi) from the \"Clone scala and checkout most recent release version\" step.\n\n#### On Windows:\n\nBinaries for Windows are built on Windows using the MinGW toolchain within\n[MSYS2 environment](https://www.msys2.org). The MSYS2 environment emulates a\nPOSIX system. The toolchain runs within the environment and *cross-compiles*\nbinaries that can run outside of the environment as a regular Windows\napplication.\n\n**Preparing the build environment**\n\n* Download and install the [MSYS2 installer](https://www.msys2.org), either the 64-bit or the 32-bit package, depending on your system.\n* Open the MSYS shell via the `MSYS2 Shell` shortcut\n* Update packages using pacman:\n\n    ```bash\n    pacman -Syu\n    ```\n\n* Exit the MSYS shell using Alt+F4\n* Edit the properties for the `MSYS2 Shell` shortcut changing \"msys2_shell.bat\" to \"msys2_shell.cmd -mingw64\" for 64-bit builds or \"msys2_shell.cmd -mingw32\" for 32-bit builds\n* Restart MSYS shell via modified shortcut and update packages again using pacman:\n\n    ```bash\n    pacman -Syu\n    ```\n\n\n* Install dependencies:\n\n    To build for 64-bit Windows:\n\n    ```bash\n    pacman -S mingw-w64-x86_64-toolchain make mingw-w64-x86_64-cmake mingw-w64-x86_64-boost mingw-w64-x86_64-openssl mingw-w64-x86_64-zeromq mingw-w64-x86_64-libsodium mingw-w64-x86_64-hidapi mingw-w64-x86_64-unbound\n    ```\n\n    To build for 32-bit Windows:\n\n    ```bash\n    pacman -S mingw-w64-i686-toolchain make mingw-w64-i686-cmake mingw-w64-i686-boost mingw-w64-i686-openssl mingw-w64-i686-zeromq mingw-w64-i686-libsodium mingw-w64-i686-hidapi mingw-w64-i686-unbound\n    ```\n\n* Open the MingW shell via `MinGW-w64-Win64 Shell` shortcut on 64-bit Windows\n  or `MinGW-w64-Win64 Shell` shortcut on 32-bit Windows. Note that if you are\n  running 64-bit Windows, you will have both 64-bit and 32-bit MinGW shells.\n\n**Cloning**\n\n* To git clone, run:\n\n    ```bash\n    git clone --recursive https://github.com/scala-network/scala.git\n    ```\n\n**Building**\n\n* Change to the cloned directory, run:\n\n    ```bash\n    cd scala\n    ```\n\n* If you would like a specific [version/tag](https://github.com/scala-network/scala/tags), do a git checkout for that version. eg. 'v0.18.1.2'. If you don't care about the version and just want binaries from master, skip this step:\n\n    ```bash\n    git checkout v0.18.1.2\n    ```\n\n* If you are on a 64-bit system, run:\n\n    ```bash\n    make release-static-win64\n    ```\n\n* If you are on a 32-bit system, run:\n\n    ```bash\n    make release-static-win32\n    ```\n\n* The resulting executables can be found in `build/release/bin`\n\n* **Optional**: to build Windows binaries suitable for debugging on a 64-bit system, run:\n\n    ```bash\n    make debug-static-win64\n    ```\n\n* **Optional**: to build Windows binaries suitable for debugging on a 32-bit system, run:\n\n    ```bash\n    make debug-static-win32\n    ```\n\n* The resulting executables can be found in `build/debug/bin`\n\n### On FreeBSD:\n\nThe project can be built from scratch by following instructions for Linux above(but use `gmake` instead of `make`). \nIf you are running scala in a jail, you need to add `sysvsem=\"new\"` to your jail configuration, otherwise lmdb will throw the error message: `Failed to open lmdb environment: Function not implemented`.\n\nscala is also available as a port or package as `scala-cli`.\n\n### On OpenBSD:\n\nYou will need to add a few packages to your system. `pkg_add cmake gmake zeromq libiconv boost libunbound`.\n\nThe `doxygen` and `graphviz` packages are optional and require the xbase set.\nRunning the test suite also requires `py3-requests` package.\n\nBuild scala: `gmake`\n\nNote: you may encounter the following error when compiling the latest version of scala as a normal user:\n\n```\nLLVM ERROR: out of memory\nc++: error: unable to execute command: Abort trap (core dumped)\n```\n\nThen you need to increase the data ulimit size to 2GB and try again: `ulimit -d 2000000`\n\n### On NetBSD:\n\nCheck that the dependencies are present: `pkg_info -c libexecinfo boost-headers boost-libs protobuf readline libusb1 zeromq git-base pkgconf gmake cmake | more`, and install any that are reported missing, using `pkg_add` or from your pkgsrc tree.  Readline is optional but worth having.\n\nThird-party dependencies are usually under `/usr/pkg/`, but if you have a custom setup, adjust the \"/usr/pkg\" (below) accordingly.\n\nClone the scala repository recursively and checkout the most recent release as described above. Then build scala: `gmake BOOST_ROOT=/usr/pkg LDFLAGS=\"-Wl,-R/usr/pkg/lib\" release`.  The resulting executables can be found in `build/NetBSD/[Release version]/Release/bin/`.\n\n### On Solaris:\n\nThe default Solaris linker can't be used, you have to install GNU ld, then run cmake manually with the path to your copy of GNU ld:\n\n```bash\nmkdir -p build/release\ncd build/release\ncmake -DCMAKE_LINKER=/path/to/ld -D CMAKE_BUILD_TYPE=Release ../..\ncd ../..\n```\n\nThen you can run make as usual.\n\n### Building portable statically linked binaries\n\nBy default, in either dynamically or statically linked builds, binaries target the specific host processor on which the build happens and are not portable to other processors. Portable binaries can be built using the following targets:\n\n* ```make release-static-linux-x86_64``` builds binaries on Linux on x86_64 portable across POSIX systems on x86_64 processors\n* ```make release-static-linux-i686``` builds binaries on Linux on x86_64 or i686 portable across POSIX systems on i686 processors\n* ```make release-static-linux-armv8``` builds binaries on Linux portable across POSIX systems on armv8 processors\n* ```make release-static-linux-armv7``` builds binaries on Linux portable across POSIX systems on armv7 processors\n* ```make release-static-linux-armv6``` builds binaries on Linux portable across POSIX systems on armv6 processors\n* ```make release-static-win64``` builds binaries on 64-bit Windows portable across 64-bit Windows systems\n* ```make release-static-win32``` builds binaries on 64-bit or 32-bit Windows portable across 32-bit Windows systems\n\n### Cross Compiling\n\nYou can also cross-compile static binaries on Linux for Windows and macOS with the `depends` system.\n\n* ```make depends target=x86_64-linux-gnu``` for 64-bit linux binaries.\n* ```make depends target=x86_64-w64-mingw32``` for 64-bit windows binaries.\n  * Requires: `python3 g++-mingw-w64-x86-64 wine1.6 bc`\n  * You also need to run:  \n```update-alternatives --set x86_64-w64-mingw32-g++ x86_64-w64-mingw32-g++-posix \u0026\u0026 update-alternatives --set x86_64-w64-mingw32-gcc x86_64-w64-mingw32-gcc-posix```\n* ```make depends target=x86_64-apple-darwin11``` for macOS binaries.\n  * Requires: `cmake imagemagick libcap-dev librsvg2-bin libz-dev libbz2-dev libtiff-tools python-dev`\n* ```make depends target=i686-linux-gnu``` for 32-bit linux binaries.\n  * Requires: `g++-multilib bc`\n* ```make depends target=i686-w64-mingw32``` for 32-bit windows binaries.\n  * Requires: `python3 g++-mingw-w64-i686`\n* ```make depends target=arm-linux-gnueabihf``` for armv7 binaries.\n  * Requires: `g++-arm-linux-gnueabihf`\n* ```make depends target=aarch64-linux-gnu``` for armv8 binaries.\n  * Requires: `g++-aarch64-linux-gnu`\n* ```make depends target=riscv64-linux-gnu``` for RISC V 64 bit binaries.\n  * Requires: `g++-riscv64-linux-gnu`\n* ```make depends target=x86_64-unknown-freebsd``` for freebsd binaries.\n  * Requires: `clang-8`\n* ```make depends target=arm-linux-android``` for 32bit android binaries\n* ```make depends target=aarch64-linux-android``` for 64bit android binaries\n\n\nThe required packages are the names for each toolchain on apt. Depending on your distro, they may have different names. The `depends` system has been tested on Ubuntu 18.04 and 20.04.\n\nUsing `depends` might also be easier to compile scala on Windows than using MSYS. Activate Windows Subsystem for Linux (WSL) with a distro (for example Ubuntu), install the apt build-essentials and follow the `depends` steps as depicted above.\n\nThe produced binaries still link libc dynamically. If the binary is compiled on a current distribution, it might not run on an older distribution with an older installation of libc. Passing `-DBACKCOMPAT=ON` to cmake will make sure that the binary will run on systems having at least libc version 2.17.\n\n### Gitian builds\n\nSee [contrib/gitian/README.md](contrib/gitian/README.md).\n\n## Installing scala from a package\n\n**DISCLAIMER: These packages are not part of this repository or maintained by this project's contributors, and as such, do not go through the same review process to ensure their trustworthiness and security.**\n\nPackages are available for\n\n* Debian Buster\n\n    See the [instructions in the whonix/scala-gui repository](https://gitlab.com/whonix/scala-gui#how-to-install-scala-using-apt-get)\n\n* Debian Bullseye and Sid\n\n    ```bash\n    sudo apt install scala\n    ```\nMore info and versions in the [Debian package tracker](https://tracker.debian.org/pkg/scala).\n\n* Arch Linux [(via Community packages)](https://www.archlinux.org/packages/community/x86_64/scala/):\n\n    ```bash\n    sudo pacman -S scala\n    ```\n\n* Void Linux:\n\n    ```bash\n    xbps-install -S scala\n    ```\n\n* GuixSD\n\n    ```bash\n    guix package -i scala\n    ```\n\n* Gentoo [scala overlay](https://github.com/gentoo-scala/gentoo-scala)\n\n    ```bash\n    emerge --noreplace eselect-repository\n    eselect repository enable scala\n    emaint sync -r scala\n    echo '*/*::scala ~amd64' \u003e\u003e /etc/portage/package.accept_keywords\n    emerge net-p2p/scala\n    ```\n\n* macOS [(homebrew)](https://brew.sh/)\n    ```bash\n    brew install scala\n    ```\n\n* Docker\n\n    ```bash\n    # Build using all available cores\n    docker build -t scala .\n\n    # or build using a specific number of cores (reduce RAM requirement)\n    docker build --build-arg NPROC=1 -t scala .\n\n    # either run in foreground\n    docker run -it -v /scala/chain:/home/scala/.bitscala -v /scala/wallet:/wallet -p 18080:18080 scala\n\n    # or in background\n    docker run -it -d -v /scala/chain:/home/scala/.bitscala -v /scala/wallet:/wallet -p 18080:18080 scala\n    ```\n\n* The build needs 3 GB space.\n* Wait one hour or more\n\nPackaging for your favorite distribution would be a welcome contribution!\n\n## Running scalad\n\nThe build places the binary in `bin/` sub-directory within the build directory\nfrom which cmake was invoked (repository root by default). To run in the\nforeground:\n\n```bash\n./bin/scalad\n```\n\nTo list all available options, run `./bin/scalad --help`.  Options can be\nspecified either on the command line or in a configuration file passed by the\n`--config-file` argument.  To specify an option in the configuration file, add\na line with the syntax `argumentname=value`, where `argumentname` is the name\nof the argument without the leading dashes, for example, `log-level=1`.\n\nTo run in background:\n\n```bash\n./bin/scalad --log-file scalad.log --detach\n```\n\nTo run as a systemd service, copy\n[scalad.service](utils/systemd/scalad.service) to `/etc/systemd/system/` and\n[scalad.conf](utils/conf/scalad.conf) to `/etc/`. The [example\nservice](utils/systemd/scalad.service) assumes that the user `scala` exists\nand its home is the data directory specified in the [example\nconfig](utils/conf/scalad.conf).\n\nIf you're on Mac, you may need to add the `--max-concurrency 1` option to\nscala-wallet-cli, and possibly scalad, if you get crashes refreshing.\n\n## Internationalization\n\nSee [README.i18n.md](docs/README.i18n.md).\n\n## Using Tor\n\n\u003e There is a new, still experimental, [integration with Tor](docs/ANONYMITY_NETWORKS.md). The\n\u003e feature allows connecting over IPv4 and Tor simultaneously - IPv4 is used for\n\u003e relaying blocks and relaying transactions received by peers whereas Tor is\n\u003e used solely for relaying transactions received over local RPC. This provides\n\u003e privacy and better protection against surrounding node (sybil) attacks.\n\nWhile scala isn't made to integrate with Tor, it can be used wrapped with torsocks, by\nsetting the following configuration parameters and environment variables:\n\n* `--p2p-bind-ip 127.0.0.1` on the command line or `p2p-bind-ip=127.0.0.1` in\n  scalad.conf to disable listening for connections on external interfaces.\n* `--no-igd` on the command line or `no-igd=1` in scalad.conf to disable IGD\n  (UPnP port forwarding negotiation), which is pointless with Tor.\n* `DNS_PUBLIC=tcp` or `DNS_PUBLIC=tcp://x.x.x.x` where x.x.x.x is the IP of the\n  desired DNS server, for DNS requests to go over TCP, so that they are routed\n  through Tor. When IP is not specified, scalad uses the default list of\n  servers defined in [src/common/dns_utils.cpp](src/common/dns_utils.cpp).\n* `TORSOCKS_ALLOW_INBOUND=1` to tell torsocks to allow scalad to bind to interfaces\n   to accept connections from the wallet. On some Linux systems, torsocks\n   allows binding to localhost by default, so setting this variable is only\n   necessary to allow binding to local LAN/VPN interfaces to allow wallets to\n   connect from remote hosts. On other systems, it may be needed for local wallets\n   as well.\n* Do NOT pass `--detach` when running through torsocks with systemd, (see\n  [utils/systemd/scalad.service](utils/systemd/scalad.service) for details).\n* If you use the wallet with a Tor daemon via the loopback IP (eg, 127.0.0.1:9050),\n  then use `--untrusted-daemon` unless it is your own hidden service.\n\nExample command line to start scalad through Tor:\n\n```bash\nDNS_PUBLIC=tcp torsocks scalad --p2p-bind-ip 127.0.0.1 --no-igd\n```\n\nA helper script is in contrib/tor/scala-over-tor.sh. It assumes Tor is installed\nalready, and runs Tor and scala with the right configuration.\n\n### Using Tor on Tails\n\nTAILS ships with a very restrictive set of firewall rules. Therefore, you need\nto add a rule to allow this connection too, in addition to telling torsocks to\nallow inbound connections. Full example:\n\n```bash\nsudo iptables -I OUTPUT 2 -p tcp -d 127.0.0.1 -m tcp --dport 18081 -j ACCEPT\nDNS_PUBLIC=tcp torsocks ./scalad --p2p-bind-ip 127.0.0.1 --no-igd --rpc-bind-ip 127.0.0.1 \\\n    --data-dir /home/amnesia/Persistent/your/directory/to/the/blockchain\n```\n\n## Pruning\n\nAs of April 2022, the full scala blockchain file is about 130 GB. One can store a pruned blockchain, which is about 45 GB.\nA pruned blockchain can only serve part of the historical chain data to other peers, but is otherwise identical in\nfunctionality to the full blockchain.\nTo use a pruned blockchain, it is best to start the initial sync with `--prune-blockchain`. However, it is also possible\nto prune an existing blockchain using the `scala-blockchain-prune` tool or using the `--prune-blockchain` `scalad` option\nwith an existing chain. If an existing chain exists, pruning will temporarily require disk space to store both the full\nand pruned blockchains.\n\n## Debugging\n\nThis section contains general instructions for debugging failed installs or problems encountered with scala. First, ensure you are running the latest version built from the GitHub repo.\n\n### Obtaining stack traces and core dumps on Unix systems\n\nWe generally use the tool `gdb` (GNU debugger) to provide stack trace functionality, and `ulimit` to provide core dumps in builds which crash or segfault.\n\n* To use `gdb` in order to obtain a stack trace for a build that has stalled:\n\nRun the build.\n\nOnce it stalls, enter the following command:\n\n```bash\ngdb /path/to/scalad `pidof scalad`\n```\n\nType `thread apply all bt` within gdb in order to obtain the stack trace\n\n* If however the core dumps or segfaults:\n\nEnter `ulimit -c unlimited` on the command line to enable unlimited filesizes for core dumps\n\nEnter `echo core | sudo tee /proc/sys/kernel/core_pattern` to stop cores from being hijacked by other tools\n\nRun the build.\n\nWhen it terminates with an output along the lines of \"Segmentation fault (core dumped)\", there should be a core dump file in the same directory as scalad. It may be named just `core`, or `core.xxxx` with numbers appended.\n\nYou can now analyse this core dump with `gdb` as follows:\n\n```bash\ngdb /path/to/scalad /path/to/dumpfile`\n```\n\nPrint the stack trace with `bt`\n\n * If a program crashed and cores are managed by systemd, the following can also get a stack trace for that crash:\n\n```bash\ncoredumpctl -1 gdb\n```\n\n#### To run scala within gdb:\n\nType `gdb /path/to/scalad`\n\nPass command-line options with `--args` followed by the relevant arguments\n\nType `run` to run scalad\n\n### Analysing memory corruption\n\nThere are two tools available:\n\n#### ASAN\n\nConfigure scala with the -D SANITIZE=ON cmake flag, eg:\n\n```bash\ncd build/debug \u0026\u0026 cmake -D SANITIZE=ON -D CMAKE_BUILD_TYPE=Debug ../..\n```\n\nYou can then run the scala tools normally. Performance will typically halve.\n\n#### valgrind\n\nInstall valgrind and run as `valgrind /path/to/scalad`. It will be very slow.\n\n### LMDB\n\nInstructions for debugging suspected blockchain corruption as per @HYC\n\nThere is an `mdb_stat` command in the LMDB source that can print statistics about the database but it's not routinely built. This can be built with the following command:\n\n```bash\ncd ~/scala/external/db_drivers/liblmdb \u0026\u0026 make\n```\n\nThe output of `mdb_stat -ea \u003cpath to blockchain dir\u003e` will indicate inconsistencies in the blocks, block_heights and block_info table.\n\nThe output of `mdb_dump -s blocks \u003cpath to blockchain dir\u003e` and `mdb_dump -s block_info \u003cpath to blockchain dir\u003e` is useful for indicating whether blocks and block_info contain the same keys.\n\nThese records are dumped as hex data, where the first line is the key and the second line is the data.\n\n# Known Issues\n\n## Protocols\n\n### Socket-based\n\nBecause of the nature of the socket-based protocols that drive scala, certain protocol weaknesses are somewhat unavoidable at this time. While these weaknesses can theoretically be fully mitigated, the effort required (the means) may not justify the ends. As such, please consider taking the following precautions if you are a scala node operator:\n\n- Run `scalad` on a \"secured\" machine. If operational security is not your forte, at a very minimum, have a dedicated a computer running `scalad` and **do not** browse the web, use email clients, or use any other potentially harmful apps on your `scalad` machine. **Do not click links or load URL/MUA content on the same machine**. Doing so may potentially exploit weaknesses in commands which accept \"localhost\" and \"127.0.0.1\".\n- If you plan on hosting a public \"remote\" node, start `scalad` with `--restricted-rpc`. This is a must.\n\n### Blockchain-based\n\nCertain blockchain \"features\" can be considered \"bugs\" if misused correctly. Consequently, please consider the following:\n\n- When receiving scala, be aware that it may be locked for an arbitrary time if the sender elected to, preventing you from spending that scala until the lock time expires. You may want to hold off acting upon such a transaction until the unlock time lapses. To get a sense of that time, you can consider the remaining blocktime until unlock as seen in the `show_transfers` command.\n","funding_links":[],"categories":["C++"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscala-network%2FScala","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fscala-network%2FScala","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscala-network%2FScala/lists"}