Course Outline
1. Cryptocurrency and Blockchain
2. Delving into Blockchain
3. Bitcoin and Blockchain
4. Bitcoin Mining
5. Ethereum
6. Setting up a Private Blockchain Environment Using Ethereum Platform
7. Hyperledger
8. Setting up a Development Program Using Hyperledger Composer
9. Creating and Deploying a Private Blockchain on Multichain
10. Prospects of Blockchain
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Setting up a
Private
Blockchain
Environment
Using Ethereum
Platform
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Agenda
At the end of this session, you will be able to:
Understand Creating Smart Contracts on Ethereum Remix Browser
Define MetaMask
Describe Installing Blockchain
Perform Go Lang Installation
Explain Creating Blockchain: The Genesis Block
List genesis.json File Parameters
Explain Making Rules for Our Blockchain
Perform Mining a Blockchain
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Creating Smart Contracts on
Ethereum Remix Browser
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Creating the testrpc.sh File
• To start with, we will create a file named
“
testrpc.sh.
“
• The testrpc.sh file contains account details.
Details like account numbers and their
balance can be altered as per your choice.
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Creating the testrpc.sh File
• To create a file in Ubuntu execute the following
command:
“
• Cat > sample.txt (Just replace the “sample.txt” with the
name you want to use for your file)
• A file with the specified name will be created
Example:
Cat > testrpc.sh
“ After the above command, the cursor will move to the
next line, allowing you to enter contents in the file.
Note: The testrpc.sh file is already there in the VM provided. So,
you don’t have to create another file.
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
What is a testrpc.sh file?
• testrpc is a Node.js based Ethereum client for testing
“
and development
• It uses ethereumjs to simulate full client behavior and
make developing Ethereum applications much faster.
• It also includes all popular RPC functions and features
(like events) and can be run deterministically to make
“
development a breeze.
• testrpc is written in JavaScript and distributed as a
Node package via npm.
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Executing the testrpc File
• To execute the testrpc file, run the following command: testrpc
• Gets executed and testrpc will be listening on localhost:8545
Private keys of
the accounts
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Starting the Block Explorer
• Click on the drop-down icon
• To launch the block explorer use the following command: npm start
• This command will install all packages and will launch the block explorer at port 8000
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Block Explorer Window
To view the block explorer:
• Open the web browser in your VM (chrome is recommended)
• Type: localhost:8000 in the browser tab and hit enter
• You will see the screen shown below
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Remix IDE in Ethereum
• Remix is known as the Solidity Browser. It is a
web-browser-based IDE that allows you to
write Solidity smart contracts, and then deploy
and run those from a browser.
• Download it from https://remix.ethereum.org
To open the browser:
• Open a new tab in your browser and search
“Remix Ethereum”
• Click on the first link that pops up
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Remix Solidity Browser Dashboard
The screen image shown below is the Solidity Browser.
This is a
sample of a
smart
contract.
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Selecting the IDE Environment
Now, the first thing we need to do
is to select the environment for our
solidity browser.
• Click on the drop-down icon near
in front of the “Environment”
• Three options will be shown
• Select “Web3 Provider” option
from the list
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Confirm the Web3 Provider Option
It will ask for your confirmation to connect to an ethereum node
• Click OK on the pop up box
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Selecting the Web3 provider Endpoint
Next, it will ask for the Web3 Provider endpoint. This can be any address, like the ethereum
blockchain server or the address of a different machine you wish to connect to, or it can be the
localhost, which was generated via testrpc.
• Since we are using the
browser for the
development and testing
purpose, our endpoint will
be the local host on the
port where our testrpc is
listening.
• So, here, just click OK
button on the pop.
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Browser Restricts Web3 Connection
On clicking on the OK button (in previous slide), the window shown below will pop up, saying the
connection to the local host is restricted by the browser.
The icon shown in red
indicates the restriction.
Let’s see, how we
resolve it.
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Load Unsafe Script
As we have seen, the browser is restricting the connection. It is because of the unsafe script.
• As you click on the icon, it
opens up with the
message “The page is
trying to load scripts from
unauthenticated sources.”
Click on “Load
• Select the Load unsafe unsafe scripts” to
scripts option resolve the issue.
• This will now connect you
to the local host port 8545.
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Set the “Environment”
The connection with the port is established as you can see the account balances in the window
shown below. However, we need to setup the “Environment” again.
• When you select Load
unsafe scripts (as done
previously), the page
reloads and the
environment gets changed. Click on the box
• Now to change it to “Web3 and select “
Provider”, just click on the web3provider”
option
drop-down box and select
the Web3 Provider option,
as done previously.
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Connection is Now Successful
The browser indicates a “Not secure” connection. However, it connects to the local host port.
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Creating a Smart Contract
Now that we are connected to the port, we can create our very first smart contract.
To create a smart contract:
• Select the account that
you want to use to push
your contract Click on the drop-
• After selecting the down box to
account, click on the check the account
Create button balances
Click here to create
the contract
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Contract Gets Created
The contract gets created and compiled.
• The contract gets created
and the balance of the
account used to create the
contract goes down by
some value.
• It is the value of ether
which gets exhausted as a
gas for pushing the
contract.
Transaction cost as
gas used
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Check the Block That Includes Your Transaction
You can check the block details where your transaction is included.
• Block details can be
checked in testrpc which is
kept running in the other
terminal
• And also by listening to the
transactions
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Transaction Reflecting in the Block Explorer
The transaction gets included in block explorer and can be seen after you refresh the page.
• You can get the details of
the transaction by clicking
on the block number.
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Block Details in the Block Explorer
The block contains all details of the transaction.
• The transaction gets
included in the block
explorer.
• You can get the details of Account address
the transaction by clicking
on the block number.
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Transaction Details
Clicking on the account address displays the transaction details.
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Check for the Function Execution of the Contract
We can also check the function execution of the smart contract.
• Here, our contract uses
two functions: get() and
set().
• We can alter the value of
set() function and a new
transaction will get
created. get() function
• In the indicated set()
method, the value is set
to 10.
set() function
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Checking Contract Details
Contract details can be checked by clicking the contract details.
The list contains all
details of the
transaction; you can
scroll down to check
various properties.
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
MetaMask
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
MetaMask “
MetaMask brings Ethereum to the browser.
Let’s see how to install MetaMask as a chrome
“
extension.
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
MetaMask
• MetaMask is a bridge that allows you to visit the
distributed web of tomorrow in your browser today.
“
• It allows you to run Ethereum DApps right in your
browser without running a full Ethereum node.
• MetaMask includes a secure identity vault, providing a
“
user interface to manage your identities on different
sites and sign blockchain transactions.
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Installing MetaMask
To install
05MetaMask as a chrome browser, go to chrome, search “MetaMask” and click on the first link.
Click on this link
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Add to Chrome
05 the MetaMask site opens, click on Add to Chrome.
As 06
Click here
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Add Extension
05 06
It will prompt you to Add extension.
Click here
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
MetaMask Extension Gets Added to Chrome
05
MetaMask gets added as an extension to the chrome. You can see the icon on the top right corner. 06
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Accepting “Terms of Use”
05
Click on the MetaMask icon. It will prompt you to Accept “Terms of Use”. 06
Scroll down and
click on this
button
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Create Password
05 06
Now, create and confirm your password.
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Vault Gets Created
• The vault is now created. Save the seed phrase (12 words) that is displayed in your vault. Keep it safe
05 06
and confidential.
• This seed phrase can be used to restore all the accounts you have ever created.
Click here once you have
copied those words
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
MetaMask Is Now Ready to Use
• With05MetaMask, you can create multiple accounts and can use them for transactions. 06
• Also, MetaMask allows to switch between networks.
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Installing Blockchain
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Installing Blockchain “
Now, we are going to develop our own private
“
Blockchain. Let’s start.
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Developing a Private Blockchain
1 1 2 2
Register an account
Install Go-ethereum on the Ethereum
Blockchain
3
Create an
autonomous Private
4 Blockchain
Perform transactions
internally
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Installing the Blockchain
Download Ethereum code and compile it
sudo apt install git // installing git in case not
Cloning Geth Code installed already
sudo apt –get update
sudo apt –get upgrade
Creating a Genesis Block git clone https://github.com/ethereum/go-ethereum cd
go-ethereum
git tag
Validating and Mining Ether git checkout tags/v1.6.7 -b EdurekaEthereumV1.6.7
//Checking the branch git
Making Rules for Our branch
Blockchain
//Install golang
make all
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Cloning GIT Repository
First step is to clone a Go-ethereum Repository.
To clone a Go-ethereum
Repository, execute the
following command:
git clone
https://github.com/ethereum/g
o-ethereum
Note: Cloning of Geth will take some time, so please be patient.
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Check the Files in Go-ethereum
Once the Go-ethereum is cloned, check for the files present in the Go-ethereum directory.
To check for the files in the
Go-ethereum, execute the
following command:
cd go-ethereum ls
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Go Lang Installation
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Go Lang Installation “
Before we begin the Blockchain execution, we need
to install the Go Language as part of the system, as
“
Go-ethereum (Geth) is the official Go Lang
implementation of the Ethereum protocol.
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Go Lang Installation
To install Go Lang, follow the below steps:
Step 1: Visit the site: https://golang.org/dl/
Step 2: Check for the package that meets your system requirements and download it
Note: Since I am
using 32 bit Ubuntu, I
have downloaded a
32 bit file.
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Various Packages in Go Lang
There are various versions of Go Lang available on the site, check for the system requirements and
download accordingly.
I am using the
32 bit version of
Go Lang
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Where will the file get downloaded?
By default, the file will be in the Downloads folder. The name of the file will be go1.8.3linux-i386.tar.gz
The file is
present in
Downloads
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Extracting & Installing the File
Now, we have to extract the file and install it as part of the system.
To extract and install the file, we need to execute the following command:
sudo tar –xvf go1.8.3.linux – 386.tar.gz
Few points to remember before
executing this command:
• Ensure that the file name you are
giving is correct.
• Also, ensure that you are executing
this command as a superuser
(sudo) because this requires
administrative privileges.
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Go Lang Gets Extracted & Installed
After giving the password, the execution starts and Go starts getting extracted and installed.
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Moving the File to a Specific Location
The installed file is moved to /usr/local. This is mainly to ensure that I have ease of access to Go.
To move it to the specified folder, we need to execute the following command:
sudo mv go/usr/local
On executing the above
command, the file would
be moved.
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Checking Whether the File Has Moved
We should always check whether the file has moved to the specified folder.
To check whether the file is moved, you can go to the directory and execute the command:
ls
On executing the above
command, we would be able
to check whether the file has
been moved.
Note: After checking that the file is present, close the terminal.
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Adding Environment Variables to Variables List
Now, we need to add the environment variables to the list of variables.
For doing so, we need to execute the following command:
sudo gedit .bashrc
The above command opens
the .bashrc file.
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Adding Environment Variables to Variables List
Here, you need to add three lines:
export GOROOT=/usr/local/go (This is the location where Go is moved to. Once the Go root is set,
we need to specify the working folder.)
export GOPATH=$HOME/Projects/Proj1 (This can be set to any location.)
export PATH=$GOPATH/bin:$GOROOT/bin:$PATH (This sets the Go path and Go root in our
environment variables list.)
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Files Added in .bashrc
Once you have added the files, save .bashrc and close it.
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Restarting the .bashrc File
To restart the .bashrc file, use the following command:
source .bashrc
The above command will restart
the .bashrc file.
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Checking If Go Lang Has Been Installed Correctly
To ensure that Go Lang has been installed correctly, execute the following command:
go version
The above command will
return installed version of
the Go Lang if you have
followed the installation
steps correctly.
The Go version is
installed correctly.
Now, close the
terminal window.
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Executing the “make all” Command
Now, finally, we have to execute
the “make all” command.
Open a new terminal.
Here’s what you have to do:
Step 1: Go to cd go-ethereum
Step 2: Execute the make all
command
make all
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Executing the “make all” Command
It basically test Git to build the
target file as per the input.
This command (make all) is on
execution. It takes time, so
please be patient.
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Creating Blockchain: The Genesis Block
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Creating Blockchain: The Genesis Block “
With this, we have successfully completed the
“
first part of setting up the Blockchain. In this
step, we have successfully cloned Geth.
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Creating Blockchain: The Genesis Block
Cloning Geth Code
cd go-ethereum
Creating a Genesis Block //Creating Genesis
(first) block mkdir
genesis
Validating and Mining Ether cd genesis
gedit genesis06072017.json
Making Rules for Our
Blockchain
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Genesis Block “
The genesis block is the first block in the
Blockchain. It contains rules with respect to
“
the Blockchain.
Creation of the genesis block is a two step process.
Step 1: The genesis folder is created.
Step 2: The genesis.json file is added to it.
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Creating the Genesis Folder
In our Go-ethereum folder, we’ll be creating a genesis folder.
To create the genesis folder, execute the following command:
mkdir genesis
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Creating a New json File
Now, we go inside the genesis folder and create a new json file with all the rules of the Blockchain.
To create the json file, execute the following command:
gedit genesis3.json
In the above command, genesis3
is just the file name, and it can
be anything of your choice.
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Genesis.json File Parameters
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Genesis.json File Parameters “
Before we write the details in the json file we
just created, let’s first have a look at the
“
genesis block parameters.
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Genesis Block Parameters
nonce: A 64-bit hash which, combined with the mix-hash, proves that a sufficient amount of computation has been carried
out on this block
timestamp: A scalar value equal to the reasonable output of Unix time() function at this block inception
mixhash: A 256-bit hash which, combined with the nonce, proves that a sufficient amount of computation has been carried
out on this block
difficulty: A scalar value corresponding to the difficulty level applied during the nonce discovering of this block
alloc: Allows defining a list of pre-filled wallets. It is an Ethereum specific functionality to handle the “Ether pre-sale” period
parentHash: The Keccak 256-bit hash of the entire parent block header (including its nonce and mixhash)
extraData: An optional free, but maximum 32-byte long, space to conserve smart things for ethernity
gasLimit: A scalar value equal to the current chain-wide limit of Gas expenditure per block
coinbase: The 160-bit address to which all rewards (in Ether) collected from the successful mining of this block have been
transferred
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Making Rules for Our Blockchain
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Making Rules for Our Blockchain “
In a genesis block, you define a set of rules for
a Blockchain, which depends on the
“
parameters we just discussed.
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Making Rules for Our Blockchain
Cloning Geth Code
Creating a Genesis Block
Validating and Mining
Ether
Making Rules for Our
Blockchain
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
“Genesis.json” file
The code we just saw in the previous slide is to be added as part of the genesis block.
So, just add the code and
save the file.
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Starting the Blockchain “
With that, we are done with the third step of
our Blockchain development process. Now, it’s
time to initialize our Blockchain.
“
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Starting the Blockchain
Cloning Geth Code //Initializing the Blockchain
/home/blockchain/go- --datadir
Creating a Genesis Block ethereum/build/bin/geth init ~/ethereum/net3
genesis/genesis1.json
//Starting the geth console --datadir
Validating and Mining Ether
/home/blockchain/go- ~/ethereum/net3/
ethereum/build/bin/geth
Making Rules for Our --networkid 3 console
Blockchain
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Starting the Blockchain
Our next step is to start our Blockchain.
For starting our Blockchain, we need to execute the following command:
/home/blockchain/go-ethereum/build/bin/geth --datadir/intellipaat
~/ethereum/net3 init genesis/genesis1.json
In the above command, /intellipaat is the user directory which can be replaced by the user that you
have specified. Here in our case, it is intellipaat.
This is the data directory of the genesis file.
~/ethereum/net3 init genesis/genesis3.json
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Starting the Blockchain: Executing the Command
Executing the command to start our Blockchain.
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Starting the Geth Console
Now that we have initialized the Blockchain, we have to use the Geth console to perform any
operation on it.
Execute the following command to start the Geth console:
/home/edureka/go-ethereum/build/bin/geth --datadir
~/ethereum/net3/ --networkid 3 console
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Starting the Geth Console
The Geth console has been started after executing the command (in the previous slide).
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Mining the Blockchain
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Mining the Blockchain “
This brings us to the last step of setting up the
Blockchain where we’ll be executing a set of
“
commands to create accounts, mine transactions and
check the balance of the miners.
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Mining the Blockchain
Cloning Geth Code • > personal.newAccount()
• > eth.accounts
Creating a Genesis Block • > eth.blockNumber()
Validating and Mining Ether • > miner.start()
• > miner.stop()
Making Rules for Our • > eth.blockNumber()
Blockchain • > eth.getBalance("0x5f069120a76ac078a46b3ce94c6a350b330b68b8")
• > exit
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Discussing Commands
personal.newAccount(): Creates a new account as part of your blockchain which has a specific wallet
attached to it
eth.accounts: Helps you check various accounts which are part of your blockchain
eth.blockNumber(): Helps you identify the number of blocks that are part of your blockchain
miner.start(): A function used to start the mining process
miner.stop(): A command that stops the mining process
eth.blockNumber(): A command that tells you which block number you are at after performing the
mining operation
eth.getBalance("0x5f069120a76ac078a46b3ce94c6a350b330b68b8"): A command used to check the
ether balance in the specified account
exit: A command that exits the Geth console
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Executing Commands: Creating a New Account
As discussed, the first command we’ll be executing is to create a new account .
To create a new account, execute the following command:
personal.newAccount()
The above command creates a
new account on your
Blockchain. To create multiple
accounts, you have to execute
the same command.
The new account is created, and an address is assigned
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Executing Commands: Checking Accounts
Now, let’s see what are the accounts present in your Blockchain.
To check all accounts, execute the following command:
eth.accounts
This command displays the
existing accounts that are
created on this Blockchain.
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Executing Commands: Current Block Number
Let’s find out the latest block number.
To find out the current block number, execute the following command:
eth.blockNumber()
Before executing the above
command, make sure that you
have multiple accounts
created.
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Executing Commands: Starting the Mining Operation
Now that we have multiple accounts on our Blockchain, let’s start the mining process.
To start the mining process, execute the following command:
miner.start()
The mining process gets
initiated, and it starts allocating
the resources.
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Mining Starts
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Executing Commands: Terminate Mining
After running the mining process for quite some time now, let’s stop the mining process.
To stop the mining process, execute the following command:
miner.stop()
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Executing Commands: Current Block Number after Mining
Let’s check the current block number after the mining process.
To check the current block number, execute the following command:
eth.blockNumber()
The current block
number after mining
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Executing Commands: Checking Balance
Now, lets check the balance of the accounts after the mining process.
To check the balance, execute the following commands:
• Execute eth.accounts to view
all accounts on the Blockchain
• Execute eth.getBalance
(Address of the ethereum) to
get the balance
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Mining the Blockchain “
You have successfully setup and executed your own
“
Private Blockchain Network.
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.
Thank You
Email us: support@intellipaat.com
Visit us: https://intellipaat.com
© Copyright, Intellipaat Software Solutions Pvt. Ltd. All rights reserved.