Docker-compose部署LTC同步节点

2024-05-01 11:36

本文主要是介绍Docker-compose部署LTC同步节点,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

1、下载ltc程序包,litecoin下载地址
下载页
在这里插入图片描述

mkdir /data/docker-compose/ltc
cd /data/docker-compose/ltc
https://github.com/litecoin-project/litecoin/releases/download/v0.21.3/litecoin-0.21.3-x86_64-linux-gnu.tar.gz

2、编写dockerfile和bitcoin.conf
bitcoin.conf

cat bitcoin.conf
server=1
txindex=1
listen=1
rpcbind=0.0.0.0:9332
rpcallowip=0.0.0.0/0
rpcport=9332
rpcuser=root
rpcpassword=123456
uacomment=litecoin
datadir=/litecoin/data

Dockerfile

FROM ubuntu:20.04# 安装依赖库和工具
RUN apt-get update && apt-get install -y \curl \libssl-dev \libevent-dev \software-properties-commonADD litecoin-0.21.3-x86_64-linux-gnu.tar.gz .
# 解压并复制二进制文件到 /usr/local/bin 目录
RUN mv litecoin-0.21.3/bin/litecoind /usr/local/bin/ && \mv litecoin-0.21.3/bin/litecoin-cli /usr/local/bin/ && \rm -rf litecoin-0.21.3 # 配置 Bitcoin Cash 节点
COPY litecoin.conf /root/.litecoin/litecoin.conf# 暴露节点端口
EXPOSE 9332 9333# 启动 Bitcoin Cash 节点
CMD ["/usr/local/bin/litecoind", "--conf=/root/.litecoin/litecoin.conf", "--printtoconsole"]

3、编译镜像

~# docker build -t devocenter/litecoin .
[+] Building 1.9s (11/11) FINISHED                                                                                                                                                                                             docker:default=> [internal] load build definition from Dockerfile                                                                                                                                                                                     0.0s=> => transferring dockerfile: 699B                                                                                                                                                                                                     0.0s=> [internal] load metadata for docker.io/library/ubuntu:20.04                                                                                                                                                                          1.8s=> [auth] library/ubuntu:pull token for registry-1.docker.io                                                                                                                                                                            0.0s=> [internal] load .dockerignore                                                                                                                                                                                                        0.0s=> => transferring context: 2B                                                                                                                                                                                                          0.0s=> [1/5] FROM docker.io/library/ubuntu:20.04@sha256:21ae67bf44d1d0a53ecdce48742c766e44aea4d16e18a3b88a3888eddaf782b5                                                                                                                    0.0s=> [internal] load build context                                                                                                                                                                                                        0.0s=> => transferring context: 264B                                                                                                                                                                                                        0.0s=> CACHED [2/5] RUN apt-get update && apt-get install -y     curl     libssl-dev     libevent-dev     software-properties-common                                                                                                        0.0s=> CACHED [3/5] ADD litecoin-0.21.3-x86_64-linux-gnu.tar.gz .                                                                                                                                                                           0.0s=> CACHED [4/5] RUN mv litecoin-0.21.3/bin/litecoind /usr/local/bin/ &&     mv litecoin-0.21.3/bin/litecoin-cli /usr/local/bin/ &&     rm -rf litecoin-0.21.3                                                                           0.0s=> [5/5] COPY litecoin.conf /root/.litecoin/litecoin.conf                                                                                                                                                                               0.0s=> exporting to image                                                                                                                                                                                                                   0.0s=> => exporting layers                                                                                                                                                                                                                  0.0s=> => writing image sha256:d2a95e0f8ee1e369e2c30f4d16e9d1ef2d5fd6738dec4e7e35b35ef59f3692fa                                                                                                                                             0.0s=> => naming to docker.io/devocenter/litecoin

4、镜像打tag push到仓库

root@iZt4n6qi8yq5skigf2kwxwZ:/data/ltc# docker tag d2a95e0f8ee1 devocenter/litecoin:v0.21.3
root@iZt4n6qi8yq5skigf2kwxwZ:/data/ltc# docker images
REPOSITORY            TAG       IMAGE ID       CREATED         SIZE
devocenter/litecoin   latest    d2a95e0f8ee1   2 minutes ago   396MB
devocenter/litecoin   v0.21.3   d2a95e0f8ee1   2 minutes ago   396MB
root@iZt4n6qi8yq5skigf2kwxwZ:/data/ltc# docker login docker.io
Log in with your Docker ID or email address to push and pull images from Docker Hub. If you don't have a Docker ID, head over to https://hub.docker.com/ to create one.
You can log in with your password or a Personal Access Token (PAT). Using a limited-scope PAT grants better security and is required for organizations using SSO. Learn more at https://docs.docker.com/go/access-tokens/Username: devocenter
Password: 
WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-storeLogin Succeeded
root@iZt4n6qi8yq5skigf2kwxwZ:/data/ltc# docker push devocenter/litecoin:v0.21.3
The push refers to repository [docker.io/devocenter/litecoin]
1990ef79999f: Pushed 
090faf555056: Layer already exists 
6c066eebe679: Layer already exists 
9de7d6e778cc: Layer already exists 
e915d510ff2b: Layer already exists 
v0.21.3: digest: sha256:6d80ac2495c2497f2c8ce99a55302c66d1d7da25edd67ea925fc7663a130ac88 size: 1371
root@iZt4n6qi8yq5skigf2kwxwZ:/data/ltc# docker push devocenter/litecoin
Using default tag: latest
The push refers to repository [docker.io/devocenter/litecoin]
1990ef79999f: Layer already exists 
090faf555056: Layer already exists 
6c066eebe679: Layer already exists 
9de7d6e778cc: Layer already exists 
e915d510ff2b: Layer already exists 
latest: digest: sha256:6d80ac2495c2497f2c8ce99a55302c66d1d7da25edd67ea925fc7663a130ac88 size: 1371

在这里插入图片描述

5、编写docker-compose.yaml文件

version: '3'services:lite-node:image: devocenter/litecoinvolumes:- ./bitcoin.conf:/root/.bitcoin/bitcoin.conf- ./data:/litecoin/datarestart: always        ports:- 9332:9332- 9333:9333

6、启动容器

root@iZt4n6qi8yq5skigf2kwxwZ:/data/ltc# docker-compose up -d
WARN[0000] /data/ltc/docker-compose.yaml: `version` is obsolete 
[+] Running 2/2 Network ltc_default       Created                                                                                                                                                                                                     0.0s  Container ltc-bch-node-1  Started                                                                                                                                                                                                     0.2s 
root@iZt4n6qi8yq5skigf2kwxwZ:/data/ltc# docker-compose ps
WARN[0000] /data/ltc/docker-compose.yaml: `version` is obsolete 
NAME             IMAGE                 COMMAND                  SERVICE    CREATED         STATUS         PORTS
ltc-lite-node-1   devocenter/litecoin   "/usr/local/bin/lite…"   bch-node   4 seconds ago   Up 2 seconds   0.0.0.0:9332-9333->9332-9333/tcp, :::9332-9333->9332-9333/tcp

7、验证节点同步情况

root@iZt4n6qi8yq5skigf2kwxwZ:/data/ltc# docker exec -it ltc-lite-node-1 /bin/bash
#获取最新同步区块的信息
root@0d354a8aae19:/# curl --user root:123456  --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getblockchaininfo", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:9332/
{"result":{"chain":"main","blocks":39048,"headers":2677088,"bestblockhash":"d8ce662813d1fd00356081a74f244de3537862200e6ca1981ff799d40b77dd0d","difficulty":0.640534438438908,"mediantime":1322339330,"verificationprogress":0.0008527834538067149,"initialblockdownload":true,"chainwork":"00000000000000000000000000000000000000000000000000002b182584c4d3","size_on_disk":369020539,"pruned":false,"softforks":{"bip34":{"type":"buried","active":false,"height":710000},"bip66":{"type":"buried","active":false,"height":811879},"bip65":{"type":"buried","active":false,"height":918684},"csv":{"type":"buried","active":false,"height":1201536},"segwit":{"type":"buried","active":false,"height":1201536},"taproot":{"type":"bip8","bip8":{"status":"defined","start_height":2161152,"timeout_height":2370816,"since":0},"active":false},"mweb":{"type":"bip8","bip8":{"status":"defined","start_height":2217600,"timeout_height":2427264,"since":0},"active":false}},"warnings":""},"error":null,"id":"curltest"}# 获取最新同步到的区块数
root@0d354a8aae19:/# curl --user root:123456  --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getblockcount", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:9332/
{"result":39248,"error":null,"id":"curltest"}#获取最新同步区块的信息
litecoin-cli --conf=/root/.litecoin/litecoin.conf getblockchaininfo
{"chain": "main","blocks": 0,"headers": 455999,"bestblockhash": "12a765e31ffd4059bada1e25190f6e98c99d9714d334efa41a195a7e7e04bfe2","difficulty": 0.000244140625,"mediantime": 1317972665,"verificationprogress": 5.359866906187669e-09,"initialblockdownload": true,"chainwork": "0000000000000000000000000000000000000000000000000000000000100010","size_on_disk": 288,"pruned": false,"softforks": {"bip34": {"type": "buried","active": false,"height": 710000},"bip66": {"type": "buried","active": false,"height": 811879},"bip65": {"type": "buried","active": false,"height": 918684},"csv": {"type": "buried","active": false,"height": 1201536},"segwit": {"type": "buried","active": false,"height": 1201536},"taproot": {"type": "bip8","bip8": {"status": "defined","start_height": 2161152,"timeout_height": 2370816,"since": 0},"active": false},"mweb": {"type": "bip8","bip8": {"status": "defined","start_height": 2217600,"timeout_height": 2427264,"since": 0},"active": false}},"warnings": ""
}

lite节点钱包设置密码

root@iZt4n6qi8yq5skigf2kwxwZ:/data/ltc# docker exec -it ltc-lite-node-1 /bin/bash
root@0d354a8aae19:/# litecoin-cli --conf=/root/.litecoin/litecoin.conf encryptwallet Lite@2024

这篇关于Docker-compose部署LTC同步节点的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/951584

相关文章

闲置电脑也能活出第二春?鲁大师AiNAS让你动动手指就能轻松部署

对于大多数人而言,在这个“数据爆炸”的时代或多或少都遇到过存储告急的情况,这使得“存储焦虑”不再是个别现象,而将会是随着软件的不断臃肿而越来越普遍的情况。从不少手机厂商都开始将存储上限提升至1TB可以见得,我们似乎正处在互联网信息飞速增长的阶段,对于存储的需求也将会不断扩大。对于苹果用户而言,这一问题愈发严峻,毕竟512GB和1TB版本的iPhone可不是人人都消费得起的,因此成熟的外置存储方案开

基于MySQL Binlog的Elasticsearch数据同步实践

一、为什么要做 随着马蜂窝的逐渐发展,我们的业务数据越来越多,单纯使用 MySQL 已经不能满足我们的数据查询需求,例如对于商品、订单等数据的多维度检索。 使用 Elasticsearch 存储业务数据可以很好的解决我们业务中的搜索需求。而数据进行异构存储后,随之而来的就是数据同步的问题。 二、现有方法及问题 对于数据同步,我们目前的解决方案是建立数据中间表。把需要检索的业务数据,统一放到一张M

服务器集群同步时间手记

1.时间服务器配置(必须root用户) (1)检查ntp是否安装 [root@node1 桌面]# rpm -qa|grep ntpntp-4.2.6p5-10.el6.centos.x86_64fontpackages-filesystem-1.41-1.1.el6.noarchntpdate-4.2.6p5-10.el6.centos.x86_64 (2)修改ntp配置文件 [r

【前端学习】AntV G6-08 深入图形与图形分组、自定义节点、节点动画(下)

【课程链接】 AntV G6:深入图形与图形分组、自定义节点、节点动画(下)_哔哩哔哩_bilibili 本章十吾老师讲解了一个复杂的自定义节点中,应该怎样去计算和绘制图形,如何给一个图形制作不间断的动画,以及在鼠标事件之后产生动画。(有点难,需要好好理解) <!DOCTYPE html><html><head><meta charset="UTF-8"><title>06

如何用Docker运行Django项目

本章教程,介绍如何用Docker创建一个Django,并运行能够访问。 一、拉取镜像 这里我们使用python3.11版本的docker镜像 docker pull python:3.11 二、运行容器 这里我们将容器内部的8080端口,映射到宿主机的80端口上。 docker run -itd --name python311 -p

阿里开源语音识别SenseVoiceWindows环境部署

SenseVoice介绍 SenseVoice 专注于高精度多语言语音识别、情感辨识和音频事件检测多语言识别: 采用超过 40 万小时数据训练,支持超过 50 种语言,识别效果上优于 Whisper 模型。富文本识别:具备优秀的情感识别,能够在测试数据上达到和超过目前最佳情感识别模型的效果。支持声音事件检测能力,支持音乐、掌声、笑声、哭声、咳嗽、喷嚏等多种常见人机交互事件进行检测。高效推

day-51 合并零之间的节点

思路 直接遍历链表即可,遇到val=0跳过,val非零则加在一起,最后返回即可 解题过程 返回链表可以有头结点,方便插入,返回head.next Code /*** Definition for singly-linked list.* public class ListNode {* int val;* ListNode next;* ListNode() {}*

从状态管理到性能优化:全面解析 Android Compose

文章目录 引言一、Android Compose基本概念1.1 什么是Android Compose?1.2 Compose的优势1.3 如何在项目中使用Compose 二、Compose中的状态管理2.1 状态管理的重要性2.2 Compose中的状态和数据流2.3 使用State和MutableState处理状态2.4 通过ViewModel进行状态管理 三、Compose中的列表和滚动

【每日一题】LeetCode 2181.合并零之间的节点(链表、模拟)

【每日一题】LeetCode 2181.合并零之间的节点(链表、模拟) 题目描述 给定一个链表,链表中的每个节点代表一个整数。链表中的整数由 0 分隔开,表示不同的区间。链表的开始和结束节点的值都为 0。任务是将每两个相邻的 0 之间的所有节点合并成一个节点,新节点的值为原区间内所有节点值的和。合并后,需要移除所有的 0,并返回修改后的链表头节点。 思路分析 初始化:创建一个虚拟头节点

在 Windows 上部署 gitblit

在 Windows 上部署 gitblit 在 Windows 上部署 gitblit 缘起gitblit 是什么安装JDK部署 gitblit 下载 gitblit 并解压配置登录注册为 windows 服务 修改 installService.cmd 文件运行 installService.cmd运行 gitblitw.exe查看 services.msc 缘起