Skip to content
daverolo edited this page Dec 23, 2022 · 8 revisions

Welcome to the SyncLink wiki!

We hope to use this wiki to document important and minor information regarding the project. You can navigate the wiki by using the navigation bar on the right (where you can open the Pages panel to navigate thru each section)! If you have the feeling we are missing something, please don't hesitate to reach out to us: [email protected]

Overview

  1. What is SyncLink and what problem does it solve?
  2. How does SyncLink work?
  3. What requirements are needed to run SyncLink
  4. Basic Example

What is SyncLink and what problem does it solve?

SyncLink provides a set of tools that can help you to synchronize your new Ethereum node as fast as possible and remove limitations of centralized checkpoints.

With SyncLink you synchronize from decentralized SyncPoints or from a trustful source of your choice in an instant!

How Does SyncLink Work?

The SyncLink Server collects SyncPoint Packages from an existing Ethereum node that will be used by the SyncLink Client to provide the closest SyncPoint to your new Ethereum node.

To remove limitations of centralized checkpoints it is possible to setup multiple SyncLink Servers and add them to the the SyncLink Client configuration, which then chooses the best SyncPoint and provides this to your new Ethereum node.

What requirements are needed to run SyncLink?

There are multiple ways you can run the SyncLink applications. While the recommended setup for production environments is Docker, it is also possible to run them directly from source with Python, which is mostly preferred for develpment on your local system, however also an absolutely valid setup for production.

Basic Example

This example will give you an quick overview what you can do with SyncLink. We will setup a SyncLink Server along with a SyncLink Client and a fresh Ethereum node all together with Docker on your preferred machine. Keep in mind that you would normally setup the SyncLink Server on the same host or network where your existing Ethereum node is running. In our example the SyncLink Server is installed on the same host as the SyncLink Client and we use by default an exsiting Ethereum node which is provided for demonstration purposes only (thus it could be down at any time).

The outcome of the example will be a fresh Ethereum node that is synced extremly fast, since it loads the initial state from the most recent slot provided by SyncLink.

Tools used for this example

Prerequisites

First steps

  1. If not already done, install Docker
  2. Download the synclink-example.yaml file into a newly created and empty directory
  3. Run the example with the Docker commands described below

Generic description of the used Docker commands

Command Description
docker rm Remove one or more containers
docker run Run a command in a new container
docker logs Fetch the logs of a container
docker stop Stop one or more running containers
docker compose up Create and start containers
docker compose pull Pull service images
docker compose down Stop and remove containers, networks

See also https://docs.docker.com/engine/reference/commandline

Generic description of the used Docker commands for this example

Command Description
docker-compose -f synclink-example.yaml pull Pull or refresh all images used by the example (optional)
docker-compose -f synclink-example.yaml up -d Start all containers of the example (detached)
docker-compose --project-name synclink-example logs --follow Get and follow logs from all containers of the example
docker-compose --project-name synclink-example down Shutdown all containers of the example and remove them
docker logs -f synclink-server Get logs from SyncLink Server container
docker logs -f synclink-client Get logs from SyncLink Client container
docker logs -f synclink-teku-node Get logs from Teku (consensus client) container
docker logs -f synclink-besu-node Get logs from Besu (execution client) container

Run the example

1. Start the containers

Begin the example by starting up all containers

docker-compose -f synclink-example.yaml up -d

The containers will now load and start up in the background.

2. Read the container logs

To read the logs of all containers in the same view run the following command:

docker-compose --project-name synclink-example logs --follow

Hint: To close the log view press CTRL+C

To read logs of a specific container use the docker logs command as described here.

Then wait a few seconds until the synclink-teku-node container loads the inital state:

Loaded initial state at epoch 143789 (state root = 0x70a38d72c4145effa0afb44bdad8a5fbdca67e59372d24ea2b64a36f42c342e5, block root = 0x715db58d2887f3b47b46bdc569380f5e9cb1a1f7b4054e3a471c882f8a077a00, block slot = 4601248).  Please ensure that the supplied initial state corresponds to the latest finalized block as of the start of epoch 143789 (slot 4601248).

Note, if chain data already exists the synclink-teku-node container will not reload from initial state:

Not loading specified initial state as chain data already exists.

In such case you need to shutdown all containers, remove data created by the example and run the example again.

3. Verify sync status of the beacon node

To verify the sync status of the new beacon node run the following command in your terminal:

curl http://127.0.0.1:5051/eth/v1/node/syncing

The expected response is a JSON string, where sync_distance should be close to 0, for example:

{"data":{"head_slot":"4601374","sync_distance":"0","is_syncing":true,"is_optimistic":true}}

4. Optionally check availability of other resources

In your preferred web browser open:

To verify the existense of the execution node run the following command in your terminal:

curl --location --request POST http://127.0.0.1:8545 --data-raw '{"jsonrpc": "2.0","method": "web3_clientVersion","params": [],"id": 1}' -H 'Content-Type: application/json'

The expected response is a JSON string, that should be similar to this:

{
  "jsonrpc" : "2.0",
  "id" : 1,
  "result" : "besu/v22.10.3/linux-aarch_64/openjdk-java-11"
}

5. Shutdown and remove all containers

Finally, end the example by removing all created containers:

docker-compose --project-name synclink-example down

6. Remove data created by the example

To remove the example data on Linux and macOS:

rm -r ./synclink-example-data

To remove the example data on Windows:

rd /S /Q ./synclink-example-data

7. Summary

This was just a simple demonstration of SyncLink. The project is currently in alpha state and under heavy development thus many more features (that we are sure you'll absolutely enjoy) will follow soon!

To summarize all the used example commands (used with the synclink-example.yaml file) at once:

# Pull or refresh all docker images used by the example (optional)
docker-compose -f synclink-example.yaml pull

# Start Docker containers of the example
docker-compose -f synclink-example.yaml up -d

# Inspect logs of all containers associated with the example (press CTRL+C to close log view!)
docker-compose --project-name synclink-example logs --follow

# Verify the sync status of the new beacon node
curl http://127.0.0.1:5051/eth/v1/node/syncing

# Shutdown all Docker containers of the example and remove them
docker-compose --project-name synclink-example down

# Remove the example data on Linux and macOS
rm -r ./synclink-example-data

# Remove the example data on Windows
rd /S /Q ./synclink-example-data

For advanced usage we would recommend you to read the SyncLink Server documentation and the SyncLink Client documentation in detail.