This guide demonstrates how to configure and use the OpenZeppelin Relayer service with logging setup. In this example, we configure and utilize an Ethereum Sepolia Relayer with log files stored on disk.
| Variable | Values | Description |
|---|---|---|
| LOG_MODE | stdout, file |
Write logs either to console or to file |
| LOG_DATA_DIR | <any file path> |
Directory to persist log files on host |
| LOG_MAX_SIZE | <any value in bytes> |
Size after which logs need to be rolled |
Default values are already defined in examples/basic-example-logging/.env.example.
- Docker
- Docker Compose
- Rust (for key generation tools)
Clone this repository to your local machine:
git clone https://github.com/OpenZeppelin/openzeppelin-relayer
cd openzeppelin-relayerCreate a new signer keystore using the provided key generation tool:
cargo run --example create_key -- \
--password <DEFINE_YOUR_PASSWORD> \
--output-dir examples/basic-example-logging/config/keys \
--filename local-signer.jsonNote: Replace <DEFINE_YOUR_PASSWORD> with a strong password for the keystore.
Create examples/basic-example-logging/.env file from examples/basic-example-logging/.env.example.
cp examples/basic-example-logging/.env.example examples/basic-example-logging/.envThen, update the KEYSTORE_PASSPHRASE field in the examples/basic-example-logging/.env file with the password you used.
examples/basic-example-logging/config/config.json file is partially pre-configured. You need to specify the webhook URL that will receive updates from the relayer service.
For simplicity, visit Webhook.site, copy your unique URL, and then update the notifications[0].url field in examples/basic-example-logging/config/config.json with this value.
To sign webhook notification payloads, populate the WEBHOOK_SIGNING_KEY entry in the examples/basic-example-logging/.env file.
For development purposes, you can generate the signing key using:
cargo run --example generate_uuidNote: Alternatively, you can use any online UUID generator.
Copy the generated UUID and update the WEBHOOK_SIGNING_KEY entry in the examples/basic-example-logging/.env file.
Generate an API key signing key for development purposes using:
cargo run --example generate_uuidNote: Alternatively, you can use any online UUID generator.
Copy the generated UUID and update the API_KEY entry in the examples/basic-example-logging/.env file.
Start the service with Docker Compose:
docker compose -f examples/basic-example-logging/docker-compose.yaml upThe service is available at http://localhost:8080/api/v1
curl -X GET http://localhost:8080/api/v1/relayers \
-H "Content-Type: application/json" \
-H "AUTHORIZATION: Bearer YOUR_API_KEY"Verify that examples/basic-example-logging/logs/ contains files with logs.
For additional examples on how to interact with the service via the SDK, refer to the OpenZeppelin Relayer SDK examples.