A tool to update a beacon server value on a time interval
Refer to the Airkeeper repository here.
This project is basically a makeshift version of the PSP protocol and it will be used to trigger beacon values updates on a fixed time interval of 1 minute.
Airkeeper will fetch the value from the API (similarly to Airnode) and will also read the current beacon value onchain from the beacon contract state. If the delta between the two values is greater than a threshold, the beacon value will be updated onchain by submitting an RRP request that will be fulfilled by the Airnode.
Airkeeper will require a configuration file that matches the one being used by the Airnode that should be used to
update the beacon server value. You can just copy over the config.json file from the Airnode repo and put it in the
/config directory of this repo. Same goes for secrets.env file from the Airnode repo. Examples of these two files
can be found in the /config directory of this repo.
Airkeeper will also require an additional configuration file that will be merged with the one mentioned above and it
will contain the configuration specific to Airkeeper. This file needs to be called airkeeper.json and you can find
an example in the /config directory of this repo.
Another requirement is to have an AWS account and cloud provider credentials must be provided in the aws.env file.
An example of this file can be found in the /config directory of this repo.
Use the docker image to deploy or remove an Airkeeper to and from a cloud provider such as AWS.
The docker image supports two commands.
deploy: Deploys an Airkeeper using configuration files.remove: Removes an Airkeeper previously deployed.You can build the docker image by running the following command from the root directory:
docker build . -t api3/airkeeper
The deploy command will create a new AWS lambda function and a new AWS cloud scheduler.
docker run -it --rm \
--env-file config/aws.env \
-v "$(pwd)/config:/app/config" \
api3/airkeeper:latest deploy --stage dev --region us-east-1
For Windows, use CMD (and not PowerShell).
docker run -it --rm ^
--env-file config/aws.env ^
-v "$(pwd)/config:/app/config" ^
api3/airkeeper:latest deploy --stage dev --region us-east-1
The remove command will delete the previously deployed AWS lambda function and its AWS cloud scheduler.
docker run -it --rm \
--env-file config/aws.env \
-v "$(pwd)/config:/app/config" \
api3/airkeeper:latest remove --stage dev --region us-east-1
For Windows, use CMD (and not PowerShell).
docker run -it --rm ^
--env-file config/aws.env ^
-v "$(pwd)/config:/app/config" ^
api3/airkeeper:latest remove --stage dev --region us-east-1
Make sure to have the following dependencies installed:
In order to run Airkeeper with sample configuration files locally, you will need to follow these steps:
yarn run bootstrap && yarn build to build the project.config.json and secrets.env files to the packages/airnode-node/config directory.yarn run dev:background to start a local ethereum node and a sample REST API.yarn run dev:eth-deploy to deploy and configure the required contracts.npm installnpm run sls:invoke-local to invoke the updateBeacon function.Airkeeper is meant to be deployed to AWS lambda service and for this you will need to add your credentials to the
config/aws.env file. Then, you can use the export-aws-env.sh script to load them into the environment.
npm run sls:config to configure the AWS credentials. You must first configure the config/aws.env
file with your AWS account details and then run source export-aws-env.sh script to load the env vars.npm run sls:deploy to deploy the Airkeeper lambda function.npm run sls:invoke to invoke the Airkeeper lambda function.npm run sls:remove to remove the Airkeeper lambda function.Request sponsor account must first call AirnodeRrp.setSponsorshipStatus(rrpBeaconServer.address, true) to allow the
RrpBeaconServer contract to make requests to AirnodeRrp contract.
A keeperSponsorWallet needs to be derived for the sponsor-airnode pair. This is a similar process to deriving the
sponsor wallet used by Airnode to fulfill requests but in this case the wallet derivation path is slightly different.
This wallet needs to be funded with ETH in order for Airkeeper to use it to submit beacon updates requests.
Request sponsor account must also call RrpBeaconServer.setUpdatePermissionStatus(keeperSponsorWallet.address, true)
to allow the keeperSponsorWallet to update beacon server value.
The template used by the RrpBeaconServer contract is expected to contain all the parameters required in the API call.
Content type
Image
Digest
Size
227.9 MB
Last updated
over 4 years ago
docker pull api3/airkeeper