[blockchain] Tendermint - local single node deployment

Keywords: JSON Blockchain github git

Tendermint

Due to work reasons, I began to contact Hyperledger Fabric two years ago, and its community is still very active. It has developed from v0.7 in that year to v2.0 now. But I have to say that Fabric's consideration is still very big, which is difficult for secondary development. So recently, we began to turn to Tendermint, because it is simpler, easier to understand, and higher performance (which is what Tendermint itself boasts), but in fact, compared with Fabric, it is easier to understand and develop application systems of blockchain.

abstract

Tendermint consists of two main parts: one is responsible for consensus, the other is application program interface. The consensus engine is called Tendermint Core, and the application program interface is called ABCI (Application BlockChain Interface). With ABCI, you can develop your own business logic. The Tendermint Core is responsible for consensus, p2p communication, and state replication. That is to say, the core function of blockchain is finished by Tendermint Core, and your own business logic can be developed by ABCI, and can be developed by any language.
Tendermint is developed using golang. Although you can use any development language for business logic development, if you also use golang, you can integrate your program on the Tendermint Core, and use the -- proxy ﹣ app parameter to proxy, so you can publish your blockchain application cleanly and efficiently.

Single machine deployment

Get source code

mkdir -p $GOPATH/src/github.com/tendermint
cd $GOPATH/src/github.com/tendermint
git clone https://github.com/tendermint/tendermint.git
cd tendermint

Setting environment variables

echo export GOPATH=\"\$HOME/go\"
echo export PATH=\"\$PATH:\$GOPATH/bin\"
echo export GO111MODULE=on

Compile

# Getting dependencies and related tools
make tools
# Compile and install under $GOPATH/bin
make install
# Compile and install to. / build
make build

Verification

(base) frank@deepin:~/project/go/tendermint/bin$ ./tendermint version
0.32.8-7be74c73

So far, your deployment of tendermint is complete.

Function

(base) frank@deepin:~/project/go/tendermint/bin$ ./tendermint init
I[2020-01-29|16:34:14.742] Generated private validator                  module=main keyFile=/home/frank/.tendermint/config/priv_validator_key.json stateFile=/home/frank/.tendermint/data/priv_validator_state.json
I[2020-01-29|16:34:14.742] Generated node key                           module=main path=/home/frank/.tendermint/config/node_key.json
I[2020-01-29|16:34:14.743] Generated genesis file                       module=main path=/home/frank/.tendermint/config/genesis.json

The tendermint init command initializes the necessary configuration and related files for the operation of tendermint.

(base) frank@deepin:~/.tendermint$ pwd
/home/frank/.tendermint
(base) frank@deepin:~/.tendermint$ tree
.
├── config
│   ├── config.toml
│   ├── genesis.json
│   ├── node_key.json
│   └── priv_validator_key.json
└── data
    └── priv_validator_state.json

2 directories, 5 files

If paper runs in single mode you don't need to make any changes.

(base) frank@deepin:~/project/go/tendermint/bin$ ./tendermint node --proxy_app=kvstore
I[2020-01-29|16:50:44.382] Version info                                 module=main software=0.32.8 block=10 p2p=7
I[2020-01-29|16:50:44.402] Starting Node                                module=main impl=Node
I[2020-01-29|16:50:44.420] Started node                                 module=main nodeInfo="{ProtocolVersion:{P2P:7 Block:10 App:1} DefaultNodeID:64c7a4a9c8fc2b8a524ae837b82fdc3e2d312e3d ListenAddr:tcp://0.0.0.0:26656 Network:test-chain-2uWypP Version:0.32.8 Channels:4020212223303800 Moniker:deepin Other:{TxIndex:on RPCAddress:tcp://127.0.0.1:26657}}"

--The proxy app parameter indicates the application of the abdermint core proxy abci. kvstore is an example of abdermint's own abci.

Published 11 original articles, won praise 4, visited 298
Private letter follow

Posted by dayang on Wed, 29 Jan 2020 03:26:18 -0800