How to deploy node js code in heroku?

To use Heroku CLI it requires Git, before get starting with Heroku make sure Git was installed. Once installed, you can use the heroku command from your command shell.

In commandprompt, login with your heroku logins.

$ heroku login
Enter your Heroku credentials.
Email: **********

By using the below commands make sure you have installed all the requirements.

$ node --version
$ npm --version
$ git --version

Create an app on heroku and push the code to it.

$ heroku create

Usually we use the git push command to push our code from local repository to server. we can use the same to push our code to heroku.

$ git push heroku master

once deployed we can open the website using,

$ heroku open

How to use cookies in PHP 7


A cookie is used to identify a user. Cookies are text files stored on the client computer and they are kept of use tracking purpose.

PHP transparently supports HTTP cookies. Browser stores this information on local machine for future use. Server script sends a set of cookies to the browser. For example name, age, or id etc.

A cookie is created with the setcookie() function. Using PHP, you can both create and retrieve cookie values.


setcookie (name, value, expire, path, domain, secure, httponly);  


Setrawcookie(name, value, expire, path, domain, secure, httponly);  

Setrawcookie() is to send a cookie without url encoding the cookie value (for PHP 5, PHP 7)

Only the name parameter is required. All other parameters are optional.

Example Scripts

Create Cookies:

$cookie_value = 'Test_cookie';

setcookie("TestCookie", $value); /* TestCookie is Cookie Name */
setcookie("TestCookie", $value, time()+3600);  /* expire in 1 hour */
setcookie("TestCookie", $value, time()+3600, "/~rasmus/", "", 1);

Retrieve Cookies:

// Print an individual cookie
echo $_COOKIE["TestCookie"];

// Another way to debug/test is to view all cookies

Edit Cookies:

if(!isset($_COOKIE[$cookie_name])) {
    echo $cookie_name . "' is not set!";
} else {
    echo $cookie_name . "' is set!<br>";

   /*Again Set Cookie value to updated (New) value */

   setcookie($cookie_name, 'changed value ', time() + (86400 * 30), "/");
    echo "Value is: " . $_COOKIE[$cookie_name];

Delete Cookies:

When deleting a cookie you should assure that the expiration date is in the past.

// set the expiration date to one hour ago
setcookie("TestCookie", "", time() - 3600);
setcookie("TestCookie", "", time() - 3600, "/~rasmus/", "", 1);

How to Install Blocksci and Trouble shooting it.

Installing Blocksci

Requirements :

If you don’t have enough memory it won’t install easily and

  • Cmake version should be 3.9
  • GCC and G++ should be 7 version

Complete instruction to install Cmake 3.9, GCC, G++ :

If the official manual didn’t work you could follow the below steps:

  • sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
  • sudo apt-get update
  • sudo apt install libtool autoconf libboost-filesystem-dev libboost-iostreams-dev
    libboost-serialization-dev libboost-thread-dev libboost-test-dev libssl-dev libjsoncpp-dev
    libcurl4-openssl-dev libjsoncpp-dev libjsonrpccpp-dev libsnappy-dev zlib1g-dev libbz2-dev
    liblz4-dev libzstd-dev libjemalloc-dev libsparsehash-dev python3-dev python3-pip
  • sudo apt-get install g++-7
  • install cmake 3.9 or higher instead of 3.5 (the cmake 3.5 version installed by apt-get install) (or follow this link to remove old version of cmake and get the new version.)
  • sudo update-alternatives –install /usr/bin/gcc gcc /usr/bin/gcc-7 60 –slave /usr/bin/g++ g++ /usr/bin/g++-7
  • git clone
  • cd BlockSci
  • mkdir release
  • cd release
  • cmake -DCMAKE_BUILD_TYPE=Release ..

Install make :

  • sudo make install
  • cd ..
  • sudo -H pip3 install -e blockscipy (this takes around 2 hours)


How to write a clean code – 6 Tips

This is a tiny post which talks about writing a clean code for a fresher who is trying hard to get success in the IT Industry.

1) Use the meaningful variable names


2) Adding comments is one of the good habits. write comments for every code modifications.

3) Code scouting – When picking up the new code from the Internet, Take some time to read it and try to add methods or split the required functionalities.

4) Functions and sub-functions. Make sure functions are doing its job that its meant to do.

5) Testing – Unit testing is very important, testing the functionality and isolation intensively.

6) Final tips are Practice, Practice, Practice.

Goog Luck!

Installing Litecoin cryptocoin data and deploying its blockchain server in CentOS7


Download the above tar file and extract it using following commands
tar xvf litecoin-0.16.0-x86_64-linux-gnu.tar.gz

Starting a litecoin server
Here, first time you need to reindex the whole chain using -reindex command
First time command: ./litecoind –txindex -daemon -reindex

litecoind -server -txindex -daemon -rpc -rpcbind= -rpcuser=theone -rpcpassword=pass123 -rpcport=9332

The above command lets you to download the blocks continously and you can access the server private data using RPC API calls.

Stopping a litecoin server
litecoind stop
if the above command doesnt work
killall -9 litecoind

Litecoin reference (params)

It should automatically download the blocks in the root

Will keep you updated with more commands.


How to Secure Your Social Media Accounts

According to a recent study it was found that we are spending approximately 2 hours in social media every day. The most popular social media platforms have billions of users, and the number keeps getting bigger every year.

Previously the social media platform was considered as a medium to get connected with other people. Now enterprises see them as a valid advertising tools. We can see most android applications are using major social media accounts to validate user identity.

Here are some tips for keeping your accounts secure:

Personal Accounts :

  1. Close your accounts that you’re not using. Hackers can leverage these forgotten account and access other accounts linked to it, like your email,mobile number etc.
  1. Before signing in to any application via your social media login, kindly check if this type of access is necessary.
  1. Please change your password often. And make sure it is somewhat complex or unique.
  1. Keep your mobile app updated. Latest versions with updated security features may protect you from the newest known threats.
  1. If any links or mails seems to be spam kindly report the account as spam. If enough people take the same action, networking service can remove the account.
  1. Use unique email (not your personal email) for all social media account. If possible, create a whole new email specifically for social media accounts so that if you are compromised, the hackers won’t have access to any valuable information.

    Corporate Accounts :

    Now-a-days social media forms the better marketing place for enterprises. They use company’s social media to promote their own brand, gain followers, or even spread a specific message.

  1. Monitor your social media regularly.
  1. Limit access to only the necessary people.
  1. Make sure you won’t share any confidential details in the social media pages.
  1. Always be aware aware of the latest security solutions.
  1. Change your password frequently.

Installing Parity, Geth and configuring CentOS 7 to deploy a smart contract (using Ropsten testnet)

Installing Python 3.6 on CentOS 7

sudo yum install

sudo yum install python36

python3.6 -V

After installing Python3.* version. it’s time to install PIP.

yum -y update

Then let’s install python-pip and any required packages:

yum -y install python-pip

There are many open source GIT projects to deploy smart contracts such as Zepplin(, TokenmarketICO (
If you need a framework with absolute test cases, migrations. You should choose Truffle (
Truffle is Ethereum framework where you can create a Smart contract, Compiling it and deploy it on testnet or testrpc. (Ganache)

In this tutorial, We will see deploying a smart contract using Tokenmarket ICO. Follow this link to install the Github contents and required libraries.

Set the environmental varial PKG_CONFIG_PATH
to check your pkg-config path using ‘whereis pkgconfig’ commmand and modify as per your installation.

export PKG_CONFIG_PATH=/usr/lib/pkgconfig

pip install –upgrade cffi

yum install python36-devel

yum install openssl-devel

Installing SOLC compiler

python3.6 -m solc.install v0.4.16

Installing Parity for CentoOS 7 

The following 2 commands should Install the Parity and its dependencies

$ bash <(curl -kL)

yum install openssl libssl-devel libudev-devel

Parity command to start the Ropsten node and sync with our server

parity -l 5 –chain ropsten –bootnodes “enode://20c9ad97c081d63397d7b685a412227a40e23c8bdc6688c6f37e97cfbc22d2b4d1db1510d8f61e6a8866ad7f0e17c02b14182d37ea7c3c8b9c2683aeb6b733a1@,enode://6ce05930c72abc632c58e2e4324f7c7ea478cec0ed4fa2528982cf34483094e9cbc9216e7aa349691242576d552a2a56aaeae426c5303ded677ce455ba1acd9d@” –rpccorsdomain “*” –unlock 0xe6bfd0a63256ad36cab82cb79b71d7d58a8c2417 –password pass.txt

To create a new account with parity

 parity account new –chain ropsten –keys-path /root/.local/share/io.parity.ethereum/keys

Important Points
1) Make sure you have unlocked the address of owner ethereum to deploy smart contract (You need to use –unlock params in Geth or Parity)

2) Install the headless chromedriver (  or yum install -f chromedriver chromium xorg-x11-server-Xvfb

Thanks for reading it. Hope this covers the important installation instruction while you stuck in the TokenmarketICO installation.

Mysql InnoDB Cluster Setup On CentOS 7 X64

Installing Mysql 5.7 in CentOS 7 X64 bit operating system

Get the yum repository from here as per your OS config.
Run the below command
yum localinstall mysql57-community-release-el7-11.noarch.rpm

Grep the mysql 5.7 releases from our OS Repo

yum repolist enabled | grep “mysql.*-community.*”

yum install mysql-community-server

After Installation, Restart the mysql 5.7 server and grep the temporary password from mysql log files.

service mysqld restart

grep “password” /var/log/mysqld.log

Login into Mysql 5.7 server using temporary password and change the root password as per your wish.

mysql -uroot -p

ALTER USER ‘root’@’localhost’ IDENTIFIED BY ‘<Password@123>’;

Mysql InnoDB Cluster Setup On CentOS 7 X64

Part 1 – InnoDB Cluster – Configuring Mysql 5.7

We have to enforce group replication configurations in the server. It is one of the mandatory pre-validation to initiate clustering setup.

Open /etc/my.cnf and paste the following lines


gtid_mode = ON


So far you have finished the Mysql configuration requirement to start Cluster set up.

Installing Mysql shell and Mysql router

You need to install the following in all the instances you wish to connect with InnoDB cluster.

yum install mysql-shell

yum install mysql-router

To access the Mysql Admin Shell. Type the following

mysqlsh –log-level=DEBUG3

mysql-js> dba.verbose=2

The above options will help us to see extended log or error messages while configuring Cluster.

Let’s say you want to connect 3 Mysql server in 3 different machine. You need to configure local instance in all the machines.

Execute the following in all machines.

mysql-js> dba.configureLocalInsance()

mysql-js> dba.checkInstanceConfiguration(‘<user1>@<hostname>:3306’)

The above command will display the message something like this.

You are right, it will show error.

Now, restart the mysql server after you did the above steps in all the machines check the instance configuration and move the clustering process.


Deploying Cluster

From the primary node. Create the Innodb cluster and add our instances into it

var cluster=dba.createCluster(‘mycluster’,{ipWhitelist:”,,″});

If you receive “The group replication applier thread was killed’” in mysqld.log messages

You can run the following query in mysql root

SET GLOBAL group_replication_ip_whitelist = ‘,,’;

Note: Check the SELinux status, Firewalld and Iptables. Make sure it does not affect your mysql connection between nodes. Using the whitelist method you should not get any errors.




You will get Status:OK output. Awesome!



If the output is START GROUP REPLICATION error you should whitelist the instance ip address in all the 3 servers.

Check the cluster status.

mysql-js> cluster.status()


“clusterName”: “mycluster”,
“defaultReplicaSet”: {

“name”: “default”,
“primary”: “”,
“status”: “OK”,
“statusText”: “Cluster is ONLINE and can tolerate up to ONE failure.”,
“topology”: {

“”: {

“address”: “”,
“mode”: “R/W”,
“readReplicas”: {},
“role”: “HA”,
“status”: “ONLINE”

“”: {

“address”: “”,
“mode”: “R/O”,
“readReplicas”: {},
“role”: “HA”,
“status”: “ONLINE”

“”: {
“address”: “”,
“mode”: “R/O”,
“readReplicas”: {},
“role”: “HA”,
“status”: “ONLINE”

Good work, You have created a InnoDB cluster network with 3 instances into it.

“statusText”: “Cluster is ONLINE and can tolerate up to ONE failure.”

The above line states that If a server is offline the other 2 servers can manage and serve the data to the client or customers.



MetaMask is an Ethereum extension for your browser. It connects you to Ethereum applications (called dApps) easily and securely. MetaMask is also a digital wallet: you can store digital currencies in it and use it.

How to use MetaMask

1. Go to and click on GET CHROME PLUGIN. Click on the ‘+ADD TO CHROME’ button to add the plugin to chrome.


2. The MetaMask plugin is displayed at the right top of your Chrome browser.

3. Then Scroll down and click Continue to agree with MetaMask terms of use.

4. It will ask to set a password. Fill in a strong password and click Create. Do NOT lose your password!

5. Safe your secret 12 word recovery key somewhere safe and click on “I’VE COPIED IT SOMEWHERE SAFE” to continue.

How to Buy Ether with Bitcoin in Metamask

1. Click BUY to buy Ether with Bitcoin or any other Altcoin

2. Now choose ShapeShift

3. Type BTC for Bitcoin, fill in your Bitcoin Refund address and click Submit.

4. Scan the QRcode or send Bitcoin to the displayed address to start the conversion. Note that the amount you can send can be limited.

Notes :

    • Don’t forget to unlock Metamask before using and lock it back immediately after using it (i.e. while still staying on the website where you used it). It will keep your data secure.
    • If you want to use MetaMask on a computer other than the one you installed it at, you’ll need the seed phrase to restore it. Also don’t forget about the password, you will need it to unlock the extension when you’re ready to use it.
    • If you want to install MetaMask extension on a new computer, use “Import existing DEN” button in create password step and follow the instructions.
    • MetaMask requires the permission to read and write to any webpage which is potentially risky.
    • As is always the case with Ethereum transactions, you will need some small amount of ether available in your MetaMask wallet to sign the transactions.
    • Better try with a small amount first and double check everything.

For more details :

Things you need to know about Ethereum

Ethereum is an open software platform based on blockchain technology that enables developers to build and deploy decentralized applications.

Like Bitcoin, Ethereum is a distributed public blockchain network. Although there are some significant technical differences between the two, the most important distinction to note is that Bitcoin and Ethereum differ substantially in purpose and capability. Bitcoin offers one particular application of blockchain technology, a peer to peer electronic cash system that enables online Bitcoin payments. While the Bitcoin blockchain is used to track ownership of digital currency (bitcoins), the Ethereum blockchain focuses on running the programming code of any decentralized application.

In the Ethereum blockchain, instead of mining for bitcoin, miners work to earn Ether, a type of crypto token that fuels the network. Beyond a tradeable cryptocurrency, Ether is also used by application developers to pay for transaction fees and services on the Ethereum network.

The thing that makes Ethereum special, as opposed to other cryptocurrency that uses blockchain technology, is that you can actually execute code on the blockchain in this same distributed way. So now, instead of just using the blockchain as a glorified ledger, you can do something like specify conditions under which a person will be paid, and once those conditions are met the money will automatically go to the person without any outside interference. People call these chunks of code ‘smart contracts’.

Smart contracts are self-executing contracts with the terms of the agreement between buyer and seller being directly written into lines of code. The code and the agreements contained therein exist across a distributed, decentralized blockchain network.Smart contracts help you exchange money, property, shares, or anything of value in a transparent, conflict-free way while avoiding the services of a middleman.

Because the rules are so secure and easy to follow, even simple devices like phones or locks can be programmed to obey what everyone has agreed to. And the way of doing this is strong enough that attackers or malfunctioning computers can’t break the rules that have been set up. So people can feel secure using Ethereum for billions of dollars, controlling ownership of their cars and houses, or other valuable things. But if there’s a situation where you want to keep track of something, and it would be a problem if someone could hack or manipulate the results, it’s a good bet that Ethereum can help! The results will look like regular websites or mobile apps, but will be completely uncheatable.  As long as it’s built right, not even the person who makes the app will have the power to break the rules they agreed to.

Proof of work :

Proof of work is a core component in the verification and generation process (mining) of Bitcoin and other alternative cryptocurrencies. It functions as a process to show that work or effort has been expended to achieve a desired set of data.Bitcoin and other cryptocurrency uses the Hash Cash function as its proof of work. Producing this proof of work involves finding valid solutions to complex mathematical problems through a series of random trial and error (brute-force) attempts using computational power.Proof-of-Work happens through miners trying to solve exceptionally difficult math problems. Finding a solution is basically a guessing game, but checking if a solution is correct is easy.

The fact that you need a serious amount of computing power, more than the average person could afford, or would even be able to work with, means the mining community is getting smaller and more exclusive. This goes against the idea of decentralization, and could potentially lead to a 51% attack. A 51% attack is when a miner, or more likely a mining pool, controls 51% of the network’s computational power. With that ability, they could invalidate valid transactions and double spend funds.That’s where PoS could really help.

Proof of Stake:

PoS happens by a miner putting up a stake, or locking up an amount of their coins, to verify a block of transactions. The cryptographic calculations in PoS are much simpler for computers to solve: you only need to prove you own a certain percentage of all coins available in a given currency. For example, if you somehow owned 2% of all Ether (ETH), you’d be able to mine 2% of all transactions across Ethereum.

Even if someone owned 51% of a digital currency, it would not be in their interest to attack something in which they have a majority share. According to game theory, those with a larger stake in a cryptocurrency should want to maintain a secure network. Any attack would only serve to destabilize the digital currency, diminishing the value of their stake.PoS would be a more fair system than PoW, as technically anyone could become a miner.

PoS offers a linear scale regarding the percentage of blocks a miner could confirm, since it’s based on that person’s stake in the cryptocurrency.

Tutorial on Ether Mining:

You can refer the below videos to gain a knowledge on ethermining.

  1. How to Mine Ether on Your PC

  1. How To Mine Ethereum with (Nvidia or AMD) in Windows 10