Author [EN] [ZH] [ES] [PT] [IT] [DE] [FR] [NL] [TR] [SR] [AR] [RU] [EN] [ZH] [ES] [PT] [IT] [DE] [FR] [NL] [TR] [SR] [AR] [RU] [EN] [ZH] [ES] [PT] [IT] [DE] [FR] [NL] [TR] [SR] [AR] [RU] Topic: [MMC] Solo miner compilation guide  (Read 4965 times)

0 Members and 1 Guest are viewing this topic.

Offline h0g0f0g0

  • Jr. Member
  • **
  • Posts: 48
    • View Profile
[MMC] Solo miner compilation guide
« on: December 21, 2013, 09:41:04 PM »

I decided to put together some compiling instructions that would help a Linux newbies to run memorycoin miner in no time. Credits go to mikaelh, because I have used his primecoind guide as base for this.

This should be the definitive guide on how to compile memorycoin on Linux. Commands need to be entered exactly as they appear, so copy and pasting is recommended.

Please note that if you are new to Linux, it's best to stick with one guide. Mixing the instructions from different guides may produce errors later.

Tested with the following Linux distributions:
 - Ubuntu 13.xx
 - Debian 6/7
 - CentOS 6.x
 - OpenSUSE 12.x/13.x

Step 1. Installing the required dependencies

Using apt-get with latest Ubuntu 13.xx or Debian:

Code: [Select]
sudo apt-get install -y build-essential m4 libssl-dev libdb++-dev libboost-all-dev libminiupnpc-dev git
The 'sudo' command requires you to type the password for the current user. If you don't have sudo working, you need to manually switch to root with 'su' before running those commands.

Warning: If you have installed a specific version such as libdb5.3++-dev before, then don't install the meta-package libdb++-dev which may pull a different version.


Alternative for CentOS users:

Code: [Select]
su -c 'yum install gcc-c++ m4 openssl-devel db4-devel boost-devel git'

Step 2. Compiling GMP

Latest version supports all the new CPUs.

Code: [Select]
cd
rm -rf gmp-5.1.3.tar.bz2 gmp-5.1.3
wget http://mirrors.kernel.org/gnu/gmp/gmp-5.1.3.tar.bz2
tar xjvf gmp-5.1.3.tar.bz2
cd gmp-5.1.3
./configure --enable-cxx
make
sudo make install

The configure script will attempt to automatically detect the host CPU and enable the best optimizations for it.


Step 2b. Compiling OpenSSL (for CentOS, Fedora and OpenSUSE users)

This step is only required if you're using CentOS. Red Hat has removed support for elliptic curve cryptography from the OpenSSL it supplies.

Code: [Select]
cd
rm -rf openssl-1.0.1e.tar.gz openssl-1.0.1e
wget ftp://ftp.pca.dfn.de/pub/tools/net/openssl/source/openssl-1.0.1e.tar.gz
tar xzvf openssl-1.0.1e.tar.gz
cd openssl-1.0.1e
./config shared --prefix=/usr/local --libdir=lib
make
sudo make install


Step 2c. Compiling miniupnpc (for CentOS, Fedora and OpenSUSE users)

Code: [Select]
cd
rm -rf  miniupnpc-1.8.20131209.tar.gz
wget http://miniupnp.tuxfamily.org/files/download.php?file=miniupnpc-1.8.20131209.tar.gz
tar xzvf miniupnpc-1.8.20131209.tar.gz
cd  miniupnpc-1.8.20131209
make
sudo INSTALLPREFIX=/usr/local make install


Step 3. Compiling memorycoind

Code: [Select]
cd
rm -rf memorycoin
git clone https://github.com/memorycoin/memorycoin
cd memorycoin/src
cp makefile.unix makefile.my
sed -i -e 's/$(OPENSSL_INCLUDE_PATH))/$(OPENSSL_INCLUDE_PATH) \/usr\/local\/include)/' makefile.my
sed -i -e 's/$(OPENSSL_LIB_PATH))/$(OPENSSL_LIB_PATH) \/usr\/local\/lib)/' makefile.my
sed -i -e 's/$(LDHARDENING) $(LDFLAGS)/$(LDHARDENING) -Wl,-rpath,\/usr\/local\/lib $(LDFLAGS)/' makefile.my
make -f makefile.my
strip bitcoind
mv bitcoind memorycoind
sudo cp -f memorycoind /usr/local/bin/

The last line will install the memorycoind binary to /usr/local/bin.

CentOS users: Use the following 'make' command instead:

Code: [Select]
make -f makefile.my BOOST_LIB_SUFFIX=-mt

Step 4. Configuration

Create a configuration file:

Code: [Select]
cd
mkdir -p .memorycoin
echo 'server=1
gen=1
logtimestamps=1
rpcallowip=127.0.0.1
rpcuser=memorycoinrpc
rpcpassword=SOME_SECURE_PASSWORD' > .memorycoin/memorycoin.conf
sed -i -e "s/SOME_SECURE_PASSWORD/`< /dev/urandom tr -cd '[:alnum:]' | head -c32`/" .memorycoin/memorycoin.conf

You may optinally customize the configuration file. The last line puts a random password in the configuration file automatically, so you don't need to change anything if you're only sending RPC commands from localhost.

I recommend to search other threads for a list of valid nodes and add them with "addnode=IP_ADDRESS". Also if you are having problem with damaged database try to add "checklevel=2".

Type these commands to create an auto-restart script:

Code: [Select]
cd
echo '#!/bin/bash
export PATH="/usr/local/bin:$PATH"
killall --older-than 10s -q run-memorycoind memorycoind
function background_loop
        while :; do
                memorycoind >/dev/null 2>&1
                sleep 1
        done
background_loop &' > run-memorycoind
chmod +x run-memorycoind

CentOS users may want to remove the 'killall' command from this script because the version that comes with CentOS does not support the --older-than option.

And for convenience, create a stopping script:

Code: [Select]
cd
echo '#!/bin/bash
killall -q run-memorycoind
memorycoind stop' > stop-memorycoind
chmod +x stop-memorycoind

You can also run miner with "memorycoind -daemon" and in some cases it can speed up the the blockchain sync. The monitoring script has to be adjusted if -daemon option is used.


Step 5. Starting mining

Simply type the following to start mining:

Code: [Select]
./run-memorycoind
It will take a while for it to sync up with the network. The script will continue running in the background, automatically restarting memorycoind if it crashes.


Step 6. Monitoring the progress

Checking that the memorycoind process is runnning:

Code: [Select]
ps xuf |grep memorycoind
RPC commands can be sent to the daemon like this:

Code: [Select]
memorycoind getbalance '' 0
memorycoind listtransactions
memorycoind getinfo
memorycoind getmininginfo
memorycoind getdifficulty

Any combination of these can be used with the 'watch' command like this:

Code: [Select]
watch 'memorycoind getinfo && memorycoind listtransactions'
Running RPC commands on miner can "hang" due to yet unknown reasons. It looks like some broken system threads magic causes this. Use Ctrl+C to terminate the request and verify debug.log to see what is miner doing. However in the beginning with no blockchain all commands are working nicely.

You can also look at the output in debug.log in real-time:

Code: [Select]
tail -f ~/.memorycoin/debug.log

Step 7. Stopping mining

Run the stop script:

Code: [Select]
./stop-memorycoind
As a last resort you can try to remove peers.dat and directories:
 - chainstate
 - blocks
 - database
then restart the miner and run:

Code: [Select]
memorycoind listtransactions
If you see orphaned blocks, verify in blockchain explorer that these are not valid ones. If the transaction id shows a valid block then with you can dump private key to import into a working wallet:

Code: [Select]
memorycoind dumpprivkey ADDRESS
and the address from the transactions list. Import is done with "memorycoind importprivkey KEY".
« Last Edit: January 04, 2014, 01:35:58 AM by FreeTrade »

Offline Montaxx

  • Moderator
  • Full Member
  • *****
  • Posts: 76
    • View Profile
Re: [MMC] Solo miner compilation guide
« Reply #1 on: December 21, 2013, 09:43:14 PM »
Great Guide ! I stickyed this. Do you have a MMC Address for tips ? :)

Offline h0g0f0g0

  • Jr. Member
  • **
  • Posts: 48
    • View Profile
Re: [MMC] Solo miner compilation guide
« Reply #2 on: December 21, 2013, 09:49:07 PM »
Yes, I have some :)

MPjCEABQw6WEZY59zpikjMdr7SJKJnV82n

Cheers

Offline cass

  • Hero Member
  • *****
  • Posts: 4329
  • /(┬.┬)\
    • View Profile
Re: [MMC] Solo miner compilation guide
« Reply #3 on: December 21, 2013, 11:49:35 PM »
thank you very mcuh for your how to!

i get an error when startting and watching

Code: [Select]
/run-memorycoind: line 1: 32173 Aborted                 (core dumped) memorycoind > /dev/null 2>&1
Any suggestion to solve this issue!? Help appreciated
Thx
█║▌║║█  - - -  The quieter you become, the more you are able to hear  - - -  █║▌║║█

Offline h0g0f0g0

  • Jr. Member
  • **
  • Posts: 48
    • View Profile
Re: [MMC] Solo miner compilation guide
« Reply #4 on: December 22, 2013, 08:14:46 AM »
Try to run it directly with

Code: [Select]
memorycoind -daemon
and post full error message. What distro and version?

Offline FreeTrade

  • Moderator
  • Hero Member
  • *****
  • Posts: 700
    • View Profile
Re: [MMC] Solo miner compilation guide
« Reply #5 on: December 22, 2013, 10:13:38 AM »
Yes, I have some :)

MPjCEABQw6WEZY59zpikjMdr7SJKJnV82n

Cheers

Thanks so much for the excellent and detailed guide. Tip is on its way.
“People should be more sophisticated? How are you gonna get that done?” - Jerry Seinfeld reply to Bill Maher

Offline brucemj

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: [MMC] Solo miner compilation guide
« Reply #6 on: December 25, 2013, 03:05:47 PM »
memorycoind -daemon

 MemoryCoin server starting
: Error loading block database.
Do you want to rebuild the block database now?
memorycoind: db/version_set.cc:715: leveldb::VersionSet::~VersionSet(): Assertion `dummy_versions_.next_ == &dummy_versions_' failed.

can you help me ? thx

Offline h0g0f0g0

  • Jr. Member
  • **
  • Posts: 48
    • View Profile
Re: [MMC] Solo miner compilation guide
« Reply #7 on: December 25, 2013, 03:48:52 PM »
Make sure you are using the latest version of the miner and run

Code: [Select]
memorycoind -reindex &
Then a database will be reindexed and mining starts again. Best if you ran reindex with option "gen=0"in your config file.
Start mining with:

Code: [Select]
memorycoind setgenerate true

Offline Chronos24

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: [MMC] Solo miner compilation guide
« Reply #8 on: December 25, 2013, 10:06:28 PM »
Great guide.

Offline n00b2013

  • Jr. Member
  • **
  • Posts: 31
    • View Profile
Re: [MMC] Solo miner compilation guide
« Reply #9 on: December 26, 2013, 10:15:54 PM »
this is one impressive, detailed guide, nice work  !!!

Offline SpecialFX

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: [MMC] Solo miner compilation guide
« Reply #10 on: December 28, 2013, 01:55:47 PM »
nice, howd ya figure out all that?

is it ok to paste the multiline commans in terminal?

Offline SpecialFX

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: [MMC] Solo miner compilation guide
« Reply #11 on: December 28, 2013, 02:01:38 PM »
on step 4 I am a bit unsure about this?

addnode=IP_ADDRESS

when do I type than it?

Offline seraphim

Re: [MMC] Solo miner compilation guide
« Reply #12 on: December 28, 2013, 02:04:25 PM »
Code: [Select]
echo 'server=1
gen=1
logtimestamps=1
rpcallowip=127.0.0.1
rpcuser=memorycoinrpc
rpcpassword=SOME_SECURE_PASSWORD' > .memorycoin/memorycoin.conf

this creates a new memorycoin.conf with the lines before.
just put the addnodes in between somewhere
Meet you on STEEM

Offline SpecialFX

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: [MMC] Solo miner compilation guide
« Reply #13 on: December 28, 2013, 02:15:45 PM »
thanks :), what is the best node?

Offline SpecialFX

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: [MMC] Solo miner compilation guide
« Reply #14 on: December 28, 2013, 02:22:29 PM »
./run-memorycoind
gives permission denied

 

Google+