Bitcoin testnet syncing node docker compose setup

Posted By : Chirag

Mar 09, 2021

A bitcoin syncing node is a program that fully validates transactions and downloads blocks on the blockchain. Almost Every full node also help the network of nodes by accepting the transactions and blocks of blockchain from other full syncing nodes. These nodes helps in validating those transactions and blocks, and then relaying them to the further full syncing nodes of bitcoin.

Most of the full syncing nodes also give lightweight clients so that they can send their transactions on to the network and notify them when a transaction are executed successfully. If not a specific number of nodes perform this function, clients won’t be able to connect through the peer-to-peer network—they’ll have to use centralized services instead.

Many people and organizations Prefer to run full nodes using their spare computing and bandwidth resources, also, more volunteers are needed to allow Bitcoin to continue to grow. 

 

Minimum Requirements for linux setup

Bitcoin Core full syncing nodes have some certain requirements which are necessary. If you try running a bitcoin node on weak hardware, it may work—but you’ll likely spend more time dealing with issues. The suggested minimum requirement for the node is given below.

 

  • Any machine (can be Cloud, Desktop or laptop hardware) running recent versions of Linux(can be ubuntu, centos, Redhat etc).
     
  • 350 gigabytes of free disk space, accessible at a minimum read/write speed of 100 MB/s(Preferred SSD).
     
  • 4 gigabytes of memory (RAM)
     
  • An Internet connection with upload speeds of at least 400 kilobits (50 kilobytes) per second
     
  • A connection with high upload limits, or a connection you regularly monitor to ensure it doesn’t exceed its upload limits.
     
  • Your full node can be left running. (You can do other things with your computer while running a full node.) It is preferred if you can run your node continuously.

     



 

Steps for running blockchain node on docker compose


 

1.Create the following File structure:

 

|-- bitcoind_src/

|   `-- Dockerfile

|   `-- bitcoin.conf

|-- docker-compose.yml



 

2.Copy the Dockerfile in the mentioned path

 

FROM ubuntu:16.04

RUN apt-get update -y && \
apt-get install software-properties-common -y && \
apt-get install wget

ENV BITCOIN_VER="0.17.0.1"
ENV BITCOIN_FOLDER_VER="0.17.0"
ENV BITCOIN_SHASUM="6ccc675ee91522eee5785457e922d8a155e4eb7d5524bd130eb0ef0f0c4a6008"
WORKDIR /tmp

RUN wget -O bitcoin-${BITCOIN_VER}-x86_64-linux-gnu.tar.gz https://bitcoin.org/bin/bitcoin-core-${BITCOIN_VER}/bitcoin-${BITCOIN_VER}-x86_64-linux-gnu.tar.gz

RUN CURRENTHASH=$(sha256sum "bitcoin-${BITCOIN_VER}-x86_64-linux-gnu.tar.gz" | cut -d' ' -f1); \
if [ "${CURRENTHASH}" = "${BITCOIN_SHASUM}" ] ; \
then echo "checksum ok"; \
else echo "checksum failed for bitcoin-${BITCOIN_VER}-x86_64-linux-gnu.tar.gz"; exit 255 ; \
fi
RUN tar -xvzf bitcoin-${BITCOIN_VER}-x86_64-linux-gnu.tar.gz
RUN install -C -m 755 -o root -g root --backup=off bitcoin-${BITCOIN_FOLDER_VER}/bin/* /usr/bin/
RUN rm bitcoin-${BITCOIN_VER}-x86_64-linux-gnu.tar.gz && rm -rf bitcoin-${BITCOIN_FOLDER_VER}
RUN apt update
RUN apt install curl -y

RUN mkdir -p /root/.bitcoin/

WORKDIR /root/.bitcoin/
COPY ./bitcoin.conf /root/.bitcoin/
COPY ./wallet.sh /root/.bitcoin/
RUN chmod +x /root/.bitcoin/wallet.sh
EXPOSE 8332 8333 18332 18333

CMD ["/usr/bin/bitcoind", "-deprecatedrpc=accounts"]

 

3.Copy the bitcoin.conf on the mentioned path

 

server=1
testnet=1
rpcuser=RPC_user
rpcpassword=RPC_password

rpcallowip=0.0.0.0/0
rpcport=8332





 

4.Copy the docker-compose.yml on the mentioned path

 

version: '3'
services:

  bitcoin:
    build: build_src
    container_name: bitcoin
    restart: always
    networks:
      - "bitcoin"
    volumes:
      - ./data/bitcoin:/root/.bitcoin
      - ./build_src/bitcoin.conf:/root/.bitcoin/bitcoin.conf
    ports:
      - "8333:8333"
      - "8332:8332"
      - "18333:18333"
      - "18332:18332"

networks:
  bitcoin:
    driver: bridge

 


 

6.Run the following commands to interact with bitcoin node on docker compose.


 

To Start bitcoin Node

docker-compose start  bitcoin

To Stop bitcoin Node

docker-compose stop  bitcoin

To check bitcoin Node Status

docker-compose exec bitcoin bitcoin-cli getblockchaininfo

 

Leave a

Comment

Name is required

Invalid Name

Comment is required

Recaptcha is required.

blog-detail

November 21, 2024 at 11:25 am

Your comment is awaiting moderation.

By using this site, you allow our use of cookies. For more information on the cookies we use and how to delete or block them, please read our cookie notice.

Chat with Us
Telegram Button
Youtube Button

Contact Us

Oodles | Blockchain Development Company

Name is required

Please enter a valid Name

Please enter a valid Phone Number

Please remove URL from text