ChainRelay Webhooks API

Smart Contract Events driven apps — fast.

Michael Street
ChainRelay
Published in
2 min readOct 13, 2018

--

At ChainRelay we strive to make building applications that leverage the Ethereum blockchain and Ethereum Smart Contracts easier to bring to market. Today, we follow up on the alpha release of our RESTful API service for smart contract events with our Webhooks API.

Why Webhooks?

Webhooks allow you to build or set up smart contract applications that subscribe to certain contract events emitted from the Ethereum blockchain. When an event from a smart contract is emitted, we’ll send an HTTP POST payload to your webhook’s configured URL. Webhooks continuously listen for events from your configured contracts and can be used to push notifications, modify state of an application or log data to a separate service or database.

Today, webhooks are a widely used tool on the internet for connecting different application experiences together. For example, GitHub uses webhooks to notify build servers when new code is checked into a repository. Many websites use webhooks to send emails for two-factor authentication or to reset a user’s password. Other apps use webhooks to send text messages via Twilio. You can similarly use smart contract webhooks to build delightful user experiences for your customers. Let your imagination be your guide!

Webhooks in Action

Smart Contract Events are inheritable members of contracts that log specific data to the Ethereum blockchain once functions are called. A contract can specify any number of Events which exposes indexed Event parameters for use outside of the Ethereum Virtual Machine (EVM). ChainRelay allows you to subscribe to Smart Contract Events over HTTP and push the emitted Event data directly to your service or application.

First, you’ll have to get an access token to use the ChainRelay service. With the access token you’ll be able to create, list and delete your webhooks.

Create a new webhook by specifying the payload url, contract address and contract abi. Optionally supply a contract name, headers for the payload request and a list of events to add in the payload.

ChainRelay monitors your subscribed contract for the desired events and will deliver a payload to the address indicated in the URL field of the webhook. You can optionally define a set of headers to include in the payload request, which will include an array of the Event objects matching your criteria.

Example of the body of the payload request delivered by your webhook to the defined URI.

Here at ChainRelay we hope that our webhooks tool enables you to build all sorts of new application integrations! While ChainRelay remains in alpha, please leverage our services at no cost and let us know how we can best serve your needs. Checkout our docs for full details and to generate a free API token.

— ChainRelay team

--

--