How to install the Cryptocurrency Wallet script ?

Post Reply
blockchainscripts
Site Admin
Posts: 184
Joined: Tue Apr 03, 2018 2:12 pm

How to install the Cryptocurrency Wallet script ?

Post by blockchainscripts »

Let’s begin installing the dependencies and the script. Please follow the steps and adhere to the
version of the softwares that are mentioned below for a smoother installation experience.

STEP 1:​ Install NodeJS using PPA

An alternative that can get you a more recent version of Node.js is to add a PPA (personal package archive) maintained by NodeSource. This will have more up-to-date versions of Node.js than the official Ubuntu repositories, and allows you to choose between Node.js v4.x (the older long-term support version, which will be supported until April of 2018), Node.js v6.x (supported until April of 2019), and Node.js v8.x (the current
LTS version, supported until December of 2019).

First, you need to install the PPA in order to get access to its contents. Make sure you're in your home directory, and use curl to retrieve the installation script for your preferred version, making sure to replace 8.x with your preferred version string (if different):

Code: Select all

cd ~
curl -sL https://deb.nodesource.com/setup_8.x -o nodesource_setup.sh
You can inspect the contents of this script with nano (or your preferred text editor):

Code: Select all

 nano nodesource_setup.sh
And run the script under sudo:

Code: Select all

sudo bash nodesource_setup.sh
The PPA will be added to your configuration and your local package cache will be
updated automatically. After running the setup script from nodesource, you can install
the Node.js package in the same way you did above:

Code: Select all

sudo apt-get install nodejs
To check which version of Node.js you have installed after these initial steps, type:

Code: Select all

- nodejs -v
Output:
v8.10.0

The nodejs package contains the nodejs binary as well as npm, so you don't need to install npmseparately. npm uses a configuration file in your home directory to keep track of updates. It will be created the first time you run npm. Execute this command to verify that npm is installed
and to create the configuration file:

Code: Select all

- npm -v
Output
5.6.0

In order for some npm packages to work (those that require compiling code from source,
for example), you will need to install the build-essential package:

Code: Select all

sudo apt-get install build-essential
You now have the necessary tools to work with npm packages that require compiling code from source.

Step 2: Installing MongoDB


Import the public key used by the package management system.
The Ubuntu package management tools (i.e. dpkg and apt) ensure package consistency and authenticity by requiring that distributors sign packages with GPG keys. Issue the following command to import the MongoDB public GPG Key:

Code: Select all

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv
2930ADAE8CAF5059EE73BB4B58712A2291FA4AD5 
Create a list file for MongoDB.

Create the /etc/apt/sources.list.d/mongodb-org-3.6.list list file using

Code: Select all

echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.6
multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.6.list
Reload local package database.

Issue the following command to reload the local package database:

Code: Select all

sudo apt-get update
Install the MongoDB packages.
Install the latest stable version of MongoDB.
Issue the following command:

Code: Select all

sudo apt-get install -y mongodb-org
Start MongoDB.
Issue the following command to start mongod:

Code: Select all

sudo service mongod start
Now drop the code in a folder that you would like the script to run from.
Enter the directory, run:

Code: Select all

npm install
npm start
In your browser, assuming that you have installed the script under www.yourdomain.com. Open
this url www.yourdomain.com:3000 that the script is located at.

STEP 3: INSTALLING BITCOIN BLOCK CHAIN


Some notes on how to build Bitcoin Core in Unix.

(For BSD specific instructions, see build-openbsd.md and/or build-netbsd.md)
Note: Always use absolute paths to configure and compile bitcoin and the dependencies, for example, when specifying the path of the dependency:

Code: Select all

../dist/configure --enable-cxx --disable-shared --with-pic --prefix=$BDB_PREFIX
Here BDB_PREFIX must be an absolute path - it is defined using $(pwd) which ensures the usage of the absolute path.

To Build

Code: Select all

./autogen.sh
./configure
make
make install # optional
This will build bitcoin-qt as well if the dependencies are met
crypwal1.jpg
crypwal2.jpg
Memory Requirements

C++ compilers are memory-hungry. It is recommended to have at least 1.5 GB of memory available when compiling Bitcoin Core. On systems with less, gcc can be tuned to conserve memory with additional CXXFLAGS:

Code: Select all

./configure CXXFLAGS="--param ggc-min-expand=1 --param ggc-min-heapsize=32768"
Linux Distribution Specific Instructions

Ubuntu & Debian
Dependency Build Instructions

Build requirements:

Code: Select all

sudo apt-get install build-essential libtool autotools-dev automake pkg-config libssl-dev
libevent-dev bsdmainutils python3
Options when installing required Boost library files:

On at least Ubuntu 14.04+ and Debian 7+ there are generic names for the individual boost development packages, so the following can be used to only install necessary parts of boost:

Code: Select all

sudo apt-get install libboost-system-dev libboost-filesystem-dev libboost-chrono-dev 
libboost-program-options-dev libboost-test-dev libboost-thread-dev 
If that doesn't work, you can install all boost development packages with:

Code: Select all

sudo apt-get install libboost-all-dev
BerkeleyDB is required for the wallet.

For Ubuntu only: db4.8 packages are available here. You can add the repository and install using the following commands:

Code: Select all

sudo apt-get install software-properties-common
sudo add-apt-repository ppa:bitcoin/bitcoin
sudo apt-get update
sudo apt-get install libdb4.8-dev libdb4.8++-dev
Ubuntu and Debian have their own libdb-dev and libdb++-dev packages, but these will install BerkeleyDB 5.1 or later, which break binary wallet compatibility with the distributed executables which are based on BerkeleyDB 4.8. If you do not care about wallet compatibility, pass --with-incompatible-bdb to configure.

See the section "Disable-wallet mode" to build Bitcoin Core without wallet.

Optional (see --with-miniupnpc and --enable-upnp-default):

Code: Select all

sudo apt-get install libminiupnpc-dev
ZMQ dependencies (provides ZMQ API 4.x):

Code: Select all

sudo apt-get install libzmq3-dev
Dependencies for the GUI

If you want to build Bitcoin-Qt, make sure that the required packages for Qt development are installed. Either Qt 5 or Qt 4 are necessary to build the GUI. If both Qt 4 and Qt 5 are installed, Qt 5 will be used. Pass --with-gui=qt4 to configure to choose Qt4. To build without GUI pass --without-gui.

To build with Qt 5 (recommended) you need the following:

Code: Select all

sudo apt-get install libqt5gui5 libqt5core5a libqt5dbus5 qttools5-dev qttools5-dev-tools
libprotobuf-dev protobuf-compiler
Alternatively, to build with Qt 4 you need the following:

Code: Select all

sudo apt-get install libqt4-dev libprotobuf-dev protobuf-compiler
libqrencode (optional) can be installed with:

Code: Select all

sudo apt-get install libqrencode-dev
Once these are installed, they will be found by configure and a bitcoin-qt executable will be built by default.
Fedora
Dependency Build Instructions
Build requirements:

Code: Select all

sudo dnf install gcc-c++ libtool make autoconf automake openssl-devel libevent-devel
boost-devel libdb4-devel libdb4-cxx-devel python3
Optional:

Code: Select all

sudo dnf install miniupnpc-devel
To build with Qt 5 (recommended) you need the following:

Code: Select all

sudo dnf install qt5-qttools-devel qt5-qtbase-devel protobuf-devel
libqrencode (optional) can be installed with:

Code: Select all

sudo dnf install qrencode-devel
Notes

The release is built with GCC and then "strip bitcoind" to strip the debug symbols, which reduces the executable size by about 90%.

miniupnpc
miniupnpc may be used for UPnP port mapping. It can be downloaded from here. UPnP support is compiled in and turned off by default. See the configure options for upnp behavior desired:

Code: Select all

--without-miniupnpc No UPnP support miniupnp not required 
--disable-upnp-default (the default) UPnP support turned off by default at runtime
--enable-upnp-default UPnP support turned on by default at runtime
Berkeley DB

It is recommended to use Berkeley DB 4.8. If you have to build it yourself, you can use
the installation script included in contrib/ like so

Code: Select all

./contrib/install_db4.sh `pwd`
from the root of the repository.
Note: You only need Berkeley DB if the wallet is enabled (see the section Disable-Wallet mode below).
Boost
If you need to build Boost yourself:

Code: Select all

sudo su
./bootstrap.sh
./bjam install
Security

To help make your bitcoin installation more secure by making certain attacks impossible
to exploit even if a vulnerability is found, binaries are hardened by default. This can be
disabled with:

Hardening Flags:

./configure --enable-hardening
./configure --disable-hardening
Hardening enables the following features:

Position Independent Executable Build position independent code to take advantage of Address Space Layout Randomization offered by some kernels.
Attackers who can cause execution of code at an arbitrary memory location are thwarted if they don't know where anything useful is located. The stack and heap are randomly located by default but this allows the code section to be randomly located as well.

On an AMD64 processor where a library was not compiled with -fPIC, this will cause an error such as: "relocation R_X86_64_32 against `......' can not be used when making a shared object;"
To test that you have built PIE executable, install scanelf, part of paxutils, and use:

Code: Select all

scanelf -e ./bitcoin
The output should contain:

Code: Select all

TYPE ET_DYN
Non-executable Stack If the stack is executable then trivial stack based buffer overflow exploits are possible if vulnerable buffers are found. By default, bitcoin should be built with a non-executable stack but if one of the libraries it uses asks for an executable stack or someone makes a mistake and uses a compiler extension which requires an executable stack, it will silently build an executable without the non-executable stack protection.

To verify that the stack is non-executable after compiling use:

Code: Select all

scanelf -e ./bitcoin
the output should contain: STK/REL/PTL RW- R-- RW-

The STK RW- means that the stack is readable and writeable but not executable.

Disable-wallet mode

When the intention is to run only a P2P node without a wallet, bitcoin may be compiled in disable-wallet mode with:

Code: Select all

./configure --disable-wallet
In this case there is no dependency on Berkeley DB 4.8. Mining is also possible in disable-wallet mode, but only using the getblocktemplate RPC
call not getwork.

Additional Configure Flags

A list of additional configure flags can be displayed with:

Code: Select all

./configure --help
Setup and Build Example: Arch Linux
This example lists the steps necessary to setup and build a command line only, non-wallet distribution of the latest changes on Arch Linux:

Code: Select all

pacman -S git base-devel boost libevent python
git clone https://github.com/bitcoin/bitcoin.git
cd bitcoin/
./autogen.sh
./configure --disable-wallet --without-gui --without-miniupnpc
make check
Note: Enabling wallet support requires either compiling against a Berkeley DB newer than 4.8 (package db) using --with-incompatible-bdb, or building and depending on a local version of Berkeley DB 4.8. The readily available Arch Linux packages are currently built using --with-incompatible-bdb according to the PKGBUILD. As mentioned above, when maintaining portability of the wallet between the standard Bitcoin Core
distributions and independently built node software is desired, Berkeley DB 4.8 must be used.

ARM Cross-compilation

These steps can be performed on, for example, an Ubuntu VM. The depends system will also work on other Linux distributions, however the commands for installing the toolchain will be different.

Make sure you install the build requirements mentioned above. Then, install the toolchain and curl:

Code: Select all

sudo apt-get install g++-arm-linux-gnueabihf curl
To build executables for ARM:

Code: Select all

cd depends
make HOST=arm-linux-gnueabihf NO_QT=1
cd ..
./configure --prefix=$PWD/depends/arm-linux-gnueabihf --enable-glibc-back-compat
--enable-reduce-exports LDFLAGS=-static-libstdc++
make
For further documentation on the depends system see README.md in the depends directory.

Building on FreeBSD
(Updated as of FreeBSD 11.0)
Clang is installed by default as cc compiler, this makes it easier to get started than on
OpenBSD. Installing dependencies:

Code: Select all

pkg install autoconf automake libtool pkgconf
pkg install boost-libs openssl libevent
pkg install gmake
You need to use GNU make (gmake) instead of make. (libressl instead of openssl will
also work)

For the wallet (optional):

Code: Select all

./contrib/install_db4.sh `pwd`
setenv BDB_PREFIX $PWD/db4
Then build using:

Code: Select all

./autogen.sh
./configure --disable-wallet # OR
./configure BDB_CFLAGS="-I${BDB_PREFIX}/include" BDB_LIBS="-L${BDB_PREFIX}/lib
-ldb_cxx"
gmake
Note on debugging: The version of gdb installed by default is ancient and considered harmful. It is not suitable for debugging a multi-threaded C++ program, not even for getting backtraces. Please install the package gdb and use the versioned gdb command
e.g. gdb7111.

STEP 4: INSTALLING LITECOIN BLOCKCHAIN


Some notes on how to build Litecoin Core in Unix.
(for OpenBSD specific instructions, see build-openbsd.md)

Note

Always use absolute paths to configure and compile litecoin and the dependencies, for example, when specifying the path of the dependency:

Code: Select all

../dist/configure --enable-cxx --disable-shared --with-pic --prefix=$BDB_PREFIX
Here BDB_PREFIX must be an absolute path - it is defined using $(pwd) which ensures the usage of the absolute path.

To Build

Code: Select all

./autogen.sh
./configure
make
make install # optional
This will build litecoin-qt as well if the dependencies are met.
crypwal3.jpg
Memory Requirements

C++ compilers are memory-hungry. It is recommended to have at least 1.5 GB of memory available when compiling Litecoin Core. On systems with less, gcc can be tuned to conserve memory with additional CXXFLAGS:

Code: Select all

./configure CXXFLAGS="--param ggc-min-expand=1 --param ggc-min-heapsize=32768"
Dependency Build Instructions: Ubuntu & Debian Build requirements:

Code: Select all

sudo apt-get install build-essential libtool autotools-dev automake pkg-config libssl-dev libevent-dev bsdmainutils
Options when installing required Boost library files:

On at least Ubuntu 14.04+ and Debian 7+ there are generic names for the individual boost development packages, so the following can be used to only install necessary parts of boost:

Code: Select all

sudo apt-get install libboost-system-dev libboost-filesystem-dev libboost-chrono-dev libboost-program-options-dev libboost-test-dev libboost-thread-dev 
If that doesn't work, you can install all boost development packages with:

Code: Select all

sudo apt-get install libboost-all-dev
BerkeleyDB is required for the wallet.

For Ubuntu only: db4.8 packages are available here. You can add the repository and install using the following commands:

Code: Select all

sudo apt-get install software-properties-common
sudo add-apt-repository ppa:bitcoin/bitcoin
sudo apt-get update
sudo apt-get install libdb4.8-dev libdb4.8++-dev
Ubuntu and Debian have their own libdb-dev and libdb++-dev packages, but these will install BerkeleyDB 5.1 or later, which break binary wallet compatibility with the distributed executables which are based on BerkeleyDB 4.8. If you do not care about wallet compatibility, pass --with-incompatible-bdb to configure.

See the section "Disable-wallet mode" to build Litecoin Core without wallet.

Optional (see --with-miniupnpc and --enable-upnp-default):

Code: Select all

sudo apt-get install libminiupnpc-dev
ZMQ dependencies (provides ZMQ API 4.x):

Code: Select all

sudo apt-get install libzmq3-dev 
Dependencies for the GUI: Ubuntu & Debian

If you want to build Litecoin-Qt, make sure that the required packages for Qt development are installed. Either Qt 5 or Qt 4 are necessary to build the GUI. If both Qt 4 and Qt 5 are installed, Qt 5 will be used. Pass --with-gui=qt4 to configure to choose Qt4.

To build without GUI pass --without-gui.
To build with Qt 5 (recommended) you need the following:

Code: Select all

sudo apt-get install libqt5gui5 libqt5core5a libqt5dbus5 qttools5-dev qttools5-dev-tools
libprotobuf-dev protobuf-compiler
Alternatively, to build with Qt 4 you need the following:

Code: Select all

sudo apt-get install libqt4-dev libprotobuf-dev protobuf-compiler
libqrencode (optional) can be installed with:

Code: Select all

sudo apt-get install libqrencode-dev
Once these are installed, they will be found by configure and a litecoin-qt executable will be built by default.

Dependency Build Instructions: Fedora Build requirements:

Code: Select all

sudo dnf install gcc-c++ libtool make autoconf automake openssl-devel libevent-devel
boost-devel libdb4-devel libdb4-cxx-devel
Optional:

Code: Select all

sudo dnf install miniupnpc-devel
To build with Qt 5 (recommended) you need the following:

Code: Select all

sudo dnf install qt5-qttools-devel qt5-qtbase-devel protobuf-devel
libqrencode (optional) can be installed with:

Code: Select all

sudo dnf install qrencode-devel
Notes

The release is built with GCC and then "strip litecoind" to strip the debug symbols, which reduces the executable size by about 90%.

miniupnpc
miniupnpc may be used for UPnP port mapping. It can be downloaded from here. UPnP support is compiled in and turned off by default. See the configure options for upnp behavior desired:
-

Code: Select all

-without-miniupnpc No UPnP support miniupnp not required
--disable-upnp-default (the default) UPnP support turned off by default at runtime
--enable-upnp-default UPnP support turned on by default at runtime
Berkeley DB

It is recommended to use Berkeley DB 4.8. If you have to build it yourself:

Code: Select all

LITECOIN_ROOT=$(pwd)
# Pick some path to install BDB to, here we create a directory within the litecoin directory
BDB_PREFIX="${LITECOIN_ROOT}/db4"
mkdir -p $BDB_PREFIX
# Fetch the source and verify that it is not tampered with
wget 'http://download.oracle.com/berkeley-db/db-4.8.30.NC.tar.gz'
echo '12edc0df75bf9abd7f82f821795bcee50f42cb2e5f76a6a281b85732798364ef
db-4.8.30.NC.tar.gz' | sha256sum -c
# -> db-4.8.30.NC.tar.gz: OK
tar -xzvf db-4.8.30.NC.tar.gz
# Build the library and install to our prefix
cd db-4.8.30.NC/build_unix/
# Note: Do a static build so that it can be embedded into the executable, instead of having
to find a .so at runtime
../dist/configure --enable-cxx --disable-shared --with-pic --prefix=$BDB_PREFIX
make install
# Configure Litecoin Core to use our own-built instance of BDB
cd $LITECOIN_ROOT
./autogen.sh
./configure LDFLAGS="-L${BDB_PREFIX}/lib/" CPPFLAGS="-I${BDB_PREFIX}/include/" #
(other args...)
Note: You only need Berkeley DB if the wallet is enabled (see the section
Disable-Wallet mode below).

Boost
If you need to build Boost yourself:

Code: Select all

sudo su
./bootstrap.sh
./bjam install
Security

To help make your litecoin installation more secure by making certain attacks impossible to exploit even if a vulnerability is found, binaries are hardened by default.

This can be disabled with:
Hardening Flags:

Code: Select all

./configure --enable-hardening
./configure --disable-hardening
Hardening enables the following features:

Position Independent Executable Build position independent code to take advantage of Address Space Layout Randomization offered by some kernels.
Attackers who can cause execution of code at an arbitrary memory location are thwarted if they don't know where anything useful is located. The stack and heap are randomly located by default but this allows the code section to be randomly located as well.

On an AMD64 processor where a library was not compiled with -fPIC, this will cause an error such as: "relocation R_X86_64_32 against `......' can not be used when making a shared object;"

To test that you have built PIE executable, install scanelf, part of paxutils, and use:

Code: Select all

scanelf -e ./litecoin
The output should contain:

Code: Select all

TYPE ET_DYN
Non-executable Stack If the stack is executable then trivial stack based buffer overflow exploits are possible if vulnerable buffers are found. By default, litecoin should be built with a non-executable stack but if one of the libraries it uses asks for an executable stack or someone makes a mistake and uses a compiler extension which requires an executable stack, it will silently build an executable without the non-executable stack protection.

To verify that the stack is non-executable after compiling use:

Code: Select all

scanelf -e ./litecoin
the output should contain:

Code: Select all

STK/REL/PTL RW- R-- RW-
The STK RW- means that the stack is readable and writeable but not executable.

Disable-wallet mode

When the intention is to run only a P2P node without a wallet, litecoin may be compiled in disable-wallet mode with:

Code: Select all

./configure --disable-wallet
In this case there is no dependency on Berkeley DB 4.8. Mining is also possible in disable-wallet mode, but only using the getblocktemplate RPC
call not getwork.

Additional Configure Flags

A list of additional configure flags can be displayed with:

Code: Select all

./configure --help
Setup and Build Example: Arch Linux
This example lists the steps necessary to setup and build a command line only, non-wallet distribution of the latest changes on Arch Linux:

Code: Select all

pacman -S git base-devel boost libevent python
git clone https://github.com/litecoin-project/litecoin.git
cd litecoin/
./autogen.sh
./configure --disable-wallet --without-gui --without-miniupnpc
make check
Note: Enabling wallet support requires either compiling against a Berkeley DB newer than 4.8 (package db) using --with-incompatible-bdb, or building and depending on a local version of Berkeley DB 4.8. The readily available Arch Linux packages are currently built using --with-incompatible-bdb according to the PKGBUILD. As mentioned above, when maintaining portability of the wallet between the standard Litecoin Core
distributions and independently built node software is desired, Berkeley DB 4.8 must be used.

ARM Cross-compilation

These steps can be performed on, for example, an Ubuntu VM. The depends system will also work on other Linux distributions, however the commands for installing the toolchain will be different.

Make sure you install the build requirements mentioned above. Then, install the toolchain and curl:

Code: Select all

sudo apt-get install g++-arm-linux-gnueabihf curl
To build executables for ARM:

Code: Select all

cd depends
make HOST=arm-linux-gnueabihf NO_QT=1
cd ..
./configure --prefix=$PWD/depends/arm-linux-gnueabihf --enable-glibc-back-compat
--enable-reduce-exports LDFLAGS=-static-libstdc++
make
For further documentation on the depends system see README.md in the depends
directory.

Building on FreeBSD (Updated as of FreeBSD 11.0)
Clang is installed by default as cc compiler, this makes it easier to get started than on
OpenBSD. Installing dependencies:

Code: Select all

pkg install autoconf automake libtool pkgconf
pkg install boost-libs openssl libevent
pkg install gmake
You need to use GNU make (gmake) instead of make. (libressl instead of openssl will also work)

For the wallet (optional):

Code: Select all

pkg install db5
This will give a warning "configure: WARNING: Found Berkeley DB other than 4.8; wallets opened by this build will not be portable!", but as FreeBSD never had a binary release, this may not matter. If backwards compatibility with 4.8-built Litecoin Core is needed follow the steps under "Berkeley DB" above.

Then build using:

Code: Select all

./autogen.sh
./configure --with-incompatible-bdb BDB_CFLAGS="-I/usr/local/include/db5"
BDB_LIBS="-L/usr/local/lib -ldb_cxx-5"
gmake
Note on debugging: The version of gdb installed by default is ancient and considered harmful. It is not suitable for debugging a multi-threaded C++ program, not even for getting backtraces. Please install the package gdb and use the versioned gdb command e.g. gdb7111.

STEP 5: INSTALLING BCH BLOCKCHAIN

Some notes on how to build Bitcoin ABC in Unix. (for OpenBSD specific instructions, see build-openbsd.md)
Note: Always use absolute paths to configure and compile bitcoin and the dependencies, for example, when specifying the path of the dependency:

Code: Select all

../dist/configure --enable-cxx --disable-shared --with-pic --prefix=$BDB_PREFIX
Here BDB_PREFIX must be an absolute path - it is defined using $(pwd) which ensures
the usage of the absolute path.
To Build

Code: Select all

./autogen.sh
./configure
make
make install # optional
This will build bitcoin-qt as well if the dependencies are met.
Post Reply

Return to “Installation Guide”