Install Guide

System Requirements

ElectrumRVN is compatible with various operating systems, including Windows, macOS, and Linux. It has been successfully tested on MacOS and DragonFlyBSD. While additional modifications may be needed for optimal performance on specific versions, community contributions are encouraged.

Dependency Description
Python3 ElectrumRVN is built on asyncio. You must have Python version >= 3.8 installed.
aiohttp This Python library facilitates asynchronous HTTP requests. Ensure you have version >= 2.0.
Database Engine You'll need a database engine package, with support for two options (refer to Database Engine below).

Certain cryptocurrencies may require additional packages, often for their specific block hash algorithms. For example, dash_hash is necessary for DASH coins. Additionally, Scrypt-based coins require a Python interpreter that is compiled and/or linked with OpenSSL version 1.1.0 or newer.

You must run a non-pruning Bitcoin daemon with:

txindex=1 

configured in its settings. If you have an existing bitcoind installation without this setting, you will need to reindex the blockchain using:

bitcoind -reindex 

This process may take a considerable amount of time.

While it’s not mandatory to run ElectrumRVN, it is recommended to use supervisor software like Daniel Bernstein's daemontools, Gerrit Pape's runit, or :command:systemd. These tools simplify the administration of secure Unix servers, and I highly advise getting acquainted with one of them. The guidelines and sample scripts provided here are tailored for daemontools, but adapting them for runit should be straightforward for those familiar with either tool.

When constructing the database from the genesis block, ElectrumRVN will need to write significant amounts of data to disk and its database. For optimal performance, having the database on an SSD is preferable to using an HDD. As of approximately height 611,600 in the Bitcoin blockchain, the total size of the LevelDB database, along with other ElectrumRVN file metadata, is slightly over 46.9GB (43.7 GiB). LevelDB may require additional space temporarily, and given the blockchain's growth, I recommend having at least 70-80GB of available storage before initiating the process.

Choosing a Database Engine

You can opt for either LevelDB or RocksDB to manage transaction data on disk. The difference in time taken and database size between the two is minimal. We attempted to include LMDB support; however, its performance for history writes was subpar.

You will need to install one of the following:

  • plyvel for LevelDB.

    This is included in the standard pip or setup.py installation process for ElectrumRVN.

  • python-rocksdb for RocksDB.

    You can install it using pip3 install python-rocksdb or by utilizing the RocksDB installation option for ElectrumRVN.

  • pyrocksdb for an outdated version incompatible with recent RocksDB releases.

Starting the Application

Begin by installing the prerequisites mentioned above.

Next, clone the repository from GitHub:

git clone https://github.com/Electrum-Raven/electrum-rvn.git 
cd electrum-rvn

You can proceed with the installation by executing:

pip3 install .

ElectrumRVN also offers various extra Python dependencies tailored to your specific needs or the cryptocurrencies you use. For instance, to install the RocksDB dependencies along with a more efficient JSON parsing library, you can use:

pip3 install .[rocksdb,ujson]

Refer to setup.py's extra_requires section for a complete listing.

Additionally, you can execute the code directly from the source directory or a copy of it.

It's advisable to create a dedicated user account for running the server; your existing account should suffice unless you have security concerns. If you prefer a more secure setup, consider establishing a separate account for the logging process associated with daemontools. The provided sample scripts and instructions assume all actions are performed under a single account, which I have designated as electrum-rvn.

Then, create a directory for the database storage and ensure it's writable by the electrum-rvn user. It’s recommended to place this directory on an SSD:

mkdir /path/to/db_directory
chown electrum-rvn /path/to/db_directory

Managing Process Limits

You must configure a high open file limit for the ElectrumRVN process. During synchronization, it should not require more than about 1,024 open files. While serving requests, approximately 256 files will be utilized for LevelDB in addition to the number of incoming connections. It's common to have between 1,000 and 2,000 connections being handled, so I recommend setting your open files limit to at least 2,500.

Keep in mind that setting this limit in your shell does NOT impact ElectrumRVN unless you run it directly from your shell. If you are utilizing :command:systemd, you need to configure it in the :file:.service file (refer to contrib/systemd/electrum-rvn.service for guidance).

Setting Up Daemontools

Next, establish a service directory for daemontools; this will only contain symlinks (please see the daemontools documentation). The :command:svscan utility ensures that servers in the directory remain operational by launching a :command:run script found within each service directory. The following commands will create the required directory structure.

# Create the daemontools service directory.
mkdir /service

# Create the service directory for ElectrumRVN.
mkdir /service/electrum-rvn
cd /service/electrum-rvn

# Create the run script.
cat > run << EOF
#!/bin/sh
exec 2>&1
exec /path/to/electrum-rvn/electrum-rvn --db_directory=/path/to/db_directory
EOF

# Make the run script executable.
chmod +x run
				  

Finally, create a symbolic link to the existing database. The database location you set earlier in db_directory is required for ElectrumRVN to function properly.

ln -s /path/to/db_directory /service/electrum-rvn/db_directory

To run the server, simply invoke the :command:svscan command:

svscan /service

For further monitoring and control, I recommend utilizing Supervisor, which serves as an alternative management tool for your application. This method will grant you more flexibility and control over the ElectrumRVN server.

With these steps completed, your ElectrumRVN server should be successfully set up and operational. For any issues or further inquiries, please refer to our support documentation or community forums.

When setting up a new server, it’s essential to optimize the configuration for your specific workload. You can monitor performance metrics using:

tail -F /path/to/logs/server.log | tai64nlocal

Using systemd for Service Management

This repository includes a sample systemd unit file for managing your application service. To set it up, copy it to /etc/systemd/system:

cp contrib/systemd/myapp.service /etc/systemd/system/

Make sure to update the paths in the unit file to match your installation directory.

You also need to configure a few environment variables in /etc/myapp.conf.

Start your application service using:

systemctl start myapp

Check the logs for output using:

journalctl -u myapp -f

To enable the service to start automatically at boot:

systemctl enable myapp

Note

Be cautious when terminating processes, as this could lead to data corruption. Ensure that you allow adequate time for data to flush to disk during shutdown.

Installation on Raspberry Pi

For optimal performance on Raspberry Pi, follow the guidelines outlined in contrib/raspberrypi/install_myapp.sh.

Refer to contrib/raspberrypi/run_myapp.sh for quick configuration and execution of your application.

Synchronization Metrics

The synchronization duration varies based on hardware capabilities. Our application leverages asynchronous operations for efficiency.

For improved performance, consider using a dedicated machine for heavy indexing tasks.

The MEMORY_LIMIT environment variable defines the maximum memory usage. Refer to here for detailed tuning instructions.

Below are my experiences with different setups under various conditions:

                 Setup X      Setup Y
150,000          15m 45s      3m 15s
270,000                       40m 50s
310,000                       1h 10m
340,000          11h 05m      1h 55m
370,000          22h 20m      4h 10m
400,000       1d 10h 15m      5h 40m
430,000       2d 1h 30m       7h 50m

Setup X: a mid-range 2018 Intel i7 laptop with 16GB RAM and SSD, communicating with a remote server.

Setup Y: a high-performance server with an AMD Ryzen 9, 64GB RAM, and NVMe SSD, hosting the blockchain locally.

Other blockchain implementations may experience faster synchronization.

Important

The application will not accept client connections until full synchronization with the blockchain is achieved. However, local RPC connections are always available.

Shutting Down the Application

To terminate the application gracefully, send the shutdown command:

myapp_rpc shutdown

Alternatively, you can use system signals to stop the process. For instance, if managed by daemontools:

svc -d ~/service/myapp

The application will log the shutdown process and ensure all data is saved before exiting. Please allow time for this to complete.

The application maintains transactional integrity, meaning data will remain intact unless there’s an unforeseen shutdown. In rare cases, you might need to restart from the last successful state.

After termination, restart the application with:

svc -u ~/service/myapp

To check the status of the service, use:

svstat ~/service/myapp

Using svscan, you can manage multiple service instances if necessary.

Monitoring resource usage is important, especially during heavy workloads. Use tools like top or htop to keep an eye on system performance.

Get Wallet Today!

Download Electrum Raven Wallet today and take control of your Ravencoin. Fast, secure, and user-friendly, it's the perfect solution for storing and managing your assets.