Skip to content

Instantly share code, notes, and snippets.

@abmohan
Last active May 19, 2019 13:19
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save abmohan/f7c3dfecbffb996e37dea052fac0fb9e to your computer and use it in GitHub Desktop.
Set up a cloud CLAM Coin Digging/Mining Client on Ubuntu

Cloud CLAM Digger/Miner on Ubuntu

CLAMs are awesome!

Proof of stake, rather than proof of work, allows for everyone who's chipped in to receive a piece of the pie.

Follow the steps below to set up your own cloud CLAM digger (i.e. the equivalent of a bitcoin miner) on Digital Ocean

Setting up Digital Ocean

If you'd like to run this in the cloud:

  • Sign up for Digital Ocean using referral code 9ff7327d7d00. You'll get $10 in credit once you've spent $25.
  • On your local machine, create an SSH key
  • Create a Droplet:
    • Select the latest version of Ubuntu for your distribution image (currently v16.x)
    • Select the cheapest option available that has at least 1GB of memory (currently USD $10/month)
    • Paste the SSH key created above into your Digital Ocean droplet
    • Make a note of your droplet's IP address

Login

  • Connect to your droplet:
    • On OS X or Linux, simply type ssh root@<your droplet's IP address> (e.g. ssh root@24.101.102.103) in a terminal window
    • On Windows, use Putty

Install Dependencies

Update the dependencies:

apt-get --assume-yes update
apt-get --assume-yes upgrade

Install build requirements:

sudo apt-get --assume-yes install git build-essential libtool autotools-dev autoconf pkg-config libssl-dev libboost-all-dev

CLAM (and bitcoin, and other cryptocurrencies) rely on Berkeley DB 4.8. Install it:

sudo add-apt-repository ppa:bitcoin/bitcoin -y
sudo apt-get --assume-yes update
sudo apt-get --assume-yes install libdb4.8-dev libdb4.8++-dev

Install the CLAM client

Digital Ocean may require a temporary swap file for the current session. This will be cleared when the droplet is rebooted

You can skip this step if you're not on Digital Ocean

sudo fallocate -l 2G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile

Create a workspace folder to work out of:

cd ~
mkdir workspace
cd workspace

Clone the latest stable source code for the CLAM client:

git clone https://github.com/nochowderforyou/clams.git

Build the code:

cd clams
./autogen.sh
./configure
make
make install

Configure CLAM:

  • Run clamd and take note of the password
  • Run sudo nano /root/.clam/clam.conf and paste the following into the file (replacing the password and the email, as appropriate):
rpcuser=clamrpc
rpcpassword=<the password you copied earlier>
alertnotify=echo %s | mail -s "Clam Alert" <your email address>
  • Make clam.conf owner-readable-only: chmod 600 /root/.clam/clam.conf

Bootstrap the CLAM client

@dooglus created a bootstrap file that can be used to speed up the syncing process:

cd /root/.clam
wget https://s3.amazonaws.com/dooglus/bootstrap.dat

Run The CLAM client

You're ready to go! Start the CLAM client in daemon mode by typing: clamd

I recommend running the client within a tmux session:

tmux
nohup clamd &

This way, if your SSH connection gets terminated, you can get back in with tmux attach

If you'd like to view the progress in another tmux pane:

  • hit ctrl+b followed by % (a percentage sign)
  • enter tail /root/.clam/debug.log

Check that CLAM client is still running:

Not sure if clamd is still running? Type:

ps aux | grep clamd

You should see something like this:

root      6095 99.8 54.3 2091068 1111256 pts/3 SLl  Nov24 1270:34 clamd
root      8605  0.0  0.1  11748  2172 pts/0    S+   01:26   0:00 grep --color=auto clamd

You should see a line like the first one, with 'clamd' on the right end of the line.

Interacting with the CLAM daemon

Run clamd help to see a list of command available for use.

  • clamd getinfo show basic info on your wallet (including total spendable balance)
  • clamd listaddressgroupings - show all addresses with a balance
  • clamd sendtoaddress <recipient_address> <amount> - send a certain amount of clam counts to a particular recipient
  • clamd getaddressesbyaccount '' - list all your receiving accounts

Comments, criticism, feedback? Please let me know

@manglematter
Copy link

Hello abmohan, many thanks for laying this out so clearly. The only issue I had was having to restart the clamd process. The bootstrap process wouldn't synch for me until I stopped and restarted the client. Eg. clamd stop. From what I have seen in the forums, I'm not the first to run into this problem. You might want to mention it in the directions. Thanks again!

@tryphe
Copy link

tryphe commented Jul 29, 2017

Nice job @abmohan! Nice to see you've got it all working.

Just to clarify the trouble in the comment above; it's standard procedure to restart the daemon to load the bootstrap, there's no other way. You might want to suggest that people download the bootstrap first and place it in ~/.clam before running.

Feel free to add this line to crontab -e or your own script to log the balance. This will print the total (mature + immature) balance every day:
@daily echo $(date) - $(clamd getbalance '*' 0 false) CLAMs >> /path/to/mining-clams.log

I think NTP should also be mentioned here somewhere, as time accuracy is crucial for staking. But for the sake of being on DigitalOcean, I'm not sure the time will drift from the host.

Copy link

ghost commented Sep 15, 2017

Ver nice, impressive. Was looking for this. How do we get clam address? how to create one?

I created this account to put all the info about CLAMS, and there i found this. Thanks

@abmohan
Copy link
Author

abmohan commented Jan 24, 2018

@manglematter, @clamcoin - thank you. I may move this to medium.

@tryphe - appreciate it! You've been my CLAM mentor :-) I was MIA for the better half of 2017 but am getting back into the CLAM ecosystem. Hoping to see more of you guys around, soon.

@wladston
Copy link

I'm firing up a node to play with POS. Do I need to buy any Clam coins and send to the node before it can generate coins? If so, what's the minimum, and what is the expected return? @manglematter @clamcoin @tryphe @abmohan

@abmohan
Copy link
Author

abmohan commented Jan 25, 2018

@wladston, looks like @tryphe answered you on IRC, but for the sake of anyone else who has the same question:

Do I need to buy any Clam coins and send to the node before it can generate coins?

You need to have CLAMs to stake more CLAMs. You can obtain them initially by either digging or buying

If so, what's the minimum, and what is the expected return?

There's no minimum. At the moment, 1000 CLAMs will lead 1 CLAM to be staked per day, on average.

@GreenClam
Copy link

@abmohan is there anything we need to setup or this will automatically start mining clams my balance stills says 0.0000000

@RiskingTime
Copy link

you need to buy some clams to stake them, you can't start at zero and expect to receive clams by mining, clams are based on a proof of stake mining method

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment