nodesNet
In the previous chapter, we introduced the node network of DMC. In this chapter, we will join this network and become a node to experience the charm of the blockchain network firsthand.
dmc-nodes
dmc-nodes is a script tool provided by the DMC community for quickly launching DMC mainnet nodes. It helps developers to quickly start three different types of nodes.
address:https://github.com/datamallchain/dmc-nodes
install
1 | git clone git@github.com:datamallchain/dmc-nodes.git |
start
1 | dmc seed.js // sync node |
Default data, configuration storage location: /blockData/data
Full Node Data Synchronization For Mainnet
Synchronizing full node block data can be time-consuming. The DMC community provides the latest mirror image startup service, greatly reducing the block synchronization time.
Service address:http://backups.dmctech.io:2748/
Usage Instructions
Download the data:
Visit http://backups.dmctech.io:2748/ and select the desired data package file, then click on the download link.
Alternatively, obtain the file URL and use the wget command to download it.
1
wget http://backups.dmctech.io:2748/data_21395806.tar.gz
Extract the file:
1
tar -zxvSf data_21395806.tar.gz
Modify the configuration file
config.json
of the quick start script:Set the
data_dir
parameter to the path of thedata
directory where the data files were extracted.1
"data_dir": "data/",
Start full node
1
dmc seed.js
Joining the DMC Node Network Manually
If you are not using the dmc-nodes
tool to start a node, you can also write your own startup script to join the node network.
Joining the DMC network requires several key pieces of information:
Obtaining the chainId of the node network
TestNet:
1 | chainId: 'c102a8115bef9e4a4e751559aac2cdc2859417e6476f8cb6054cd3f7dffe1ce4' |
DMC mainnet:
1 | chainId : '4d1fb981dd562d2827447dafa89645622bdcd4e29185d60eeb45539f25d2d85d' |
Providing the address and port for P2P listening
1 | 'p2p-listen-endpoint' : '0.0.0.0:9870' |
Target Node Information for Block Data Synchronization
Block data synchronization must be performed from running super nodes.
TestNet:1
2
3
4
5
6
7
8{
"p2p-peer-address": [
"154.31.0.101:9870",
"154.31.0.101:9901",
"154.31.0.72:5701",
"154.31.0.72:5702"
]
}
DMC mainnet:
All super nodes on the DMC mainnet have been replaced by community nodes. For specific node information, please visit https://github.com/datamallchain/p2p-address/blob/main/p2p_address.json
1 | { |
Note: The DMC mainnet BP P2P address provided in the example may change, so please stay updated and pay attention to any changes.
genesis.json file
TestNet:
1 | { |
DMC mainnet:
1 | { |
How to Become a Sync Node
If your node only needs to synchronize DMC block data, it is very simple. Save the following code tosync_node.js
:
1 | var chain = require('chain'); |
In the above code, the p2p-peer-address
in the net
module is a variable value. Please make sure to modify it accordingly.
To run the synchronization node:
1 | dmc sync_node.js |
How to become a BP node
(* BP Block Producer)
Important Note: When applying for registration as a Producer, it is highly recommended not to use the same key for your producer key and active key.
If a node needs to apply for registration as a block producer on the DMC mainnet, it involves three aspects:
- Configuring Producer information to start the DMC node service
- Initiating the registration application using the Producer identity
- Minting PST to become a Producer
Configuring Producer Information to Start the DMC Node Service
Only when the amount of PST@datamall
reaches a certain value, the DMC node will truly become a Producer with the ability to produce blocks. In other cases, it will only function as a node for synchronizing block data.
The following code demonstrates the configuration of a Producer. Save the code to producer_node.js
:
1 | const dmc = require('chain'); |
It is strongly recommended to disable external network RPC access for a Block Producer’s API nodes. If RPC access is required for the node, utilizing internal network HTTP is advisable. The corresponding configuration example code is as follows:
1 | dmc.load("http", { |
The contents of config.json
are as follows:
1 | { |
Parameter explanation:
configuration Item | explanation | remark |
---|---|---|
chainId | DMC Blockchain Network ID | cannot be modified |
httpEndpoint | RPC interface provided | cannot be modified |
url | URL information for registering BP | modify as needed |
location | address for registering BP | modify as needed |
config_dir | location to save local blockchain configuration | not recommended to modify |
data_dir | location to save local blockchain data | not recommended to modify |
http_port | RPC port for local blockchain to listen and access services is provided | modify as needed |
p2p_port | P2P port for local blockchain to listen for connections from other nodes | modify as needed |
p2p_peer_address | P2P addresses of other nodes to connect to | modify as needed |
Install dependencies1
dmc --install dmc.js
Run Producer node:
1 | dmc producer_node.js |
Enter the private key and block producer name as required. The specific format is as follows:
producer-name:private-key
Taking “testnetbppa4” as an example, enter:
testnetbppa4:5K7NFbDfjxV7khfKdRvPEUt5Ny***cdfiR83p1t3npPEavAegc3
Note: Keep this process running without being closed
Initiating Registration Application as a Producer
Save the following code to register_bp.js
:
1 | var DMC = require('dmc.js'); |
Execute the code
1 | dmc register_bp.js |
Enter the same content as above
Minting PST@datamall
to Become a Producer
Only by holding a sufficient amount of PST@datamall
can one become a Producer. The quantity of minted PST is determined by the minting contract and can be calculated using the formula $PST = \frac{DMC}{m’\times p} $.
Save the following code tomint.js
1 | var DMC = require('dmc.js'); |
Execute the code
1 | $ dmc mint.js |
1 | input the producer-name:private-key! oooo:xxxx |
The above example will mint 20 PST@datamall
Recommended Hardware Configuration
Component | Specification |
---|---|
CPU | 8 cores |
Memory | 16GB RAM |
Storage | 500GB HDD |