Full Private Blockchain
This is a guide to setting up a full private Ledgerium Blockchain on a fresh Linux machine. The blockchain ecosystem is a combination of multiple technologies that come together. The tech stacks range from (not limited to this list) GoLang, NodeJS, Ledgerium Wallet, Solidity and supporting Web3.js.

One-click Installer

ledgerium_setup.sh is a Unix bash file that downloads and deploys one Ledgerium node (consists of Geth, Tessera, and Governance docker containers) in a single click.
Run the following commands in the console.
1
> mkdir ledgerium
2
> cd ledgerium
3
> git clone https://github.com/ledgerium-io/ledgeriumsetup.git
4
> cd ledgeriumsetup
5
> ./install_dependencies.sh
Copied!
This script does the following:
  • Install prerequisite software (Docker and NodeJS) to run ledgerium tools
  • Add $USER to the docker group, to avoid using sudo before docker commands
  • Creates a docker network 'test_net'
1
sudo docker network create -d bridge --subnet 172.19.240.0/24 --gateway 172.19.240.1 test_net
Copied!
Once the dependencies are installed, run the setup script.
1
./ledgerium_setup.sh
Copied!
The setup script will pull ledgeriumtools GitHub repository, will execute npm install and starts the setup process further.
  • Enter '1' for 'full' setup
  • The script will ask whether all the block producer nodes should be set up on the local machine or distributed across multiple machines.
  • Lastly, it will ask for the network ID. This ID should be 4 digit number.
1
|***************** Running ledgerium tools application *****************|
2
+----------------------------------------------------------------------+
3
Select the type of node setup - full/blockproducer ('0' for 'blockproducer' and '1' for 'full')
4
MODE:1
5
Is this a local setup or distributed? ('0' for local and '1' for distributed)
6
Setup:0
7
|***************** Executing script for local full mode ****************|
8
Enter Network ID
9
Should be a 4 digit number. Ex: 2019
10
Network ID:2024
11
12
+--------------------------------------------------------------------+
13
YML file with full mode
Copied!
Next, the script will ask for further details. In the example, 4 founding Ledgerium block producer nodes are created.
1
> Number of nodes : 4
2
> Total number of nodes 4
Copied!
This script prompts the user for mnemonics seed for all the 4 Ledgerium block producer nodes.

Mnemonics Seed

A mnemonic phrase or mnemonic seed is a set of typically either 12 or 24 words taken from BIP 32 English Wordlist, which can be used to derive an infinite number of wallets. In the Ethereum ecosystem, mnemonic phrases are generally generated following the BIP 32 spec. The private key and the public key combination will be generated using the mnemonic seed. You can generate a new mnemonic seed if you install Ledgerium Wallet or even most of the other Ethereum based wallets.
The mnemonic seed needs to be saved safely. In case the private key is lost, it can be regenerated using mnemonic seed. Once the mnemonic seed is lost, it can't be regenerated or retrieved. Likewise, the private key needs to be saved safely and should not be shared with anyone.
  • Enter the mnemonic seed and password. To know the significance of password follow
    1
    > Enter mnemonic 0 : *******
    2
    > Enter password 0 : ***
    3
    > Enter mnemonic 1 : **********
    4
    > Enter password 1 : ****
    5
    > Enter mnemonic 2 : *************
    6
    > Enter password 2 : ****
    7
    > Enter mnemonic 3 : ******************
    8
    > Enter password 3 : *****
    Copied!
    The script finally creates a docker-compose file (.yml) and brings up the containers.

Confirming Ledgerium Network is up and running correctly

We can see if the setup ran correctly by going to Block Explorer. The newly added validator should be showing up in the list of active validators/block producers. Initially, the validator will synch with the network and download the entire public state of the blockchain and once ready, you can see the last block will be in synch with the rest of the network.

Docker Commands

A few Docker commands are useful for managing Ledgerium Docker container on your machine.
Once, you are inside file path ledgerium/ledgeriumtools/output, run the below commands.

To list all active containers on your machine, run:

1
> docker ps -a
2
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
3
2e85ec37bb4b ledgeriumengineering/blockexplorerclient:v1.1 "nginx -g 'daemon of…" 7 seconds ago Up 2 seconds 0.0.0.0:2000->80/tcp output_blockexplorerclient_1
4
663103b6e8cf ledgeriumengineering/governance_app_ui_img:v1.0 "/bin/sh -c 'set -u\n…" 11 seconds ago Up 4 seconds 0.0.0.0:3547->3003/tcp output_governance-ui-ledgeriumblockchain-setup2_1
5
a446733aa8d8 ledgeriumengineering/ledgeriumfaucet:v1.0 "/bin/sh -c 'set -u\n…" 12 seconds ago Up 7 seconds 0.0.0.0:5577->5577/tcp output_ledgeriumfaucet_1
6
fbfea0aa5f27 ledgeriumengineering/governance_app_ui_img:v1.0 "/bin/sh -c 'set -u\n…" 12 seconds ago Up 8 seconds 0.0.0.0:3545->3003/tcp output_governance-ui-ledgeriumblockchain-setup0_1
7
ab67b56f7b9b ledgeriumengineering/blockexplorerserver:v1.1 "/bin/sh -c 'set -u\n…" 12 seconds ago Up 7 seconds 0.0.0.0:2002->2002/tcp output_blockexplorerserver_1
8
b9a446b36c09 ledgeriumengineering/governance_app_ui_img:v1.0 "/bin/sh -c 'set -u\n…" 12 seconds ago Up 8 seconds 0.0.0.0:3548->3003/tcp output_governance-ui-ledgeriumblockchain-setup3_1
9
03d5bc05a093 ledgeriumengineering/governance_app_ui_img:v1.0 "/bin/sh -c 'set -u\n…" 13 seconds ago Up 11 seconds 0.0.0.0:3546->3003/tcp output_governance-ui-ledgeriumblockchain-setup1_1
10
5d5809b3505c ledgeriumengineering/ledgeriumcore:blockrewards "/bin/sh -c 'while […" 16 seconds ago Up 11 seconds 30303/udp, 0.0.0.0:8547->8545/tcp, 0.0.0.0:9002->9000/tcp, 0.0.0.0:30305->30303/tcp output_validator-ledgeriumblockchain-setup2_1
11
43d4967c839c ledgeriumengineering/ledgeriumcore:blockrewards "/bin/sh -c 'while […" 17 seconds ago Up 12 seconds 0.0.0.0:8545->8545/tcp, 0.0.0.0:9000->9000/tcp, 0.0.0.0:30303->30303/tcp, 30303/udp output_validator-ledgeriumblockchain-setup0_1
12
3b9e17e955b2 ledgeriumengineering/ledgeriumcore:blockrewards "/bin/sh -c 'while […" 20 seconds ago Up 14 seconds 30303/udp, 0.0.0.0:8546->8545/tcp, 0.0.0.0:9001->9000/tcp, 0.0.0.0:30304->30303/tcp output_validator-ledgeriumblockchain-setup1_1
13
f77066084fb1 ledgeriumengineering/ledgeriumcore:blockrewards "/bin/sh -c 'while […" 20 seconds ago Up 12 seconds 30303/udp, 0.0.0.0:8548->8545/tcp, 0.0.0.0:9003->9000/tcp, 0.0.0.0:30306->30303/tcp output_validator-ledgeriumblockchain-setup3_1
14
13e0f2e1e62a ledgeriumengineering/ledgeriumstats:v1.0 "npm start" About a minute ago Up 21 seconds 0.0.0.0:3000->3000/tcp output_ledgeriumstats_1
15
27be76ac18d3 ledgeriumengineering/tessera:v1.1 "/bin/sh -c 'DATE=`d…" About a minute ago Up 21 seconds 0.0.0.0:10001->10001/tcp, 0.0.0.0:10101->10101/tcp output_tessera-ledgeriumblockchain-setup1_1
16
7513f022fe99 ledgeriumengineering/tessera:v1.1 "/bin/sh -c 'DATE=`d…" About a minute ago Up 17 seconds 0.0.0.0:10000->10000/tcp, 0.0.0.0:10100->10100/tcp output_tessera-ledgeriumblockchain-setup0_1
17
932edfb07ca2 mongo:3.4.10 "mongod --smallfiles…" About a minute ago Up 17 seconds 0.0.0.0:27017->27017/tcp blk-free-mongodb
18
c219a425d7b7 redis:alpine "docker-entrypoint.s…" About a minute ago Up 16 seconds 0.0.0.0:6379->6379/tcp output_redis_1
19
266909f73b4d ledgeriumengineering/tessera:v1.1 "/bin/sh -c 'DATE=`d…" About a minute ago Up 16 seconds 0.0.0.0:10002->10002/tcp, 0.0.0.0:10102->10102/tcp output_tessera-ledgeriumblockchain-setup2_1
20
eb71861d8e6c ledgeriumengineering/tessera:v1.1 "/bin/sh -c 'DATE=`d…" About a minute ago Up 21 seconds 0.0.0.0:10003->10003/tcp, 0.0.0.0:10103->10103/tcp output_tessera-ledgeriumblockchain-setup3_1
Copied!

Manually shutting down the validators docker containers

1
> cd ../ledgeriumtools/output
2
> docker-compose down
3
Stopping output_blockexplorerclient_1 ... done
4
Stopping output_governance-ui-ledgeriumblockchain-setup2_1 ... done
5
Stopping output_ledgeriumfaucet_1 ... done
6
Stopping output_governance-ui-ledgeriumblockchain-setup0_1 ... done
7
Stopping output_blockexplorerserver_1 ... done
8
Stopping output_governance-ui-ledgeriumblockchain-setup3_1 ... done
9
Stopping output_governance-ui-ledgeriumblockchain-setup1_1 ... done
10
Stopping output_validator-ledgeriumblockchain-setup2_1 ... done
11
Stopping output_validator-ledgeriumblockchain-setup0_1 ... done
12
Stopping output_validator-ledgeriumblockchain-setup1_1 ... done
13
Stopping output_validator-ledgeriumblockchain-setup3_1 ... done
14
Stopping output_ledgeriumstats_1 ... done
15
Stopping output_tessera-ledgeriumblockchain-setup1_1 ... done
16
Stopping output_tessera-ledgeriumblockchain-setup0_1 ... done
17
Stopping blk-free-mongodb ... done
18
Stopping output_redis_1 ... done
19
Stopping output_tessera-ledgeriumblockchain-setup2_1 ... done
20
Stopping output_tessera-ledgeriumblockchain-setup3_1 ... done
21
Removing output_blockexplorerclient_1 ... done
22
Removing output_governance-ui-ledgeriumblockchain-setup2_1 ... done
23
Removing output_ledgeriumfaucet_1 ... done
24
Removing output_governance-ui-ledgeriumblockchain-setup0_1 ... done
25
Removing output_blockexplorerserver_1 ... done
26
Removing output_governance-ui-ledgeriumblockchain-setup3_1 ... done
27
Removing output_governance-ui-ledgeriumblockchain-setup1_1 ... done
28
Removing output_validator-ledgeriumblockchain-setup2_1 ... done
29
Removing output_validator-ledgeriumblockchain-setup0_1 ... done
30
Removing output_validator-ledgeriumblockchain-setup1_1 ... done
31
Removing output_validator-ledgeriumblockchain-setup3_1 ... done
32
Removing output_ledgeriumstats_1 ... done
33
Removing output_tessera-ledgeriumblockchain-setup1_1 ... done
34
Removing output_tessera-ledgeriumblockchain-setup0_1 ... done
35
Removing blk-free-mongodb ... done
36
Removing output_redis_1 ... done
37
Removing output_tessera-ledgeriumblockchain-setup2_1 ... done
38
Removing output_tessera-ledgeriumblockchain-setup3_1 ... done
39
Network test_net is external, skipping
Copied!

Manually starting the nodes

1
> docker-compose up -d
2
Creating output_tessera-ledgeriumblockchain-setup2_1 ... done
3
Creating output_tessera-ledgeriumblockchain-setup3_1 ... done
4
Creating output_redis_1 ... done
5
Creating blk-free-mongodb ... done
6
Creating output_tessera-ledgeriumblockchain-setup0_1 ... done
7
Creating output_ledgeriumstats_1 ... done
8
Creating output_tessera-ledgeriumblockchain-setup1_1 ... done
9
Creating output_validator-ledgeriumblockchain-setup0_1 ... done
10
Creating output_validator-ledgeriumblockchain-setup3_1 ... done
11
Creating output_validator-ledgeriumblockchain-setup1_1 ... done
12
Creating output_validator-ledgeriumblockchain-setup2_1 ... done
13
Creating output_ledgeriumfaucet_1 ... done
14
Creating output_blockexplorerserver_1 ... done
15
Creating output_governance-ui-ledgeriumblockchain-setup0_1 ... done
16
Creating output_governance-ui-ledgeriumblockchain-setup3_1 ... done
17
Creating output_governance-ui-ledgeriumblockchain-setup1_1 ... done
18
Creating output_governance-ui-ledgeriumblockchain-setup2_1 ... done
19
Creating output_blockexplorerclient_1 ... done
Copied!

Deconstructing the docker-compose.yml file

A generated docker-compose file will consist of 3 image containers per Ledgerium node along with additional containers. These are as follows:
  • Ledgerium Core
    • Purpose: This is the actual Ledgerium node, implementing Ledgerium Protocol
    • Following open ports are required to synch with its peers of Blockchain network:
      • 30303 Network listening port
      • 8545 HTTP-RPC server listening port
      • 9000 WS-RPC server listening port

Ledgerium Blockchain node configuration

Each node of Ledgerium Blockchain is configured with following commands in its setup file docker-compose.yml.
Geth Commands
geth --datadir '/eth' --networkid 2019 --identity "validator-0" --rpc --rpcaddr '0.0.0.0' --rpcport 8545 --rpccorsdomain '*' --rpcapi 'db,eth,net,web3,istanbul,personal,admin,debug,txpool' --rpcvhosts=localhost --ws --wsorigins '' --wsapi 'db,eth,net,web3,personal,admin,debug,txpool' --wsaddr '0.0.0.0' --wsport 9000 --mine --minerthreads 1 --syncmode 'full' --targetgaslimit 9007199254740000 --port "30303" --debug --metrics --txpool.nolocals --txpool.accountslots 128 --txpool.globalslots 32768 --txpool.accountqueue 512 --txpool.globalqueue 8192 --nodekeyhex "83a5803e698a3642d5309f119643f6a729c7c51fac00fdffac31983cb5275bb5" --etherbase "f232a4bf183cf17d09bea23e19ceff58ad9dbfed" --ethstats "validator-0:[email protected]/stats" --verbosity 6 *--emitcheckpoints //If enabled, emit specially formatted logging checkpoints e.g. QUORUM-CHECKPOINT
  • Tessera
    • Purpose: Quorum Transaction Manager - implementation of peer-to-peer encrypted message exchange for transaction privacy
    • Following open ports are to accet private transactions:
      • 10000
      • 10100
  • Governance
    • Purpose: Governance App contains smart contracts to manage admin and individual validators to come on the platform
    • Ports required:
      • 3545
  • Block Explorer
    • Purpose: Block Explorer App will display the entire state of newly setup blockchain by showing
      • No of Peers
      • No of Block Producers/Validators
      • List of Blocks
      • List of Transactions (and list of transactions per block)
        etc.
    • Ports required:
      • 2000
      • 2002
  • Faucet
    • Purpose: Faucet App can grant test XLG to any valid Ledgerium EOA account.
    • Ports required:
      • 5577
Last modified 1yr ago