Welcoming Bridges: Chainlink Adaptor Framework

Jonny Huxtable
LinkPool
Published in
4 min readApr 16, 2019

At LinkPool we’re committed to developing the Chainlink ecosystem, pushing it further and lowering the barrier of entry for all. Today we’re happy to announce our next ecosystem development, with a new tool called Bridges.

We believe Bridges to be a huge step forward in the Chainlink ecosystem, allowing adaptors to be rapidly developed and shared within minutes.

Bridges: A new Chainlink adaptor framework

GitHub: https://github.com/linkpoolio/bridges
Download: https://github.com/linkpoolio/bridges/releases

To install Bridges, just download the right version for your operating system, extract the archive and add the bridges CLI to your PATH or call it directly.

What is it?

Bridges is a Chainlink adaptor framework that lowers the level of skill needed to create and run adaptors. It provides a common interface and a CLI, allowing adaptors to be defined in very little JSON, or alternatively allowing developers to easily create their own without worrying about the specific integration points to work with a Chainlink node.

To show a very basic example, here’s a Bridges-supporting JSON file which calls the CryptoCompare API for Ethereums current price:

[
{
"name": "CryptoCompare",
"method": "GET",
"url": "https://min-api.cryptocompare.com/data/price?fsym=ETH&tsyms=USD,JPY,EUR"
}
]

That’s all that’s needed to create your very own adaptor. Just specify its name, the HTTP method and the URL that will be called.

To then run this, you can either specify a URL or a JSON file path to the Bridges CLI:

bridges -b https://s3.linkpool.io/bridges/cryptocompare.jsonORbridges -b json/cryptocompare.json

Once you run this command, Bridges will start a new HTTP server and will listen to any inbound requests from a Chainlink node. Upon receiving a request, Bridges will call the CryptoCompare API and then return the data in the correct format to then be parsed by Chainlink.

Platform Support

Bridges doesn’t just support running it locally via the CLI, it also supports a variety of platforms, including:

  • Docker
  • AWS Lambda
  • Google Cloud Platform Functions

For any adaptor you create, it’s automatically supporting of any of the above! Any Bridges adaptor JSON works in AWS or GCP by default! 🎉

Other Examples

We have built Bridges adaptor examples for the following:

All of the above examples work and can be used on your Chainlink node now.

Why is this important?

Before the development of Bridges, each Chainlink adaptor had its own implementation of how it handles the data sent by a Chainlink node. There was no standard toolset to aid developers in doing this, meaning each adaptor had the same code to do the same thing duplicated throughout.

With Bridges, that is now all done for you. You have a standard interface for creating your own adaptor, or you can just simply define the adaptor in JSON and share it with others. As a developer, the only code you have to now write is how the API you’re wanting to call is called, rather than worrying about how it integrates with Chainlink.

We believe that with Bridges, the amount of adaptors that will be created for Chainlink will increase drastically. Users and node operators will feel empowered to be able to quickly support whatever API they want to use within Chainlink, we’re proud to allow that to happen.

Custom Implementations

To create adaptors that can do literally anything besides proxying a single API, Bridges has a simple interface that you can implement to create your own. For example:

package main

import (
"github.com/linkpoolio/bridges/bridge"
)

type MyAdaptor struct{}

func (ma *MyAdaptor) Run(h *bridge.Helper) (interface{}, error) {
return map[string]string{"hello": "world"}, nil
}

func (ma *MyAdaptor) Opts() *bridge.Opts {
return &bridge.Opts{
Name: "MyAdaptor",
Lambda: true,
}
}

func main() {
bridge.NewServer(&MyAdaptor{}).Start(8080)
}

You can copy this code into your Golang IDE and run it. You’ll see an adaptor start that when called always returns {data: { "hello": "world" }} as part of the Chainlink request.

You can simply expand on that to allow you to fetch any data from any source easily. You can return any type back as the result, and Bridges will automatically parse it and include it into the JSON back to the Chainlink node.

Simple.

Bridges Roadmap

We’re dedicated to carry on expanding Bridges to make it easier and easier for people to create and run adaptors of any kinds. So far, we have the following features planned the future:

Open Sourced Repositories

Bridges right now supports using URLs to fetch any adaptor JSON to run, but it’s lacking versioning and any standardised repository like you’d find in tools like Docker. We want to implement that for Bridges, providing a searchable repository of Bridges supporting adaptors. This will allow you to run adaptors like you would do docker, for example:

bridges run linkpool/rapidapi:latest

Adaptor Creation UI

Since we can use JSON to power adaptors in Bridges, we can also create a UI for people to create their very own adaptors in record time without any prior technical background.

Native AWS S3 Support

As part of the URLs you can pass into Bridges, we want to also support native S3 URLs. For example: s3://my-bucket-name/bridges/myadaptor.json

This will make it easier for people running Bridges in AWS Lambda, meaning they don’t have to make their bucket publicly readable.

Feature Requests

This is very much a feature built for the community, so we are very much open to feedback and any feature requests you may have. Want to discuss something? Raise a ticket on Github or join our Gitter.

We hope you find this as valuable to the ecosystem as we do. I’m thrilled to be sharing this as I personally think that having a standardised framework like this for Chainlink adaptors will push the ecosystem forward in big ways.

As always, if this is the first time you’re hearing about LinkPool or what we do, see our social channels below:

Thanks for reading.

--

--