maandag 24 september 2018

How To Compile Altcoin For Windows on Linux Using mxe and mingw


We are going to make altcoin qt for windows on ubuntu. We have clone peercoin and made a funcoin by replacing some parameter, I am assuming you have developed your coin.

First install required dependencies
sudo apt-get install autoconf automake autopoint bash bison bzip2 p7zip-full cmake flex gettext git g++ gperf intltool libffi-dev libtool libltdl-dev libssl-dev libxml-parser-perl make openssl patch perl pkg-config python ruby scons sed unzip wget xz-utils

sudo apt-get install g++-multilib libc6-dev-i386


move to any folder, here I am going in mnt folder and taking the fresh mxe clone.

cd /mnt
git clone https://github.com/mxe/mxe.git


Now compile boost

make MXE_TARGETS="i686-w64-mingw32.static" boost

Compile qt

make MXE_TARGETS="i686-w64-mingw32.static" qt


mxe does not support barkeley db and miniupnpc, so we have to compile these explicitly

compiling the barkeley db:

cd /mnt
wget http://download.oracle.com/berkeley-db/db-4.8.30.tar.gz
tar zxvf db-4.8.30.tar.gz
cd /mnt/db-4.8.30
touch compile-db.sh
chmod ugo+x compile-db.sh

now edit the compile-db.sh script file and put the below content and save
#!/bin/bash
MXE_PATH=/mnt/mxe
sed -i "s/WinIoCtl.h/winioctl.h/g" src/dbinc/win_db.h
mkdir build_mxe
cd build_mxe

CC=$MXE_PATH/usr/bin/i686-w64-mingw32.static-gcc \
CXX=$MXE_PATH/usr/bin/i686-w64-mingw32.static-g++ \
../dist/configure \
 --disable-replication \
 --enable-mingw \
 --enable-cxx \
 --host x86 \
 --prefix=$MXE_PATH/usr/i686-w64-mingw32.static

make

make install

for running the file command 

./compile-db.sh

 compiling miniupnpc

cd /mnt
wget http://miniupnp.free.fr/files/miniupnpc-1.6.20120509.tar.gz
tar zxvf miniupnpc-1.6.20120509.tar.gz
cd /mnt/miniupnpc-1.6.20120509
touch com-min.sh
chmod ugo+x com-min.sh

now edit the com-min.sh script file and put the below content and save

#!/bin/bash
MXE_PATH=/mnt/mxe

CC=$MXE_PATH/usr/bin/i686-w64-mingw32.static-gcc \
AR=$MXE_PATH/usr/bin/i686-w64-mingw32.static-ar \
CFLAGS="-DSTATICLIB -I$MXE_PATH/usr/i686-w64-mingw32.static/include" \
LDFLAGS="-L$MXE_PATH/usr/i686-w64-mingw32.static/lib" \
make libminiupnpc.a

mkdir $MXE_PATH/usr/i686-w64-mingw32.static/include/miniupnpc
cp *.h $MXE_PATH/usr/i686-w64-mingw32.static/include/miniupnpc
cp libminiupnpc.a $MXE_PATH/usr/i686-w64-mingw32.static/lib


for running the file command 

./com-min.sh

now add mxe bin to env PATH:

export PATH=/mnt/mxe/usr/bin:$PATH

now paste funcoin or take clone from github

cd /mnt
// paste your altcoin code
cd /mnt/funcoin
touch compile-coin.sh
chmod ugo+x compile-coin.sh

now edit compile-coin.sh file and paste the below content

#!/bin/bash
MXE_INCLUDE_PATH=/mnt/mxe/usr/i686-w64-mingw32.static/include
MXE_LIB_PATH=/mnt/mxe/usr/i686-w64-mingw32.static/lib

i686-w64-mingw32.static-qmake-qt4 \
 BOOST_LIB_SUFFIX=-mt \
 BOOST_THREAD_LIB_SUFFIX=_win32-mt \
 BOOST_INCLUDE_PATH=$MXE_INCLUDE_PATH/boost \
 BOOST_LIB_PATH=$MXE_LIB_PATH \
 OPENSSL_INCLUDE_PATH=$MXE_INCLUDE_PATH/openssl \
 OPENSSL_LIB_PATH=$MXE_LIB_PATH \
 BDB_INCLUDE_PATH=$MXE_INCLUDE_PATH \
 BDB_LIB_PATH=$MXE_LIB_PATH \
 MINIUPNPC_INCLUDE_PATH=$MXE_INCLUDE_PATH \
 MINIUPNPC_LIB_PATH=$MXE_LIB_PATH \
 QMAKE_LRELEASE=/mnt/mxe/usr/i686-w64-mingw32.static/qt/bin/lrelease funcoin-qt.pro

make -f Makefile.Release

now run the file by command ./compile-coin.sh
You will get the .exe file in release folder.


When error:
compilation terminated.
Makefile.Release:12634: recipe for target 'build/txdb-leveldb.o' failed
make: *** [build/txdb-leveldb.o] Error 1

Run this
TARGET_OS=NATIVE_WINDOWS make libleveldb.a libmemenv.a CC=~/mxe/usr/bin/i686-w64-mingw32.static-gcc CXX=~/mxe/usr/bin/i686-w64-mingw32.static-g++




maandag 16 juli 2018

How to fix “failed to run aclocal: No such file or directory”

The development release of a program source code often comes with autogen.sh which is used to prepare a build process, including verifying program functionality and generating configure script. This autogen.sh script then relies on autoreconf to invoke autoconfautomakeaclocal and other related tools.
The missing aclocal is part of automake package. Thus, to fix this error, install the following package.
On Debian, Ubuntu or Linux Mint:
$ sudo apt-get install automake
On CentOS, Fedora or RHEL:
$ sudo yum install automake


vrijdag 30 maart 2018

Node and Iquidus Explorer Setup for Dummies

Node / Iquidus Explorer Setup for Dummies
Pulse Crypto is used in this example.
This Tutorial is going to create a Daemon (node) and install Explorer.
THIS IS NOT GOING TO CREATE A GUI CLIENT.
Follow the instructions in [whatever coin name] docs folder Unix build - some builds are different.
I setup this up on both Ubuntu 15.10 and 16.04 with no issues.
You can create an account on vultr and get $50 free to be used in 2 months.
Non-refferal link: https://www.vultr.com/freetrial/
******************************************
*** Change Password / Update System
******************************************
Change passwords
# sudo passwd //change root password
Update Packages
# sudo apt-get update
# sudo apt-get upgrade -y
Install git and nano
# sudo apt-get install nano git -y
******************************************
*** Installing Pulse Node
******************************************
Get the Source Code
Basic packages to build the coin
# sudo apt-get install build-essential libssl-dev libdb++-dev libboost-all-dev libqrencode-dev miniupnpc libminiupnpc-dev autoconf pkg-config libtool autotools-dev libqt5gui5 libqt5core5a libqt5dbus5 qttools5-dev qttools5-dev-tools libprotobuf-dev automake -y
Create a Swap File - Low Ram Servers
# sudo fallocate -l 4G /swapfile
# sudo chmod 600 /swapfile
# sudo mkswap /swapfile
# sudo swapon /swapfile
# sudo nano /etc/fstab
Add to fstab file
/swapfile none swap sw 0 0
Adding the Coin
# sudo git clone https://github.com/elcrypto/Pulse.git
Change Directories to src/
# cd Pulse/src/
Compile the code with flags
# sudo make -f makefile.unix USE_UPNP=1
# sudo strip pulsed
Stat the file with daemon flag so that you can create a config file
# sudo ./pulsed -daemon
Create a conf file in .pulse/pulse.conf
# cd
# sudo nano .pulse/pulse.conf
rpcuser=pulserpc
rpcpassword=Gnfh67gdmRTGvA5YB3UZhV6e6cPTTeneTTdnosLLD3cU
listen=1
maxconnections=500
*make sure to set the file to read only.
# sudo chmod 400 .pulse/pulse.conf
# cd Pulse/src
# sudo ./pulsed -daemon -txindex
Check it daemon has started. If it returns information, the daemon is working!
# sudo ./pulsed getinfo
Stopping the daemon
# sudo ./pulsed stop
******************************************
*** Setting up the Explorer
*** https://github.com/iquidus/explorer
******************************************
Install MongoDB Community Edition
https://docs.mongodb.org/manual/tutorial/install-mongodb-on-ubuntu/
# sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927
# echo "deb http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.2.list
# sudo apt-get update
# sudo apt-get install -y mongodb-org
Default init system is systemd which was Upstart previously. So you need to install Upstart, reboot your system and here you go, you can now run mongodb service.
Install Upstart
# sudo apt-get install upstart-sysv -y
# Reboot your system
# sudo reboot
# sudo service mongod start
Running MongoDB - reference
# sudo service mongod start
# sudo service mongod stop
# sudo service mongod restart
Installing Nodejs
# sudo apt-get update
# sudo apt-get install nodejs nodejs-legacy -y
# sudo apt-get install npm -y
Creating a MongoDB Database
# sudo mongo
> use explorerdb
> db.createUser( { user: "3er44we222", pwd: "3eu4ue8hhk988!kd8", roles: [ "readWrite" ] } )
> exit
Installing the Explorer
# cd /home/
# git clone https://github.com/iquidus/explorer explorer
# cd explorer && npm install --production
# cp ./settings.json.template ./settings.json
Modify the Settings File
# sudo nano settings.json
See if it's working
# npm start
Update the databases
# sudo node scripts/sync.js index update
Install Forever to keep the js running
# sudo npm install forever -g
# sudo npm install forever-monitor
Start the Explorer
# forever start bin/cluster
******************************************
*** Installing Cron
*** https://help.ubuntu.com/community/CronHowto
******************************************
# sudo apt-get install gnome-schedule -y
Editing Cron
# sudo crontab -e
Add Cron to File to update the explorer
*/1 * * * * cd /path/to/explorer && /usr/bin/node scripts/sync.js index update > /dev/null 2>&1
Add Cron to make sure the Pulsed runs (NOT WORKING)
If anyone has a good reboot for this, please post in the comments.
@reboot cd /root/Pulse/src ./pulsed -daemon -txindex
@reboot cd /root/explorer forever start bin/cluster