# Relay Quickstart

Symbiotic Super Sum spins up a relay network that runs simple sum computations. Schedule a job
on any supported chain and the result is posted to every supported destination chain.

![relay-network.png](/img/relay-network.png)

:::steps
## Clone Repository & Install Dependencies

Clone the Symbiotic Super Sum repository, initialize its submodules, and install the dependencies.

```bash [bash]
git clone https://github.com/symbioticfi/symbiotic-super-sum.git
cd symbiotic-super-sum
git submodule update --init --recursive
npm install
```

The `symbiotic-super-sum/` directory is created and includes initialized submodules.

## Generate Network Configuration

Generate the local network definition and helper artifacts Docker uses to start the stack.

```bash [bash]
./generate_network.sh
```

The script prompts for operator counts and creates a new `temp-network/` directory with `docker-compose.yml` and writable data directories.

## Start Network

Launch the Anvil chains, deployer, and relay services defined in the generated Compose file.

```bash [bash]
docker compose --project-directory temp-network up -d
```

This command launches the network services in Docker containers.

```bash [Expected output]
symbiotic-super-sum % docker compose --project-directory temp-network up -d
[+] Running 9/9
✔ Network temp-network_symbiotic-network  Created                                                                                                                                                                   0.1s
✔ Container symbiotic-anvil-settlement    Healthy                                                                                                                                                                   4.2s
✔ Container symbiotic-anvil               Healthy                                                                                                                                                                   4.2s
✔ Container symbiotic-deployer            Exited                                                                                                                                                                  128.5s
✔ Container symbiotic-genesis-generator   Exited                                                                                                                                                                  138.2s
✔ Container symbiotic-relay-1             Started                                                                                                                                                                 138.4s
✔ Container symbiotic-relay-2             Started                                                                                                                                                                 138.4s
✔ Container symbiotic-sum-node-1          Started                                                                                                                                                                 138.6s
✔ Container symbiotic-sum-node-2          Started
```

### Additional commands

Check status:

```bash [bash]
docker compose --project-directory temp-network ps
```

View logs:

```bash [bash]
# View all logs
docker compose --project-directory temp-network logs -f

# View specific service logs
docker compose --project-directory temp-network logs -f anvil
docker compose --project-directory temp-network logs -f anvil-settlement
docker compose --project-directory temp-network logs -f deployer
docker compose --project-directory temp-network logs -f genesis-generator
docker compose --project-directory temp-network logs -f relay-sidecar-1
docker compose --project-directory temp-network logs -f sum-node-1
```

Stop the network:

```bash [bash]
docker compose --project-directory temp-network down
```

Clean up data:

```bash [bash]
docker compose --project-directory temp-network down -v
rm -rf temp-network
```

## Create Task

Submit a sum task to the network.

```bash [bash]
taskID=$(cast send --rpc-url http://127.0.0.1:8545 --json \
--private-key 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 \
0x4826533B4897376654Bb4d4AD88B7faFD0C98528 \
"createTask(uint256,uint256)" 33 9 | jq -r '.logs[0].topics[1]')
```

This creates a task for the network, which later collects the required number of attestations and broadcasts the result to every supported destination chain.

## Verify Task Result

It is possible to verify result on the first chain:

```bash [bash]
result=$(cast call --rpc-url http://127.0.0.1:8545 \
0x4826533B4897376654Bb4d4AD88B7faFD0C98528 \
"responses(bytes32)" $taskID)
cast decode-abi --json "data()(uint48,uint256)" $result
```

It is also possible to verify result on the second chain:

```bash [bash]
result=$(cast call --rpc-url http://127.0.0.1:8546 \
0x5FC8d32690cc91D4c39d9d3abcBD16989F875707 \
"responses(bytes32)" $taskID)
cast decode-abi --json "data()(uint48,uint256)" $result
```

This prints the task result with the corresponding timestamp.

```bash [Expected output]
symbiotic-super-sum % result=$(cast call --rpc-url http://127.0.0.1:8545 \
0x4826533B4897376654Bb4d4AD88B7faFD0C98528 \
"responses(bytes32)" $taskID)
cast decode-abi --json "data()(uint48,uint256)" $result
[
    1754052445,
    42
]
```

## Build!

[Get hands-on experience with the Relay SDK - a modular set of on-chain / off-chain components to implement Proof of Stake](/v1/integrate/networks/)
:::
