搭建electrumx regtest

参考 https://electrumx.readthedocs.io/en/latest/HOWTO.html

在ubuntu-20.04-live-server-amd64 下,系统自带python 3.8

用pip3 install aiohttp, pylru, pylru 库

下面假定操作系统用户是cute

安装daemontools

http://cr.yp.to/daemontools/install.html

获取electrumx代码

git clone https://github.com/kyuupichan/electrumx.git

cd electrumx

python3 setup.py 

创建db目录

cd ~

mkdir ~/electrumx_db

创建服务

mkdir ~/service

mkdir -p ~/scripts/electrumx

cp -R /path/to/repo/electrumx/contrib/daemontools/* ~/scripts/electrumx

上面cp命令比electrumx文档在daemontools后多了 /*

修改evn参数

cd ~/scripts/electrumx/env

下面就是配置文件和内容,环境参数具体含义 https://electrumx.readthedocs.io/en/latest/environment.html

==> COIN <==
BitcoinSegwit

==> DAEMON_URL <==
http://user:[email protected]:8332/

==> DB_DIRECTORY <==
/home/cute/electrumx_db

==> ELECTRUMX <==
/home/cute/electrumx/electrumx_server

==> NET <==
regtest

==> SERVICES <==
tcp://0.0.0.0:51001,ssl://0.0.0.0:51002,rpc://:8000

==> SSL_CERTFILE <==
/home/cute/service/electrumx/server.crt

==> SSL_KEYFILE <==
/home/cute/service/electrumx/server.key

==> USERNAME <==
cute

生成ssl文件,openssl中间有需要填写内容,可以直接回车

cd ~/scripts/electrumx
openssl genrsa -out server.key 2048
openssl req -new -key server.key -out server.csr
openssl x509 -req -days 1825 -in server.csr -signkey server.key -out server.crt

启动服务

cd ~/service
ln -s ~/scripts/electrumx electrumx
svscan ~/service & disown

查看日志

tail -F /path/to/log/dir/current | tai64nlocal

启动electrum regtest钱包,用https://download.electrum.org/3.3.8/Electrum-3.3.8.tar.gz 时,修改servers_regtest.json

cd Electrum-3.3.8
./run_electrum daemon --regtest start

注意:bitcoind启动时要加-reindex -txindex参数。

你可能感兴趣的:(学习笔记,分析总结)