📂 Reference

# Beacon ID Scheme

Table of Contents

When accessing a Beacon's value with the readBeacon() function only the beaconId is needed by the caller to access its value. The use of a templateId is only required when there is a need to update a Beacon value. Usually this is called by the Beacon itself and is not a normal operational procedure a Beacon consumer needs to concern themselves with.

A Beacon will update itself when an allowed deviation of its current value is met. Behind every Beacon there is a single template. Additionally, behind every Beacon template there is an Airnode which returns the Beacon's value from an API endpoint. The template contains the parameters used by Airnode when calling the API endpoint. Additional Beacon parameters may be required to merge with the template for the Airnode to call an API endpoint. This entire process is completed using the function requestBeaconUpdate().


Useless you intent to ask the Beacon to update itself, outside of its normal update process, the use of a Beacon's template will be of no concern. However to update a Beacon manually a requester will need the templateId of the Beacon when calling the requestBeaconUpdate() function.

# Deriving IDs

Create a templateId by hashing the Airnode address, the endpointId and the parameters of the template. See the createTemplate() (opens new window) function in the monorepo.

Create a beaconId by hashing the templateId and the Beacon parameters. See the requestBeaconUpdate() (opens new window) function in the monorepo.

The templateId cannot be derived from the beaconId.

Last Updated: 5/15/2022, 11:04:51 AM