Docker Installation Instructions on Ubuntu V1.0


Instructions to setup ZPB Node in Docker on Ubuntu/Linux Machine:

  1. Download and install docker with the official documentation specified for your Host OS:
  2. Create an account in Docker Hub Registry, this is required to get the images from the Docker Hub Registry:
  3. Login with the following command in Command Prompt / Terminal:
     
     sudo docker login 
    
    (This command will prompt for your docker username and password)

    NOTE: Make sure the user account have sudo privileges or use root account.

  4. After the successful authentication, pull the docker image with the following command:
         
     sudo docker pull zebimainnet/full_node:latest 
    
  5. After pulling the complete docker image , you can see all the docker images with the following command:
  6. 
     sudo docker images 
    
  7. To run the docker image in daemon mode:
          
    sudo docker run -d -it -p 26656:26656 -p 26657:26657 -p 26658:26658 -p 1317:1317 zebimainnet/full_node:latest  

    NOTE: opening 26657, 26658,1317 is optional. Opening port 26656 is mandatory.
    Open port number 26656 in your network firewall and OS firewall. Forward Port Number 26656 to your machine from your router.

  8. Get list of running containers and their IDs:
    
    sudo docker ps 
    
    
  9. To interact with specific docker container:
         
     sudo docker exec -it <docker_container_id> /bin/bash 
    
  10. Choose custom node name for your node and initiate:
     
     zebid init <custom_node_name> --chain-id zpb-mainnet-1  
    
  11. Complete the following steps before starting Zebi Public Blockchain Syncing:
    • Replace the existing genesis.json file at ~/.zebid/config:
       
       cd ~/.zebid/config/ 
      
       
       rm genesis.json && wget https://raw.githubusercontent.com/zebidata/ZPB/master/genesis.json 
      
    • Update seeds list in config.toml file:
       
         sed -i 's/seeds = ""/seeds = "843e4e9c0e95b851a488c9f339af4d77ac97aefb@142.93.223.160:36656"/g' config.toml 
        
    • [optional] Configure your Zebi CLI to eliminate the need for chain-id flag subsequently:
       
       zebicli config chain-id zpb-mainnet-1 
      
       
       zebicli config output json 
      
       
       zebicli config indent true 
      
       
       zebicli config trust-node true 
      
    • Generate Private key file and Certificate file:
       
       cd /root/ && mkdir ssl_certs && cd ssl_certs/ && openssl req -newkey rsa:2048 -new -nodes -x509 -days 3650 -keyout key.pem -out cert.pem
       
      

      NOTE: Please give custom information to configure SSL Certificate.

    • Start the Rest server in background:
       
       nohup zebicli rest-server /root/ssl_certs/cert.pem /root/ssl_certs/key.pem --chain-id zpb-mainnet-1 --trust-node --laddr tcp://0.0.0.0:1317 > rest_log.out & 
      
      Press Enter to finish.

      NOTE: Change 1317 port number to run the rest server in custom port number

    • Create an account with username and password.
       
       curl --insecure -XPOST -s https://0.0.0.0:1317/Acc --data-binary '{"name":"<username>", "type":"add", "pass":"<password>", "mneumonic":""}' 
      

      NOTE: Save your mnemonic. This will be the only way to recover your account.

  12. Start Zebi Public Blockchain Syncing:
         
    nohup zebid start --minimum-gas-prices=500.0zebi > nohup.out &  
    
    You can check syncing status using:
         
    tail nohup.out  
    

    NOTE: Wait till you sync to latest block in zpb.zebi.io
    We advise you to backup your account address, username, and mnemonic safely and take a snapshot of your docker image after syncing to latest block. Continue taking snapshots in regular intervals as desired. Zebi will not be responsible if you loose your account details or if docker crashes.

  13. [optional] These are commands to connect, backup and restore docker image:
    a. If you lose connection from docker container, you can connect back container using:
         
     docker exec -it <docker_container_id> /bin/bash 
    
    b. If docker container is stopped, you can start it using this command:
         
     docker start <docker_container_id> 
    
    c. If block syncing stops, you can start it using this command:
         
      nohup zebid start --minimum-gas-prices=500.0zebi > nohup.out &  
    
    d. If rest services are stopped, you can start it using this command:
         
      nohup zebicli rest-server /root/ssl_certs/cert.pem /root/ssl_certs/key.pem --chain-id zpb-mainnet-1 --trust-node --laddr tcp://0.0.0.0:1317 > rest_log.out &  
    
    e. For saving your work, you can take the snapshots of the docker image :
         
    docker commit <docker_container_id> <new_docker_image_name>  
    
    f. Saving the snapshot(i.e., new_docker_image) into a tar file.
         
    docker save <docker_image_name> > <file_location/XXX.tar>  
    
    g. You can carry this snapshot to any machine and can load there.
         
    docker load  <file_location/XXX.tar>  
    

NOTE: Keep your ZPB account, docker credentials and snapshots safe.
Do not remove or destroy or delete docker container and its related files.
Zebi is not responsible if you lose access to your docker container.

NOTE: We advise you to backup your account address, username, and mnemonic safely and take a snapshot of your docker image after syncing to latest block. Continue taking snapshots in regular intervals as desired.
Zebi will not be responsible if you lose your account details or if docker crashes.

You have successfully finished setting up a node in Zebi Public Blockchain Network.
You can proceed to validator setup page to become a validator.