📂 Concepts and Definitions

# Template

An oracle request has many parameters. It is very common for requesters (e.g., a data feed) to make repeated requests with the exact same parameters. In such instances, it is wasteful to pass all of these parameters repeatedly.

Templates are on-chain records of request parameters that the requesters can refer to while making requests. Additional advantages are reducing boilerplate code required to make a request, improving UX and allowing large parameter payloads (e.g., off-chain computation specifications) at no additional gas cost.

struct Template {
    address airnode;
    bytes32 endpointId;
    bytes parameters;
}
1
2
3
4
5

# templateId

Each template is identified by a templateId, which is the hash of its contents. This allows Airnode to fetch templates with a static call, and verify that the received parameters are not tampered with.

templateId = keccak256(abi.encodePacked(
  airnode,
  endpointId,
  parameters
));
1
2
3
4
5
Last Updated: 8/25/2022, 12:08:02 PM