Learn JD CHAIN from scratch (1)-Quickly deploy JD CHAIN

This series of articles plans to record my learning JD Chainprocess from scratch , because I started from scratch, of course, there will be many areas where the understanding is not deep enough, and I hope that everyone will correct their mistakes in time and grow together. Update from time to time, but try to stick to it. I want to set up a shared article Flagso that everyone can monitor my learning progress.

JD ChainIt is independently developed by the JD blockchain development team and is a blockchain framework system specially designed for enterprise applications, suitable for a variety of general business scenarios. Different from the Hyperledger ( Hyperledger Fabric) ecology and the enterprise-level Ethereum Alliance ( Enterprise Ethereum Alliance, EEA), it JD Chainhas completely independent intellectual property rights and a fully open open source agreement ( Apache-2.0 License ). At a time when our Greater China and the Beautiful Country are constantly rubbing in all dimensions, and even Dockerthis widely used open source project can no longer be used happily, learning to understand fully autonomous and controllable open source projects can also be considered as a small contribution to accelerating the internal circulation (There should be applause here ^ ^).

-------------这里是废话的分割线-------------------

In order to help developers quickly deploy, the JD Chainproject has a visual management tool built into the deployment script. Except for some necessary configuration modifications, most of the blockchain deployment tasks such as quick JDChaininitialization and peernode startup only need to follow the operations on the front-end page It is just a little bit of prompt to reduce the user's various tedious operations, which is simply the gospel of lazy people like me.

Deployment model

JD ChainThe official website provides two different deployment models for small and medium enterprises and large enterprises. Among them, the simplest deployment model for small and medium-sized enterprises is JD Chainthe lowest configuration that can run normally. When the hardware conditions are met, it can support billion-level transactions. It is usually used for Demoexperiments or small applications. It is the deployment model used below. The simplest deployment model requires the deployment of a client node, a gateway node and multiple consensus nodes (the number of consensus nodes depends on the consensus algorithm, and four consensus nodes are deployed in this deployment)1.png

Steps

2.png

Install and modify configuration

Download the installation package from http://ledger.jd.com , which jdchain-peer-1.2.1-xxx.zipis the peernode compression package and jdchain-gateway-1.2.1-xxx.zipthe gateway compression package.

If the peernodes are deployed on different machines, the default port installation is fine;
if the peernodes are deployed on the same machine, you need to modify peerthe default port of the management tool and the node to avoid port conflicts and cause the service to fail to start. Some assumptions need to be made:

  1. The port of the management tool is defined as: 8000/8001/8002/8003
  2. peerThe startup port of the node is defined as: 7080/7081/7082/7083
  3. JDChainThe installation path of the project is:/export/jdchain

Modify the node configuration as follows (if it is deployed for different machines, only need to perform the following steps 1 and 2):

  1. Switch path cd /export/jdchain

  2. Unzip the Peernode installation packageunzip jdchain-peer-1.2.1.RELEASE.zip –d peerX

  3. Switch path cd /export/jdchain/peerX/bin

  4. Modify the management tool managerport (location as shown in the figure below)vi manager-startup.sh 3.png

  5. Modify the peerboot port and memory size vi peer-startup.sh. For multi- peerdeployment of the local machine, it is recommended to change the memory configuration to a smaller size to avoid insufficient memory. The application cannot be started or the system is not used kill. The suggested location in the figure below is recommended to be changed to:-Xmx512m -Xms512m
    4.png

Start management tool

  1. Enter the executable script directory cd /export/jdchain/peerX/bin
  2. carried out: sh manager-startup.sh
  3. The default background log management tools stored in jump.outthe paper
  4. The management tool will launch an UIoperation interface to facilitate deployment. The default access port of the interface is 8000.

Create public and private keys

Log in to the management terminal UIinterface and click the left menu: Public and private key management -> Generate public and private keys. Fill in the relevant information in the pop-up interface: 5.png
OK! Created! The public key (and the address derived from the public key) will be used as the digital identity of each participant node or user on the blockchain (analogous to a mailbox account), and the private key will be used as the password for the digital identity of each participant node or user on the blockchain (Similar to the mailbox password, it needs to be kept properly)

Create data ledger

  1. Modify configuration information: Click on the left menu: Ledger -> Initialize Ledger, select one machine as the coordinator, and the other as the participant. After filling in the content of each node, do not click the "Save configuration information" button. After filling in the content, save the coordinator first, and save the others in sequence.

Precautions:

  • Participants should use the invitation code of the coordinator;
  • Consensus agreement: currently Bftsmart:;
  • Password algorithm: default;
  • Number of participants: including coordinators;
  • Consensus node information: If you are on the same machine, you must ensure that the consensus port is different (consensus will occupy multiple consecutive ports, and the step size is recommended to be set to 10, namely: 6300/6310/6320/6330);
  • Initialize the consensus address: If you are on the same machine, you must ensure that the consensus port is different (consensus will occupy multiple consecutive ports, and the step size is recommended to be set to 10, namely: 22000/22010/22020/22030);
  • peerNode public key: select the public key created in the previous step;
  • Database name: The name on the same machine cannot be repeated.
  • Since peerthe communication between the nodes has a delay, it is necessary to ensure that peerthe configurations of the four nodes are correct, and click the "Save Configuration Information" button at the bottom of the interface in the shortest possible time.

The configuration information of the coordinator is as follows:
6.png

The participant configuration information is as follows:
7.png

After all four parties click "Save configuration information", the configuration information will be shared among the four parties. The interface is as follows:8.jpg

  1. Ledger initialization: Click the "Start" button at the bottom of the interface to start the initialization operation of the four participants, and the initialization progress will be displayed below. The final display interface is as follows:9.jpg

**Note:** Be sure to make sure that all the ledger initializations are completed before proceeding with subsequent operations. The completion of initialization indicates that the genesis block has been created. Otherwise, an error will occur during the startup of the node.

  1. Start the peernode: Click the menu ledger -> view ledger, the newly generated ledger will be displayed in the content area. Click the "Start Node" button to start the peernode (see the figure below). After the startup is correct, the progress status will be displayed as: Started -> Loaded.10.jpg

Install and start the Gatewaynode

  1. Determine the path cd /export/jdchain

  2. Unzip the gatewaynode installation packageunzip jdchain-gateway-1.2.1.RELEASE.zip –d gw

  3. View the public and private keys on the management side (that is, the public and private keys created for each node on the management side above)

  4. View the encrypted password cd peer0cd config/keysmore *.pwd

  5. Modify port, add public and private keys cd /export/jdchain/gw/configvi gateway.conf

  6. The script starts gateway:sh startup.sh

  7. Wait a moment, if you have not modified the default port configuration, you can http://localhost:18081access the blockchain browser through the page, the interface is as follows:11.jpg

  8. That's it!

Precautions:

  1. The public and private keys can be obtained in the "Public and Private Key Management" of the management tool, but the decryption password ( keys.default.privkey-passwordparameters) of the private key can only be viewed by logging in to the background, which is step 4 above.
  2. Note that the public key 3snstarts with and the private key 177starts with.
    12.jpg

**Key points: **The above is based on the JDChain1.2.1.RELEASEversion and the latest JDChain1.3.0.RELEASEversion has been released. It is recommended to deploy based on the latest version. The deployment process is completely consistent.

Original link: " Learning JD CHAIN ​​from scratch (1)-Rapid deployment of JD CHAIN "

Reference link:
https://zhuanlan.zhihu.com/p/102270006

JD Chain GitHubSee the project link below. Welcome everyone to Starcollect and pay attention first , and learn and grow together!
13.png

Guess you like

Origin blog.csdn.net/wo541075754/article/details/108220573
Recommended