{"id":15064670,"url":"https://github.com/torxmrig/ethereum-full-node","last_synced_at":"2026-02-11T10:31:17.674Z","repository":{"id":257202688,"uuid":"857607254","full_name":"ToRxmrig/Ethereum-Full-node","owner":"ToRxmrig","description":"Geth and Lighthouse Node Setup on Ubuntu","archived":false,"fork":false,"pushed_at":"2024-09-15T05:33:40.000Z","size":8,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-11-21T18:07:22.695Z","etag":null,"topics":["erigon","eth","fullnode","geth","nginx","nginx-docker","node"],"latest_commit_sha":null,"homepage":"https://ethereum.org","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ToRxmrig.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-09-15T05:31:11.000Z","updated_at":"2024-10-16T12:18:28.000Z","dependencies_parsed_at":"2024-09-15T09:34:45.160Z","dependency_job_id":null,"html_url":"https://github.com/ToRxmrig/Ethereum-Full-node","commit_stats":null,"previous_names":["torxmrig/ethereum-full-node"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ToRxmrig%2FEthereum-Full-node","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ToRxmrig%2FEthereum-Full-node/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ToRxmrig%2FEthereum-Full-node/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ToRxmrig%2FEthereum-Full-node/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ToRxmrig","download_url":"https://codeload.github.com/ToRxmrig/Ethereum-Full-node/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225778867,"owners_count":17522710,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["erigon","eth","fullnode","geth","nginx","nginx-docker","node"],"created_at":"2024-09-25T00:24:07.101Z","updated_at":"2024-11-21T18:07:26.517Z","avatar_url":"https://github.com/ToRxmrig.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Geth and Lighthouse Node Setup on Ubuntu\n\nThis guide will walk you through setting up a Geth full node and a Lighthouse consensus client on Ubuntu, including configuring the firewall, setting up services, and exposing RPC endpoints with Nginx.\n\n## Table of Contents\n\n- [1. Configuring UFW Firewall for Geth](#1-configuring-ufw-firewall-for-geth)\n- [2. Installing Geth Execution Client](#2-installing-geth-execution-client)\n- [3. Installing Lighthouse Consensus Client](#3-installing-lighthouse-consensus-client)\n- [4. Testing Geth RPC Endpoints](#4-testing-geth-rpc-endpoints)\n- [5. Setting Up Nginx with HTTPS and Basic Authentication](#5-setting-up-nginx-with-https-and-basic-authentication)\n- [6. Exposing WebSocket RPC Endpoint](#6-exposing-websocket-rpc-endpoint)\n\n## 1. Configuring UFW Firewall for Geth\n\n1. **Update and Install Required Packages:**\n\n    ```bash\n    sudo apt-get update\n    sudo apt-get install ufw net-tools\n    ```\n\n2. **Configure UFW Firewall:**\n\n    ```bash\n    sudo ufw disable\n    sudo ufw default deny incoming\n    sudo ufw default allow outgoing\n    sudo ufw allow 22/tcp      # SSH access\n    sudo ufw allow 30303       # Geth P2P\n    sudo ufw allow 9000        # Lighthouse P2P\n    sudo ufw allow 80          # HTTP\n    sudo ufw allow 443         # HTTPS\n    sudo ufw enable\n    sudo ufw status verbose\n    ```\n\n## 2. Installing Geth Execution Client\n\n1. **Add Ethereum PPA and Install Geth:**\n\n    ```bash\n    sudo add-apt-repository ppa:ethereum/ethereum\n    sudo apt-get update\n    sudo apt-get upgrade\n    sudo apt-get install ethereum\n    ```\n\n2. **Create Geth Service File:**\n\n    Create `/lib/systemd/system/geth.service` with the following content:\n\n    ```ini\n    [Unit]\n    Description=Geth Full Node\n    After=network-online.target\n    Wants=network-online.target\n\n    [Service]\n    WorkingDirectory=/home/ubuntu\n    User=ubuntu\n    ExecStart=/usr/bin/geth --http --http.addr \"0.0.0.0\" --http.port \"8545\" --http.corsdomain \"*\" --http.api personal,eth,net,web3,debug,txpool,admin --authrpc.jwtsecret /tmp/jwtsecret --ws --ws.port 8546 --ws.api eth,net,web3,txpool,debug --ws.origins=\"*\" --metrics --maxpeers 150 \n    Restart=always\n    RestartSec=5s\n\n    [Install]\n    WantedBy=multi-user.target\n    ```\n\n3. **Enable and Start Geth Service:**\n\n    ```bash\n    sudo systemctl enable geth\n    sudo systemctl start geth\n    sudo journalctl -f -u geth\n    ```\n\n## 3. Installing Lighthouse Consensus Client\n\n1. **Download and Install Lighthouse:**\n\n    ```bash\n    wget https://github.com/sigp/lighthouse/releases/download/v4.5.0/lighthouse-v4.5.0-x86_64-unknown-linux-gnu.tar.gz\n    tar zxvf lighthouse-v4.5.0-x86_64-unknown-linux-gnu.tar.gz\n    sudo mv lighthouse /usr/local/bin/\n    ```\n\n2. **Create Lighthouse Service File:**\n\n    Create `/lib/systemd/system/lighthouse.service` with the following content:\n\n    ```ini\n    [Unit]\n    Description=Lighthouse consensus client\n    After=network-online.target\n    Wants=network-online.target\n\n    [Service]\n    WorkingDirectory=/home/ubuntu\n    User=ubuntu\n    ExecStart=/usr/local/bin/lighthouse bn --network mainnet --execution-endpoint http://localhost:8551 --execution-jwt /tmp/jwtsecret --checkpoint-sync-url https://mainnet.checkpoint.sigp.io --disable-deposit-contract-sync\n    Restart=always\n    RestartSec=5s\n\n    [Install]\n    WantedBy=multi-user.target\n    ```\n\n3. **Enable and Start Lighthouse Service:**\n\n    ```bash\n    sudo systemctl enable lighthouse\n    sudo systemctl start lighthouse\n    ```\n\n## 4. Testing Geth RPC Endpoints\n\n1. **Attach to Geth Console:**\n\n    ```bash\n    geth attach\n    ```\n\n2. **Check Peers and Sync Status:**\n\n    ```js\n    admin.peers.map((el) =\u003e el.network.inbound)\n    eth.blockNumber\n    eth.syncing\n    ```\n\n3. **Check Geth Logs:**\n\n    ```bash\n    sudo journalctl -f -u geth\n    ```\n\n4. **Query Block Number via HTTP RPC:**\n\n    ```bash\n    curl -X POST http://127.0.0.1:8545 \\\n    -H \"Content-Type: application/json\" \\\n    --data '{\"jsonrpc\":\"2.0\", \"method\":\"eth_blockNumber\", \"id\":1}'\n    ```\n\n## 5. Setting Up Nginx with HTTPS and Basic Authentication\n\n1. **Install Nginx and Certbot:**\n\n    ```bash\n    sudo apt-get install nginx apache2-utils\n    sudo apt-get install python3-certbot-nginx\n    ```\n\n2. **Obtain SSL Certificates:**\n\n    ```bash\n    sudo certbot --nginx -d example.com\n    @monthly root certbot -q renew\n    ```\n\n3. **Create Basic Authentication File:**\n\n    ```bash\n    sudo htpasswd -c /etc/nginx/htpasswd.users your_user\n    ```\n\n4. **Configure Nginx:**\n\n    Create or update `/etc/nginx/sites-available/default` with the following configuration:\n\n    ```nginx\n    server {\n        server_name example.com;\n\n        location / {\n            if ($request_method = OPTIONS) {\n                add_header Content-Length 0;\n                add_header Content-Type text/plain;\n                add_header Access-Control-Allow-Methods \"GET, POST, PUT, DELETE, OPTIONS\";\n                add_header Access-Control-Allow-Origin $http_origin;\n                add_header Access-Control-Allow-Headers \"Authorization, Content-Type\";\n                add_header Access-Control-Allow-Credentials true;\n                return 200;\n            }\n\n            auth_basic \"Restricted Access\";\n            auth_basic_user_file /etc/nginx/htpasswd.users;\n            proxy_pass http://localhost:8545;\n            proxy_http_version 1.1;\n            proxy_set_header Upgrade $http_upgrade;\n            proxy_set_header Connection 'upgrade';\n            proxy_cache_bypass $http_upgrade;\n        }\n\n        listen [::]:443 ssl ipv6only=on;\n        listen 443 ssl;\n        ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;\n        ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;\n        include /etc/letsencrypt/options-ssl-nginx.conf;\n        ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;\n    }\n\n    server {\n      if ($host = example.com) {\n          return 301 https://$host$request_uri;\n      }\n\n      listen 80;\n      listen [::]:80;\n      server_name example.com;\n      return 404;\n    }\n    ```\n\n5. **Test and Restart Nginx:**\n\n    ```bash\n    sudo nginx -t\n    sudo service nginx restart\n    ```\n\n6. **Query Geth via HTTPS with Authentication:**\n\n    ```bash\n    curl -X POST https://example.com \\\n      -H \"Content-Type: application/json\" \\\n      -u your_user:your_password \\\n      --data '{\"jsonrpc\":\"2.0\", \"method\":\"eth_blockNumber\", \"id\":1}'\n    ```\n\n## 6. Exposing WebSocket RPC Endpoint\n\n1. **Add WebSocket Location to Nginx Configuration:**\n\n    Update `/etc/nginx/sites-available/default` with:\n\n    ```nginx\n    location /ws {\n        proxy_http_version 1.1;\n        auth_basic \"Restricted Access\";\n        auth_basic_user_file /etc/nginx/htpasswd.users;\n        proxy_set_header Upgrade $http_upgrade;\n        proxy_set_header Connection \"upgrade\";\n        proxy_set_header X-Real-IP $remote_addr;\n        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\n        proxy_set_header Host $http_host;\n        proxy_set_header X-NginX-Proxy true;\n        proxy_pass  http://127.0.0.1:8546/;\n    }\n    ```\n\n2. **Restart Nginx:**\n\n    ```bash\n    sudo service nginx restart\n    ```\n\n---\n\nThis README should provide clear and structured instructions for setting up your Geth and Lighthouse nodes on Ubuntu. If you have any additional sections or specific details to include, feel free to modify accordingly!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftorxmrig%2Fethereum-full-node","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftorxmrig%2Fethereum-full-node","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftorxmrig%2Fethereum-full-node/lists"}