electrumx-proxy

After electurmx is synced up, let's install electrumx-proxy.

# switch to electrumx_user
su - electrumx_user

# install node 20
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
NODE_MAJOR=20
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list
sudo apt update
sudo apt install nodejs

# checkout electrumx-proxy
git clone https://github.com/atomicals/electrumx-proxy.git
cd electrumx-proxy

# configure .env
nano .env

# check if the port is 50001. this is the tcp port in ~/.electrumx/electrumx.conf 
ELECTRUMX_PORT=50001

# install proxy
npm install

# run proxy
npm run dev

# test proxy
# check ip address
curl ifconfig.me

# open http://<ip_address>:8080/. if it doesn't work, check the 8080 port 
sudo ufw status
sudo ufw allow 8080

# open http://<ip_address>:8080/proxy/health, it works fine if it returns this result:
{"success":true,"health":true}

# to use the proxy in mint
# change the url in your https://github.com/atomicals/atomicals-js/blob/master/.env
IP_ADDRESS=$(curl -s ifconfig.me)
ELECTRUMX_PROXY_BASE_URL=http://$IP_ADDRESS:8080/proxy

# run electrumx-proxy as a service
sudo tee /etc/systemd/system/electrumx-proxy.service > /dev/null <<EOL
[Unit]
Description=electrumx-proxy
Requires=electrumx.service
After=network.target

[Service]
Type=simple
User=electrumx_user
WorkingDirectory=/home/electrumx_user/electrumx-proxy
ExecStart=npm run dev
Restart=always

[Install]
WantedBy=multi-user.target
EOL

# enable and start service
sudo systemctl daemon-reload
sudo systemctl enable electrumx-proxy.service
sudo systemctl start electrumx-proxy.service

# check service log
sudo journalctl -u electrumx-proxy -f

# check the status in browser again http://<ip_address>:8080/proxy/health
{"success":true,"health":true}

Troubleshooting

  1. TypeError: Cannot read properties of null (reading 'serverDonation_address')

# 1. 
# Make sure the the port is consistency between 
# electrumx server (/home/electrumx_user/.electrumx/electrumx.conf) 
# and electrumx proxy(/home/electrumx_user/electrumx-proxy/.env)

# after consistency confirmed, restart service
sudo systemctl restart electrumx-proxy

# 2. if the issue persists, reinstall proxy.
su - electrumx_user
sudo systemctl stop electrumx-proxy
cd ~/electrumx-proxy
git pull
npm install
sudo systemctl start electrumx-proxy

Last updated