18 Oct, 2018
This insight is a step by step guide how to launch private Ethereum network. It is a great starting point to start experiments and play with different setup and configuration options for your specific needs (block creation time, number of nodes per availability zone, block target gas limit, etc…).
A private chain can potentially have huge advantages over public - level of control we get is much higher. Designing architecture for specific business needs, with private network setup we have more flexibility around transaction cost, latency and other quality attributes.
Ethereum Clique is Proof-of-Authority consensus algorithm implementation deployed to Rinkeby test network. PoA is a near perfect fit for private networks as it gives us full control over which nodes can seal (validate/create) blocks on the network. There are number of pre-approved seal nodes (validators) defined in genesis file. Addition of the new seal node requires voting by existing seal nodes.
There are three essential rules to note before we start:
- number of seal nodes on chain,
N - number of produced blocks
A few words about how our test transaction looks like. In a nutshell it represents the following scenario:
user logged in as brand
And balance is 100 tokens
When user types unit name
And clicks create
Then unit appears in unit list
And balance is 99 tokens
Scenario is implemented in the smart contract in the following way: Under the hood the following business logic comes into play:
As cloud platform we use Microsoft Azure. BTW, It kindly offers 200$ as trial option. We created 8 VMs in two regions. 4 VMs withing one availability zone of Central US region and three others within France Central. Each VM(DS1_v2) has 1 vCPU, 7GB SDD, 3.5GB of RAM and Ubuntu 16 on board. Plus, a separate VM to deploy the Ethereum statistics. There is a list of machines needed for experiment with some useful info in the name (it’s a good idea to note IP address next to VM name):
$ curl https://dl.google.com/go/go1.11.linux-amd64.tar.gz > go1.11.linux-amd64.tar.gz $ sudo tar -C /usr/local -xzf go1.11.linux-amd64.tar.gz $ mkdir ~/.go
add to /etc/profile:
GOROOT=/usr/local/g GOPATH=~/.go PATH=$PATH:$GOROOT/bin:$GOPATH/bin
$ sudo update-alternatives --install "/usr/bin/go" "go" "/usr/local/go/bin/go" 0 $ sudo update-alternatives --set go /usr/local/go/bin/go $ go version
$ sudo apt-get update $ sudo apt-get install -y build-essential $ git clone https://github.com/ethereum/go-ethereum $ cd go-ethereum $ git checkout tags/v1.8.16` (`git tag -l`) $ make all
In order to do this the best option is to use puppeth. First, install docker to stats-node:
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - $ sudo apt-get install docker-compose $ sudo usermod -aG docker $USER $ relogin
Then, run puppeth and follow CLI instructions to deploy ethstats:
$ mkdir -p ~/supplychain/seal-node-n
Create a bunch of tests accounts - create at least 2-3 accounts.
$ cd ~/supplychain $ ~/go-ethereum/build/bin/geth --datadir seal-node-n/ account new
genesis.jsonusing puppeth (run puppeth on stats-node and follow CLI instruction to generate genesis file)
Use puppeth CLI to export just created genesis file to home directory.
$ cd ~/supplychain $ scp -r _user_@_stats-node-ip_:~/supplychain.json . $ ~/go-ethereum/build/bin/geth --datadir seal-node-n/ init supplychain.json
$ mkdir -p ~/supplychain/bootnode $ cd ~/supplychain $ scp -r _user_@_stats-node-ip_:~/supplychain.json . $ ~/go-ethereum/build/bin/geth --datadir bootnode init supplychain.json $ ~/go-ethereum/builds/bin/bootnode -genkey boot.key $ ~/go-ethereum/build/bin/bootnode -nodekey boot.key -verbosity 9 -addr :30310
write pass to
$ ~/go-ethereum/build/bin/geth --datadir seal-node-n/ --syncmode 'full' --port 30311 --rpc --rpcaddr '0.0.0.0' --rpcport 8501 --rpcapi 'personal,db,eth,net,web3,txpool,miner' --bootnodes '_bootnode_enode_@_bootnode_ip_:30310' --networkid 1605 --gasprice '1' -unlock '_seal_node_n_account_' --password ./seal-node-n.pass --mine --ethstats seal-node-n-us:_pass_phrase_@_stats_node_ip_:8081 --targetgaslimit 94000000`
To get the network working smooth we should take care about peer discovery.
There are two options:
_datadir_/static-nodes.json with the following content:
[ "enode://pubkey@ip:port", "enode://pubkey@ip:port" ]
Connect to geth console using command and add peers manually:
$ ~/go-ethereum/build/bin/geth attach ipc:seal-node-n/geth.ipc > admin.addPeer("enode://pubkey@ip:port")
Below you can see console output of three US seal nodes: Whereas ethstats screen should look like this:
We encourage you to play with network setup and configuration. Meanwhile, for demonstration purposes we provide a few results obtained with the following configuration:
Transactions are submitted periodically(every second).
500 transactions were accepted by network in 500 in 8161: 300 transactions are accepted by network in 5900: Sequence tests Transactions are executed in batches. Each subsequent batch starts after previous is finished. 100 transactions each were accepted by network in 5610: 700 transactions are accepted by network in 14937: As it is stated earlier the main purpose of this article is to cover devops part. Thus, we believe, you will invest more time in understanding Clique tuning it instead of having headache setting it up. Soon we release insight how to tune private setup to get maximum TPS! You are always welcome to reach out for advice to one of our Pragmatic DLT SWAT Teams web design agencies Stay tuned!
Stan and his team are expert blockchain developers with excellent full stack experience and I can't recommend them enough! The work is high quality, communication is excellent, and they are available at all times to connect live to discuss key project decisions in real time and to provide regular progress updates. For someone with limited development experience, Stan was also very willing to help walk through key architecture decisions in a way that was easy to understand and that made the process very smooth. In addition to being great at blockchain development, Stan and his team also have excellent startup business experience and we regularly had in-depth strategy discussions where Stan served as a trusted advisor to brainstorm product features, customer segmentation, go to market, and launch strategy for a blockchain startup. If you're looking for an excellent blockchain development team, full stack development resources, or a trusted startup advisor, these are the guys!Read full testimonial
When initially looking for a team for this build the interview process was paramount. within minutes Stan had me at a comfortable spot knowing we would be in the best care, we have been working together for months. this team & stan especially are top tier. we have had hard thought discussions around smart contract development, optimization, payments, routing of transactions, ecosystem architecture, design. this team solves problems so you wont have to. apart from being entirely flexible im at ease knowing the team is efficient with top quality full stack work.Read full testimonial
Michael is very knowledgeable in his area. He delivered the work within a very quick time period but equally took time to provide the necessary support that came with building the decentralised app script. I would recommend him to any other client on upwork. I just hope that he doesn't get soo much work that he can't work with me again.Read full testimonial
Great communication from the team. The finished Coinbase Wallet reader script works great and we were able to adapt it to our specific needs.Read full testimonial
The platform met our expectations. Pragmatic DLT's team provides transparent communication, and are skilled experts in blockchain. Their effective project management and responsiveness have facilitated the potential for a long-term partnership.Read full testimonial
Great communication and attention to detail, the design process went really smoothly and the results were excellent.Read full testimonial
Michael and team completed backend development of my web3 app in 1 week where it took months for others to complete the same work. The quality was high and well-documented. This team is my go-to resource for future blockchain development.Read full testimonial
Very uncomplicated to work with. Did the job well and exactly as requested.Read full testimonial
Pragmatic DLT offered helpful, transparent advice about blockchain technology and data security. Their clear communication and efficient Agile methodology set them apart.Read full testimonial
They ultimately surpassed our initial expectations. The MVP was delivered within the agreed timeframe and scope, and the design that Pragmatic DLT implemented processes one order per second for more than 2,000 worldwide merchants. The team had a proactive approach, was responsive to the client's needs, and took ownership of their workRead full testimonial
Everything was very good! The team managed the engagement effectively and fixed errors prior to the launch. Moreover, their resources were highly competent. Overall, the project was a success.Read full testimonial
Michael and the team did an amazing job! I am pretty demanding customer and the project was not a trivial one. Mike, however, jumped on the task and a) Captured my requirements really well. Guys put it on paper and in the meantime I happen to better understand what I wanted than ever before. I am so grateful they saw my perspective and put it in a perspective of technical viability. b) Delivered very clear and concise architecture. Now I am very clear on how the big project may look and how much will it cost. Finally the thing I am grateful the most. Guys didn't push me to buy the development, they really rose the challenges and questions of viability in a manner I would never be able to do myself. And, effectively, talked me out of the project! They are true professionals and I can now fully trust that they would not sell me solutions they don't believe in. Absolutely recommended!Read full testimonial