Leviar: An anonymous, secure and private cryptocurrency
C++ C CMake Objective-C Shell Python Other
Switch branches/tags
Clone or download
LeviarCoin
LeviarCoin Updated contrib
Latest commit 5cc499e Jul 17, 2018
Permalink
Failed to load latest commit information.
cmake v18.06.1 Cadmium Jun 27, 2018
contrib Updated contrib Jul 17, 2018
external v18.06.1 Cadmium Jun 27, 2018
include/wallet/api v18.06.1 Cadmium Jun 27, 2018
lib v18.06.1 Cadmium Jun 27, 2018
src v18.06.2 Jul 14, 2018
tests v18.06.2 Jul 14, 2018
translations v18.06.1 Cadmium Jun 27, 2018
utils v18.06.1 Cadmium Jun 27, 2018
CMakeLists.txt v18.06.1 Cadmium Jun 27, 2018
CMakeLists_IOS.txt v18.06.1 Cadmium Jun 27, 2018
Dockerfile v18.06.1 Cadmium Jun 27, 2018
Doxyfile v18.06.1 Cadmium Jun 27, 2018
LICENSE v18.06.1 Cadmium Jun 27, 2018
Makefile v18.06.1 Cadmium Jun 27, 2018
README.md v18.06.1 Cadmium Jun 27, 2018
snap v18.06.1 Cadmium Jun 27, 2018
version v18.06.1 Cadmium Jun 27, 2018
version.sh v18.06.1 Cadmium Jun 27, 2018

README.md

Leviar

Copyright (c) 2014-2018 The Monero Project.
Portions Copyright (c) 2012-2013 The Cryptonote developers.

License

See LICENSE.

Scheduled software upgrades

Leviar uses a fixed-schedule software upgrade (hard fork) mechanism to implement new features. This means that users of Leviar (end users and service providers) should run current versions and upgrade their software on a regular schedule. Software upgrades occur during the months of April and October. The required software for these upgrades will be available prior to the scheduled date. Please check the repository prior to this date for the proper Leviar software version. Below is the historical schedule and the projected schedule for the next upgrade. Dates are provided in the format YYYY-MM-DD.

| Software upgrade block height | Date | Fork version | Minimum Leviar version | Recommended Leviar version | Details | | 1546000 | 2018-06-30 | v7 | v18.06 | v18.06 | Cryptonight variant 1, ringsize >= 7, sorted inputs | XXXXXXX | 2018-10-XX | XX | XXXXXXXXX | XXXXXXXXX | X

X's indicate that these details have not been determined as of commit date.

Compiling Leviar from source

Build instructions

Leviar uses the CMake build system and a top-level Makefile that invokes cmake commands as needed.

On Linux and OS X

  • Install the dependencies

  • Change to the root of the source code directory and build:

      cd leviar
      make
    

    Optional: If your machine has several cores and enough memory, enable parallel build by running make -j<number of threads> instead of make. For this to be worthwhile, the machine should have one core and about 2GB of RAM available per thread.

    Note: If cmake can not find zmq.hpp file on OS X, installing zmq.hpp from https://github.com/zeromq/cppzmq to /usr/local/include should fix that error.

  • The resulting executables can be found in build/release/bin

  • Add PATH="$PATH:$HOME/leviar/build/release/bin" to .profile

  • Run Leviar with leviard --detach

  • Optional: build and run the test suite to verify the binaries:

      make release-test
    

    NOTE: core_tests test may take a few hours to complete.

  • Optional: to build binaries suitable for debugging:

       make debug
    
  • Optional: to build statically-linked binaries:

       make release-static
    

Dependencies 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.

  • Optional: build documentation in doc/html (omit HAVE_DOT=YES if graphviz is not installed):

      HAVE_DOT=YES doxygen Doxyfile
    

On Windows:

Binaries for Windows are built on Windows using the MinGW toolchain within MSYS2 environment. The MSYS2 environment emulates a POSIX system. The toolchain runs within the environment and cross-compiles binaries that can run outside of the environment as a regular Windows application.

Preparing the build environment

  • Download and install the MSYS2 installer, either the 64-bit or the 32-bit package, depending on your system.

  • Open the MSYS shell via the MSYS2 Shell shortcut

  • Update packages using pacman:

      pacman -Syuu
    
  • Exit the MSYS shell using Alt+F4

  • 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

  • Restart MSYS shell via modified shortcut and update packages again using pacman:

      pacman -Syuu
    
  • Install dependencies:

    To build for 64-bit Windows:

      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
    

    To build for 32-bit Windows:

      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
    
  • Open the MingW shell via MinGW-w64-Win64 Shell shortcut on 64-bit Windows or MinGW-w64-Win64 Shell shortcut on 32-bit Windows. Note that if you are running 64-bit Windows, you will have both 64-bit and 32-bit MinGW shells.

Building

  • If you are on a 64-bit system, run:

      make release-static-win64
    
  • If you are on a 32-bit system, run:

      make release-static-win32
    
  • The resulting executables can be found in build/release/bin

  • Optional: to build Windows binaries suitable for debugging on a 64-bit system, run:

      make debug-static-win64
    
  • Optional: to build Windows binaries suitable for debugging on a 32-bit system, run:

      make debug-static-win32
    
  • The resulting executables can be found in build/debug/bin

Building portable statically linked binaries

By 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:

  • make release-static-linux-x86_64 builds binaries on Linux on x86_64 portable across POSIX systems on x86_64 processors
  • make release-static-linux-i686 builds binaries on Linux on x86_64 or i686 portable across POSIX systems on i686 processors
  • make release-static-linux-armv8 builds binaries on Linux portable across POSIX systems on armv8 processors
  • make release-static-linux-armv7 builds binaries on Linux portable across POSIX systems on armv7 processors
  • make release-static-linux-armv6 builds binaries on Linux portable across POSIX systems on armv6 processors
  • make release-static-win64 builds binaries on 64-bit Windows portable across 64-bit Windows systems
  • make release-static-win32 builds binaries on 64-bit or 32-bit Windows portable across 32-bit Windows systems

Running leviard

The build places the binary in bin/ sub-directory within the build directory from which cmake was invoked (repository root by default). To run in foreground:

./bin/leviard

To list all available options, run ./bin/leviard --help. Options can be specified either on the command line or in a configuration file passed by the --config-file argument. To specify an option in the configuration file, add a line with the syntax argumentname=value, where argumentname is the name of the argument without the leading dashes, for example log-level=1.

To run in background:

./bin/leviard --log-file leviard.log --detach

To run as a systemd service, copy leviard.service to /etc/systemd/system/ and leviard.conf to /etc/. The example service assumes that the user leviar exists and its home is the data directory specified in the example config.

If you're on Mac, you may need to add the --max-concurrency 1 option to leviar-wallet-cli, and possibly leviard, if you get crashes refreshing.

Using Tor

While Leviar isn't made to integrate with Tor, it can be used wrapped with torsocks, by setting the following configuration parameters and environment variables:

  • --p2p-bind-ip 127.0.0.1 on the command line or p2p-bind-ip=127.0.0.1 in leviard.conf to disable listening for connections on external interfaces.
  • --no-igd on the command line or no-igd=1 in leviard.conf to disable IGD (UPnP port forwarding negotiation), which is pointless with Tor.
  • DNS_PUBLIC=tcp or DNS_PUBLIC=tcp://x.x.x.x where x.x.x.x is the IP of the desired DNS server, for DNS requests to go over TCP, so that they are routed through Tor. When IP is not specified, leviard uses the default list of servers defined in src/common/dns_utils.cpp.
  • TORSOCKS_ALLOW_INBOUND=1 to tell torsocks to allow leviard to bind to interfaces to accept connections from the wallet. On some Linux systems, torsocks allows binding to localhost by default, so setting this variable is only necessary to allow binding to local LAN/VPN interfaces to allow wallets to connect from remote hosts. On other systems, it may be needed for local wallets as well.
  • Do NOT pass --detach when running through torsocks with systemd, (see utils/systemd/leviard.service for details).

Example command line to start leviard through Tor:

DNS_PUBLIC=tcp torsocks leviard --p2p-bind-ip 127.0.0.1 --no-igd

Using Tor on Tails

TAILS ships with a very restrictive set of firewall rules. Therefore, you need to add a rule to allow this connection too, in addition to telling torsocks to allow inbound connections. Full example:

sudo iptables -I OUTPUT 2 -p tcp -d 127.0.0.1 -m tcp --dport 18081 -j ACCEPT
DNS_PUBLIC=tcp torsocks ./leviard --p2p-bind-ip 127.0.0.1 --no-igd --rpc-bind-ip 127.0.0.1 \
    --data-dir /home/amnesia/Persistent/your/directory/to/the/blockchain

Obtaining stack traces and core dumps on Unix systems

We generally use the tool gdb (GNU debugger) to provide stack trace functionality, and ulimit to provide core dumps in builds which crash or segfault.

  • To use gdb in order to obtain a stack trace for a build that has stalled:

Run the build.

Once it stalls, enter the following command:

gdb /path/to/leviard `pidof leviard`

Type thread apply all bt within gdb in order to obtain the stack trace

  • If however the core dumps or segfaults:

Enter ulimit -c unlimited on the command line to enable unlimited filesizes for core dumps

Enter echo core | sudo tee /proc/sys/kernel/core_pattern to stop cores from being hijacked by other tools

Run the build.

When 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 leviard. It may be named just core, or core.xxxx with numbers appended.

You can now analyse this core dump with gdb as follows:

gdb /path/to/leviard /path/to/dumpfile

Print the stack trace with bt

  • To run leviar within gdb:

Type gdb /path/to/leviard

Pass command-line options with --args followed by the relevant arguments

Type run to run leviard

Analysing memory corruption

We use the tool valgrind for this.

Run with valgrind /path/to/leviard. It will be slow.

LMDB

Instructions for debugging suspected blockchain corruption as per @HYC

There 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:

cd ~/leviar/external/db_drivers/liblmdb && make

The output of mdb_stat -ea <path to blockchain dir> will indicate inconsistencies in the blocks, block_heights and block_info table.

The output of mdb_dump -s blocks <path to blockchain dir> and mdb_dump -s block_info <path to blockchain dir> is useful for indicating whether blocks and block_info contain the same keys.

These records are dumped as hex data, where the first line is the key and the second line is the data.