XDAG同步节点部署

news/2023/11/30 8:23:28

系统环境要求

JDK : v17
Maven : v3.9.1-v3.9.5
MySQL : v8.0系列

1、MySQL8.0安装

1)docker-compose安装详情
MySQL安装
2)配置数据库账号密码及键表

# docker exec -it mysql8 /bin/bash
# root@0286a1fd60e6:/# mysql -uroot -p
Enter password:
mysql> CREATE DATABASE xdagj;
Query OK, 0 rows affected (0.00 sec)
mysql> use xdagj;
mysql> CREATE TABLE `t_transaction_history` (`fid` int(11) NOT NULL AUTO_INCREMENT,`faddress` varchar(64) NOT NULL,`faddresstype` tinyint(4) NOT NULL,`fhash` varchar(64) NOT NULL,`famount` decimal(20,9) unsigned zerofill NOT NULL,`ftype` tinyint(4) NOT NULL,`fremark` varchar(64) DEFAULT NULL,`ftime` datetime(3) NOT NULL,PRIMARY KEY (`fid`),UNIQUE KEY `id_UNIQUE` (`fid`),KEY `faddress_index` (`faddress`)
) ENGINE=InnoDB AUTO_INCREMENT=17392050 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
Query OK, 0 rows affected (0.00 sec)
mysql> CREATE USER 'xdagj'@'%' IDENTIFIED BY 'xdagj';
Query OK, 0 rows affected (0.00 sec)
mysql> GRANT ALL PRIVILEGES ON *.* TO 'xdagj'@'%' WITH GRANT OPTION;
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

2、准备java编译环境,编译代码

1)安装jdk17

# apt-get install openjdk-17-jdk

2)安装过maven3.9.5

# wget https://dlcdn.apache.org/maven/maven-3/3.9.5/binaries/apache-maven-3.9.5-bin.tar.gz
# tar -xf apache-maven-3.9.5-bin.tar.gz -C /usr/local/
# vim /etc/profile
`
MAVEN_HOME=/usr/local/apache-maven-3.9.5/bin/
export PATH=$PATH:$MAVEN_HOME
`
# source /etc/profile

3)拉取代码并编译代码

# git clone https://github.com/XDagger/xdagj.git
# cd xdagj
# mvn clean package -Dmaven.test.skip=true
# ls dist
xdag.bat  xdagj-linux.zip  xdagj-macos.zip  xdagj-windows.zip  xdag.sh
# mkdir bin
# unzip dist/xdagj-linux.zip -d bin/
# cd bin
ls
druid.properties  log4j2.xml  logs  mainnet  rpc_modules.conf  xdag-devnet.conf  xdagj-0.6.5-shaded.jar  xdag-mainnet.conf  xdag.sh  xdag-testnet.conf

3、下载数据快照

快照地址
在这里插入图片描述

# cd bin
# wget https://storage.xdagpool.com/snapshot-2722283-193b2380000.tar.gz
# mkdir -p mainnet/rocksdb/xdagdb/
# tar -xf snapshot-2722283-193b2380000.tar.gz -d mainnet/rocksdb/xdagdb/

4、编辑配置文件启动节点

编辑xdag-mainnet.conf文件

# cat xdag-mainnet.conf
# Admin Config
admin.telnet.ip = 127.0.0.1
admin.telnet.port = 6001
admin.telnet.password = root# Pool Config
pool.ip = 0.0.0.0
pool.port = 7001
pool.tag = XdagJ# Pool-Reward Config
pool.poolRation = 5
pool.rewardRation = 5
pool.fundRation = 5
pool.directRation = 5
pool.fundAddress = FQglVQtb60vQv2DOWEUL7yh3smtj7g1s# Node config
node.ip = 0.0.0.0
node.port = 8001
node.maxInboundConnectionsPerIp = 8
# 公共节点IP,要找供应商添加白名单
node.whiteIPs = ["152.32.219.239:8001"]
# 同步节点不挖矿,关闭出块
node.generate.block.enable = false # Node transaction history config
node.transaction.history.enable = true# Node libp2p Config
node.libp2p.port = 9001
node.libp2p.isbootnode = true
node.libp2p.privkey = 0x0802122074ca7d1380b2c407be6878669ebb5c7a2ee751bb18198f1a0f214bcb93b894b5
node.libp2p.bootnode = ["enr:-Iu4QPY6bYDC0PaafEwhgg_6yTcx0GAGbSARYqehJKEkyOmxX6SNZMyMMdkmDw9bAvYN9m2LrqIsPSd-bUqff0tsHYABgmlkgnY0gmlwhH8AAAGJc2VjcDI1NmsxoQJ2EWgMpl6PtyFKMbbOb82Ob-al9NeE3GYB3-K7n4yWwoN0Y3CCJxGDdWRwgicR"]# Node RPC Config
rpc.enabled = true
rpc.http.host = 0.0.0.0
rpc.http.port = 10001
rpc.ws.port = 10002# Miner Config
miner.globalMinerLimit = 8192
miner.globalMinerChannelLimit = 8192
miner.maxConnectPerIp = 256
miner.maxMinerPerAccount = 256# Randomx Config
randomx.flags.fullmem = false

编辑druid.properties文件

# cat druid.properties 
driverClassName=com.mysql.cj.jdbc.Driver
url=jdbc:mysql://localhost:3306/xdagj?autoReconnect=true&useUnicode=true&characterEncoding=utf-8&&serverTimezone=UTC
username=xdagj
password=xdagj
minIdle=5
initialSize=5
maxActive=10
maxWait=100
testOnBorrow=true
testOnReturn=true
testWhileIdle=true
validationQuery=select 1
validationQueryTimeout=1
timeBetweenEvictionRunsMillis=480000
ConnectionErrorRetryAttempts=3
NotFullTimeoutRetryCount=3
#removeAbandonedTimeoutMillis=480000
#removeAbandoned=true
numTestsPerEvictionRun=3
minEvictableIdleTimeMillis=480000
maxEvictableIdleTimeMillis=600000
keepAliveBetweenTimeMillis=540000

启动节点

sh xdag.sh --enablesnapshot true 2722283 193b2380000
enable snapshot:true
Create New Wallet...
EnterNewPassword:
ReEnterNewPassword:
HdWallet Initializing...
HdWallet Mnemonic: avcd hfbf host aegterg ajfgh lojfob aeogn aedg aegrg sefge jkne adomm
HdWallet Mnemonic Repeat:avcd hfbf host aegterg ajfgh lojfob aeogn aedg aegrg sefge jkne adomm quote
HdWallet Initialized Successfully!
New Address:2a3e4c487lkd2238a2e7a9ec33767852c9ohgfri
init snapshot...
init snapshotJ done
time:371582ms
Our balance: 0.000000000
All amount: 1219994175.999999023
telnetd is running on 127.0.0.1:6001
Nov 20, 2023 8:21:47 PM org.jline.builtins.telnet.PortListener run
INFO: Listening to Port 6,001 with a connectivity queue size of 10.

5、查询操作节点

:~# telnet 127.0.0.1 6001
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
Enter Admin password>**** (mainnet配置文件中有)
xdag> state
Connected to the main network. Synchronizing from low to high.
xdag> balance 
Balance: 0.000000000 XDAG
xdag> account
4rN1bDkkv3oXKF8PUpUZjVxi6wNdCTZ3T 0.000000000 XDAGxdag> xfer
Lost some param
xdag> net -l
/152.32.219.239:8001 2023-11-20 20:58:33 31424 in/16092 out
/152.32.219.239:34044 2023-11-20 20:59:26 76 in/3 out
xdag> mainblocks
---------------------------------------------------------------------------------------------------------
height        address                            time                      state     mined by            
---------------------------------------------------------------------------------------------------------
02724441   xUjl48zOvF/52Zb2L5VR0cMWkWg66XtD   2023-08-30 11:49:19.999   Main      HTTPS://XDAG.ORG EQUAL
02724440   zIUVbTK3mOcA2QAT6TX3TZ1uLkz/8jn8   2023-08-30 11:48:15.999   Main      HTTPS://XDAG.ORG SOLO
02724439   1oo0o4A5MW302xBvMwD6wQ95O8IwHaJh   2023-08-30 11:47:11.999   Main      https://equal.xdagmine.com
02724438   HSAFCKZD2Veb1tESbpC+8OnqQ1XRd8dC   2023-08-30 11:46:07.999   Main      HTTPS://XDAG.ORG SOLO
02724437   x25cLeypUR0+ZWcTJTHD9RYcqjfca1WX   2023-08-30 11:45:03.999   Main      HTTPS://XDAG.ORG SOLO 2
02724436   rTa41sp/0PKCEHq71X0mRrBv3jHaqejL   2023-08-30 11:43:59.999   Main      HTTPS://XDAG.ORG SOLO
02724435   oM8wBE3GDnk8SvyDacm+MNc3G2ZvDnwA   2023-08-30 11:42:55.999   Main      HTTPS://XDAG.ORG SOLO
02724434   4+tE8yaqNWLsnPjCDcR2zBn+GI+YU5MO   2023-08-30 11:41:51.999   Main      https://equal.xdagmine.com
02724433   XQypGeg0kw0o2N12i/qrqAMBVGnCM187   2023-08-30 11:40:47.999   Main      HTTPS://XDAG.ORG EQUAL 2
02724432   AoHJ26AHu7uZB/IO8KRhChkiimfEBom6   2023-08-30 11:39:43.999   Main      HTTPS://XDAG.ORG EQUAL
02724431   nRTHG0EAu0+PA8ebzKPmYG3r7330G/BN   2023-08-30 11:38:39.999   Main      HTTPS://XDAG.ORG SOLO
02724430   wP/n48EiAPgi6lVgZJPDJeWz8FKei8ds   2023-08-30 11:37:35.999   Main      HTTPS://XDAG.ORG SOLO 2
02724429   pvGiDjz1y3/+msNhvd+ItuOxz9ljZNwJ   2023-08-30 11:36:31.999   Main      HTTPS://XDAG.ORG SOLO 2
02724428   YQb2L97G2cfrw3fUFatI0bIVFBqUvgBb   2023-08-30 11:35:27.999   Main      HTTPS://XDAG.ORG EQUAL 2
02724427   0mYGOhNI9HoaQkSnzNqi1toIH5FIY6PD   2023-08-30 11:34:23.999   Main      HTTPS://XDAG.ORG EQUAL
02724426   htiEatRcljLQz+5TpkJom8wAWpDUluD4   2023-08-30 11:33:19.999   Main      HTTPS://XDAG.ORG EQUAL
02724425   +5C/PJnsgX4HPf+hArteuuapj9NYkzDD   2023-08-30 11:32:15.999   Main      HTTPS://XDAG.ORG EQUAL
02724424   CZGrJgrQz5DAUIcaOcFr/nbH93LGwQvs   2023-08-30 11:31:11.999   Main      HTTPS://XDAG.ORG EQUAL
02724423   0LD7tYPM/YFvn5bGZrHXb0pQCLWkjs/k   2023-08-30 11:30:07.999   Main      HTTPS://XDAG.ORG EQUAL
02724422   YLssHNicvfGB7smQSgJR9b99+lJHi86N   2023-08-30 11:29:03.999   Main      HTTPS://XDAG.ORG SOLO 2
xdag> state
Connected to the main network. Synchronizing from low to high.(没有同步完)
xdag> account
4rN1bDkkv3oXKF8PUpUZjVxi6wNdCTZ3T 20.000000000 XDAG
xdag> helpaccount     print first [SIZE] (20 by default) our addresses with their amountsaddress     address-  print extended info for the account corresponding to the address, page size 100balance     print balance of the address [ADDRESS] or total balance for all our addressesblock       print extended info for the block corresponding to the address or hash [A]disconnect  disconnect all connections or specified minersexit        exit from app/scripthelp        command helpkeygen      generate new private/public key pair and set it by defaultlastblocks  print latest [SIZE] (20 by default, max limit 100) main blocksmainblocks  print latest [SIZE] (20 by default, max limit 100) main blocksminedblocks print list of [SIZE] (20 by default) main blocks mined by current poolminers      for pool, print list of recent connected minersnet         run transport layer command, try 'net --help'oldbalance  print max balance we can transferstate       print the program statestats       print statistics for loaded and all known blocksterminate   terminate both daemon and this programttop        display and update sorted information about threadsxfer        transfer [AMOUNT] XDAG to the address [ADDRESS]xfertonew   transfer the old balance to new address
xdag> state
Synchronized with the main network. Normal operation.(同步完成)

curl命令

# 获取最新高度
curl http://127.0.0.1:10001/ -s -X POST -H "Content-Type: application/json" --data "{\"jsonrpc\":\"2.0\",\"method\":\"xdag_blockNumber\",\"params\":[],\"id\":1}"
{"jsonrpc":"2.0","id":1,"result":"2836571"}
# 获取钱包地址余额
curl http://127.0.0.1:10001/ -s -X POST -H "Content-Type: application/json" --data "{\"jsonrpc\":\"2.0\",\"method\":\"xdag_getBalance\",\"params\":[\"4rN1bDkkv3oXKF8PUpUZjVxi6wNdCTZ3T\"],\"id\":1}"
{"jsonrpc":"2.0","id":1,"result":"20.000000000"}
# curl判断是否同步完成
curl http://127.0.0.1:10001/ -s -X POST -H "Content-Type: application/json" --data "{\"jsonrpc\":\"2.0\",\"method\":\"xdag_syncing\",\"params\":[],\"id\":1}"
# 同步没完成
{"jsonrpc":"2.0","id":1,"result":{"currentBlock":null,"highestBlock":null,"isSyncDone":false}}
# 同步完成
{"jsonrpc":"2.0","id":1,"result":{"currentBlock":"2837021","highestBlock":"2837021","isSyncDone":true}}

更多文档详情


https://www.xjx100.cn/news/3092689.html

相关文章

【gpts】学算法题[缺失的第一个正数](https://leetcode.cn/problems/first-missing-positive/)

给出你的题解 (https://leetcode.cn/problems/first-missing-positive/) public class Solution { public int firstMissingPositive(int[] nums) {int len nums.length;for (int i 0; i < len; i) {while (nums[i] > 0 && nums[i] < len && nums…

c++ ,python监控 进程 状态 fork

【精选】操作系统实验二 观察Linux进程状态_linux什 么时候出现运行状态、暂停状态、可中断阻塞状 态、不可中断阻塞状态、僵_Ace2NoU的博客-CSDN博客 Linux C/C 监控进程变化_mob649e81583204的技术博客_51CTO博客 #include <sys/types.h> #include <sys/wait.h>…

2023年G3锅炉水处理证考试题库及G3锅炉水处理试题解析

题库来源&#xff1a;安全生产模拟考试一点通公众号小程序 2023年G3锅炉水处理证考试题库及G3锅炉水处理试题解析是安全生产模拟考试一点通结合&#xff08;安监局&#xff09;特种作业人员操作证考试大纲和&#xff08;质检局&#xff09;特种设备作业人员上岗证考试大纲随机…

【JavaSE】-4-循环结构

循环结构 循环结构是三大流程控制结构的最后一种&#xff0c;相比于顺序结构和分支结构&#xff0c;循环结构略复杂一些。 前面课程中已经说过&#xff0c;循环结构的特点是能够重复的执行某些代码。 循环结构的基本概念&#xff1a; 循环体&#xff1a;重复执行的代码称为循环…

详解python淘宝秒杀抢购脚本程序实现

文章目录 前言一、官网下载火狐浏览器二、下载geckodriver&#xff0c;并解压到火狐浏览器文件夹根目录三、添加火狐浏览器根目录到系统环境变量四、下载并安装python及pycharm开发工具五、进入淘宝六、使用Pycharm运行脚本&#xff0c;新建python文件&#xff0c;将代码复制到…

LeetCode热题100——动态规划

动态规划 1. 爬楼梯2. 杨辉三角3. 打家劫舍 1. 爬楼梯 假设你正在爬楼梯。需要 n 阶你才能到达楼顶。 每次你可以爬 1 或 2 个台阶。你有多少种不同的方法可以爬到楼顶呢&#xff1f; // 题解&#xff1a;每次都有两种选择&#xff0c;1或者2 int climbStairs(int n) {if (n …

模电 01

一.半导体基本知识 1.优点&#xff1a;体积小、重量轻、使用寿命长、输入功率小、功率转换效率高。 2.性能介于导体与绝缘体 3.常用半导体材料&#xff1a;硅&#xff08;SI&#xff09; 镉&#xff08;Ge&#xff09;,化合物半导体&#xff1a;砷化镓&#xff08;GaAs&…

linux上安装qt creator

linux上安装Qt Creator 1 Qt Creator 的下载 下载地址为&#xff1a;http://download.qt.io/archive/qt/ 根据自己的需求选择Qt Creator版本&#xff0c;这里我下载的是5.12.9&#xff0c;如下图所示&#xff1a; 在ubuntu上可以使用wget命令下载安装包&#xff1a; wget h…