This series of articles plans to record my learning JD Chain
process 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 Flag
so that everyone can monitor my learning progress.
JD Chain
It 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 Chain
has 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 Docker
this 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 Chain
project 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 JDChain
initialization and peer
node 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 Chain
The 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 Chain
the lowest configuration that can run normally. When the hardware conditions are met, it can support billion-level transactions. It is usually used for Demo
experiments 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)
Steps
Install and modify configuration
Download the installation package from http://ledger.jd.com , which jdchain-peer-1.2.1-xxx.zip
is the peer
node compression package and jdchain-gateway-1.2.1-xxx.zip
the gateway compression package.
If the peer
nodes are deployed on different machines, the default port installation is fine;
if the peer
nodes are deployed on the same machine, you need to modify peer
the 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:
- The port of the management tool is defined as: 8000/8001/8002/8003
peer
The startup port of the node is defined as: 7080/7081/7082/7083JDChain
The 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):
-
Switch path
cd /export/jdchain
-
Unzip the
Peer
node installation packageunzip jdchain-peer-1.2.1.RELEASE.zip –d peerX
-
Switch path
cd /export/jdchain/peerX/bin
-
Modify the management tool
manager
port (location as shown in the figure below)vi manager-startup.sh
-
Modify the
peer
boot port and memory sizevi peer-startup.sh
. For multi-peer
deployment 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 usedkill
. The suggested location in the figure below is recommended to be changed to:-Xmx512m -Xms512m
Start management tool
- Enter the executable script directory
cd /export/jdchain/peerX/bin
- carried out:
sh manager-startup.sh
- The default background log management tools stored in
jump.out
the paper - The management tool will launch an
UI
operation interface to facilitate deployment. The default access port of the interface is 8000.
Create public and private keys
Log in to the management terminal UI
interface 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:
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
- 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);
peer
Node public key: select the public key created in the previous step;- Database name: The name on the same machine cannot be repeated.
- Since
peer
the communication between the nodes has a delay, it is necessary to ensure thatpeer
the 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:
The participant configuration information is as follows:
After all four parties click "Save configuration information", the configuration information will be shared among the four parties. The interface is as follows:
- 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:
**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.
- Start the
peer
node: Click the menu ledger -> view ledger, the newly generated ledger will be displayed in the content area. Click the "Start Node" button to start thepeer
node (see the figure below). After the startup is correct, the progress status will be displayed as: Started -> Loaded.
Install and start the Gateway
node
-
Determine the path
cd /export/jdchain
-
Unzip the
gateway
node installation packageunzip jdchain-gateway-1.2.1.RELEASE.zip –d gw
-
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)
-
View the encrypted password
cd peer0
→cd config/keys
→more *.pwd
-
Modify port, add public and private keys
cd /export/jdchain/gw/config
→vi gateway.conf
-
The script starts
gateway
:sh startup.sh
-
Wait a moment, if you have not modified the default port configuration, you can
http://localhost:18081
access the blockchain browser through the page, the interface is as follows: -
That's it!
Precautions:
- 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-password
parameters) of the private key can only be viewed by logging in to the background, which is step 4 above. - Note that the public key
3sn
starts with and the private key177
starts with.
**Key points: **The above is based on the JDChain1.2.1.RELEASE
version and the latest JDChain1.3.0.RELEASE
version 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 GitHub
See the project link below. Welcome everyone to Star
collect and pay attention first , and learn and grow together!