Integration Process
This section outlines the process of integrating a new data feed into the Entangle Unified Data Feed system. The default integration flow ensures smooth onboarding of new data sources and utilizes UDF’s capabilities for fetching, parsing, and distributing data on-chain.
Key Components:
REST URL Template: Defines how data is fetched from external sources.
Pipelines for Parsing: Parses relevant information from the fetched data, such as price, timestamp, and volume.
Steps for Integration
1. Reach out to Entangle
Before integration begins, the protocol should provide Entangle with:
Initial Data with Examples: Real sample data that the integration will process.
Data Processing Requirements: Outline any data transformation or formatting needed for the final output to be distributed on-chain.
Update Frequency Suggestions: Provide suggestions on how frequently updates should occur, allowing customization to meet the protocol’s needs.
Entangle UDF offers a generic REST interface solution for asset feeds. The required components include:
REST URL Template: A template for fetching data using REST, leveraging variables such as
DataKey
andSourceID
.Parsing Pipelines: For extracting key data (e.g., price, timestamp) from the response JSON using GJSON syntax.
2. Define REST URL Template
Create a URL template that points to the endpoint of the data provider. The template uses Go text syntax, with placeholders such as DataKey
and SourceID
. Example for Binance API:
This URL template is inserted into the configuration file, allowing Entangle's backend to fetch the necessary data.
3. Set Up Parsing Pipelines
In the configuration file, set up pipelines to parse data from the response JSON. Below is an example JSON response structure:
Pipeline for Price:
asset.price
Pipeline for Timestamp:
asset.timestamp
Pipeline for Volume:
asset.volume
These pipelines should be defined using GJSON syntax to extract the required fields.
4. Configure the System
The next step is to implement both the URL template and parsing pipelines in the YAML configuration file. This connects the data feed with Entangle UDF.
Example configuration snippet:
5. Fetch Data
To retrieve data updates, use the Finalized Data API. For example, to fetch the NGL/USD price feed, execute the following curl command:
Sample response:
This response contains the Merkle root, signatures, and data required to verify the update.
6. Verify Data
Once you have fetched the data, use the PullOracle
smart contract to verify the updates on-chain.
7. Monitor and Update
Ongoing monitoring ensures that the integration functions correctly. Periodically review the configuration and update it as needed to accommodate changes in the data provider's API or Entangle’s system.
Last updated