Upgrading from a previous version

To upgrade Erigon to a newer version when you've originally installed it via Git and manual compilation, you should follow these steps without needing to delete the entire folder:

  • Terminate your Erigon session by pressing CTRL+C

  • Navigate to your Erigon directory

  • Fetch the latest changes from the repository: You need to make sure your local repository is up-to-date with the main GitHub repository. Run:

    git fetch --tags
    
  • Check out the latest version and switch to it using:

    git checkout <new_version_tag>
    

    Replace <new_version_tag> with the version tag of the new release, for example:

    git checkout v3.0.0-beta1
    
  • Rebuild Erigon: Since the codebase has changed, you need to compile the new version. Run:

    make erigon
    

This process updates your installation to the latest version you specify, while maintaining your existing data and configuration settings in the Erigon folder. You're essentially just replacing the executable with a newer version.

Docker

If you're using Docker to run Erigon, the process to upgrade to a newer version of the software is straightforward and revolves around pulling the latest Docker image and then running it. Here's how you can upgrade Erigon using Docker:

  • Pull the Latest Docker Image: First, find out the tag of the new release from the Erigon Docker Hub page. Once you know the tag, pull the new image:

    docker pull erigontech/erigon:<new_version_tag>
    

    Replace <new_version_tag> with the actual version tag you wish to use. For example:

    docker pull erigontech/erigon:v3.0.0-beta1
    
  • List Your Docker Images: Check your downloaded images to confirm the new image is there and get the new image ID:

    docker images
    
  • Stop the Running Erigon Container: If you have a currently running Erigon container, you'll need to stop it before you can start the new version. First, find the container ID by listing the running containers:

    docker ps
    

    Then stop the container using:

    docker stop <container_id>
    

    Replace <container_id> with the actual ID of the container running Erigon.

  • Remove the Old Container: (Optional) If you want to clean up, you can remove the old container after stopping it:

    docker rm <container_id>
    
  • Run the New Image: Now you can start a new container with the new Erigon version using the new image ID:

    docker run -it <new_image_id>
    
  • Verify Operation: Ensure that Erigon starts correctly and connects to the desired network, verifying the logs for any initial errors.

By following these steps, you'll keep your Docker setup clean and up-to-date with the latest Erigon version without needing to manually clean up or reconfigure your environment. Docker's ability to encapsulate software in containers simplifies upgrades and reduces conflicts with existing software on your machine.