Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Publish block data to external services via webhooks #1444

Merged
merged 2 commits into from
Oct 19, 2023

Conversation

AdarshRon
Copy link
Collaborator

@AdarshRon AdarshRon commented Oct 18, 2023

What does this implement/fix? Explain your changes.

This PR adds a DataPublisher utility class to the nightfall client, that is used to publish L2 block data to external services via webhook. This is enabled via the environment variable CALL_WEBHOOK_ON_CONFIRMATION. The url of the webhook is configurable via the environment variable WEBHOOK_PATH.

The DataPublisher supports multiple destinations(webhook for now, could be different transport mechanisms in future like grpc or socket), including multiple webhook destinations for fallback/backup.

The PayloadSigner class abstracts away the optional signing of the payload using HMAC. The signing key(secret) is configurable via the environment variable WEBHOOK_SIGNING_KEY.

The RetryHandler class abstracts away the retry mechanism with exponential backoff strategy that is configurable via environment variables CALL_WEBHOOK_MAX_RETRIES and CALL_WEBHOOK_INITIAL_BACKOFF.

Does this close any currently open issues?

No

What commands can I run to test the change?

  • Add the required environment variables to docker-compose.dev.yml:
   environment:
       - CALL_WEBHOOK_ON_CONFIRMATION=true
       - WEBHOOK_PATH=http://<webhook_url>
       - WEBHOOK_SIGNING_KEY=<secure_signing_key>
  • Perform tokenisation/mint and wait for layer 2 block to be confirmed.
  • Observe the published data on a destination webhook url.

@Westlad Westlad merged commit f497017 into master Oct 19, 2023
20 checks passed
@Westlad Westlad deleted the adarsh/data-publisher branch October 19, 2023 11:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants