Skip to content

ebloc/eBlocPOA

Repository files navigation

Proof-of-Authority Private Ethereum Network (eBlocPOA)

Overview

Dashboard: http://ebloc.cmpe.boun.edu.tr:3015/

Explorer: http://ebloc.cmpe.boun.edu.tr:8000/

Preinstallations

Installation Instructions for Mac

Prerequisites

sudo npm install npm pm2 -g
brew install go

Installation Instructions for Linux

Node.js and Node Package Manager (npm) installation

sudo apt-get install nodejs curl
curl -sL https://deb.nodesource.com/setup_15.x | sudo -E bash -
sudo apt-get install -y nodejs
sudo npm install pm2 -g
sudo ln -s /usr/bin/nodejs /usr/bin/node
sudo apt-get update
tar_name="go1.15.8.linux-amd64.tar.gz"
wget https://golang.org/dl/$tar_name
tar -xvf $tar_name
rm -f $tar_name
sudo rm -rf /usr/local/go
sudo mv go /usr/local
export GOROOT=/usr/local/go
export GOPATH=/usr/local/go/bin/go
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin
  • Put this line export PATH=$PATH:/usr/local/go/bin into $HOME/.profile file and do source $HOME/.profile

Go Ethereum (geth) Prerequisites

sudo apt-get install -y git build-essential libgmp3-dev golang

Do following for both Linux and Mac

Go Ethereum (geth) building from source

It is recommended to install the latest version of geth.

git clone https://github.com/ethereum/go-ethereum
cd go-ethereum/
git pull
git checkout -f tags/v1.10.16
make geth

After go-ethereum is installed, copy geth located under go-ethereum/build/bin into /usr/local/bin:

$ ls build/bin
geth
$ sudo cp build/bin/geth /usr/local/bin/
$ which geth
/usr/local/bin/geth
$ geth version | grep "Version: 1"
Version: 1.10.6-stable

Now you can jump to eBloc Setup on Linux and macOS.


eBloc Setup on Linux and macOS

Downloading

cd $HOME
git clone https://github.com/ebloc/eBlocPOA.git

cd eBlocPOA
npm install

git submodule update --init
cd eth-net-intelligence-api
git checkout master
npm install
npm audit fix --force

Create private folder

sudo mkdir -p /private

Initialize a new genesis block and definition for the network

Navigate into eBlocPOA directory.

.. warning:: Do ./init_custom.sh only once. You do not need to do it again

./initialize.sh
sudo ./init_custom.sh

Server run (Always run with sudo)

sudo ./server.sh
  • If you want to kill your server please do: sudo killall geth
  • You can keep track of output of your geth-server by running following: sudo tail -f geth_server.out
$ sudo tail -f geth_server.out
Password:
INFO [02-12|16:22:34] Imported new chain segment   blocks=1  txs=0 mgas=0.000 elapsed=503.882µs mgasps=0.000  number=111203 hash=582a44…6e15dd
INFO [02-12|16:22:49] Imported new chain segment   blocks=1  txs=0 mgas=0.000 elapsed=491.377µs mgasps=0.000  number=111204 hash=b752ec…a0725d

Client run (geth console)

./client.sh

If you are successfully connected into eBlocPOA network inside geth console; peerCount should return 1 or more, after running net command.


Create an Ethereum Account

Creating an account:

$ cd eBlocPOA
$ ebloc_path="$PWD"
$ geth --datadir="$ebloc_path" account new
Your new account is locked with a password. Please give a password. Do not forget this password.
Passphrase:
Repeat passphrase:
Address: {a0a50a64cac0744dea5287d1025b8ef28aeff36e}

Your new account is locked with a password. Please give a password. Do not forget this password. Please enter a difficult passphrase for your account.

You should see your Keystore File (UTC / JSON)under keystore directory.

[~/eBlocPOA]$ ls keystore
UTC--2018-02-14T10-46-54.423218000Z--a0a50a64cac0744dea5287d1025b8ef28aeff36e

Using Console: You can also create your Ethereum account inside your geth-client. Here your Keystore File will be created with root permission, eBlocWallet will not able to unlock it.

> personal.newAccount()
Passphrase:
Repeat passphrase:
"0x7d334606c71417f944ff8ba5c09e3672066244f8"
> eth.accounts
["0x7d334606c71417f944ff8ba5c09e3672066244f8"]

Now you should see your Keystore File (UTC / JSON)under private/keystore directory.

[~/eBlocPOA]$ ls private/keystore
UTC--2018-02-14T11-00-59.995395000Z--7d334606c71417f944ff8ba5c09e3672066244f8

To give open acccess to the keystore file:

sudo chown -R $(whoami) private/keystore/UTC--...

How to attach to eBloc Network Status

You can see your node on eBloc Network Status (http://ebloc.cmpe.boun.edu.tr:3015). Setup is done when you run ./initialize.sh. If you face with any issue please see the guide.

To Run

  • Please open stats.sh file under eBlocPOAdirectory. Write your unique name instead of mynameis.

  • .. warning:: Change DATADIR variable with path for eth-net-intelligence-api directory

  • .. warning:: geth-server should be running on the background

Finally you should run following command

./stats.sh
  • sudo pm2 show app should return some output starting with "status │ online".

Now, you should see your node on http://ebloc.cmpe.boun.edu.tr:3015.


Helpful commands on geth client

Please try following commands on your geth-client console.

Welcome to the Geth JavaScript console!

instance: Geth/v1.7.3-stable/darwin-amd64/go1.9.2
 modules: admin:1.0 clique:1.0 debug:1.0 eth:1.0 miner:1.0 net:1.0 personal:1.0 rpc:1.0 txpool:1.0 web3:1.0

> net
{
  listening: true,
  peerCount: 1,
  version: "23422",
  getListening: function(callback),
  getPeerCount: function(callback),
  getVersion: function(callback)
}

# How to check list of accounts
> eth.accounts
["0x3b027ff2d229dd1c7918910dee32048f5f65b70d", "0x472eea7de6a43b6e55d8be84d5d29879df42a46c"]

> sender=eth.accounts[0]
"0x3b027ff2d229dd1c7918910dee32048f5f65b70d"

> reciever=eth.accounts[1]
"0x472eea7de6a43b6e55d8be84d5d29879df42a46c"

# How to check your balance
> web3.fromWei(eth.getBalance(sender))
100

# How to unlock your Ethereum account
> personal.unlockAccount(sender)
Unlock account 0x3b027ff2d229dd1c7918910dee32048f5f65b70d
Passphrase:
true

# How to send ether to another account
> eth.sendTransaction({from:sender, to:reciever, value: web3.toWei(0.00001, "ether")})
"0xf92c11b6bd80ab12d5d63f7c6909ac7fc45a6b8052c29256dd28bd97b6375f1b"  #This is your transaction receipt.

# How to get receipt of your transaction
> eth.getTransactionReceipt("0xf92c11b6bd80ab12d5d63f7c6909ac7fc45a6b8052c29256dd28bd97b6375f1b")
{
  blockHash: "0x17325837f38ff84c0337db87f13b9496f546645366ebd94c7e78c6a4c0cb5a87",
  blockNumber: 111178,
  contractAddress: null,
  cumulativeGasUsed: 21000,
  from: "0x3b027ff2d229dd1c7918910dee32048f5f65b70d",
  gasUsed: 21000,
  logs: [],
  logsBloom: "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
  status: "0x1",
  to: "0x472eea7de6a43b6e55d8be84d5d29879df42a46c",
  transactionHash: "0xf92c11b6bd80ab12d5d63f7c6909ac7fc45a6b8052c29256dd28bd97b6375f1b",
  transactionIndex: 0
}

Clean the chain

sudo rm -rf /private/geth/chaindata

Some helpful links