Tool for signing uptime vote and rewards in FTSO V2 protocol.
NOTE: Ensure that you work in a secure environment (server).
Create an environment file (.env
) with the following content (see template):
SIGNING_POLICY_PRIVATE_KEY
- Private key of the signing policy address. Private key should be prefixed with0x
.NETWORK
- Network on which to sign (flare
,songbird
,coston
,coston2
).PRIVATE_KEY
- Private key of the address that will be used to send transactions (recommended not to be the same asSIGNING_POLICY_PRIVATE_KEY
to avoid nonce issues since the signing policy address is used for finalizations by Flare Systems Client). Recommended to use a private key, distinct of any data provider entity keys, specifically used for sending transactions and paying gas. Private key should be prefixed with0x
.- Optionally one can set custom RPC endpoints for each network that will override the public ones (e.g. for Flare network one should set
FLARE_RPC=<private_rpc>
, for others useSONGBIRD_RPC
,COSTON_RPC
,COSTON2_RPC
).
A data provider is encouraged to use more advanced approaches like cloud key management tools to initialize specific environment variables more securely.
Recommended Node.js versions are 18-20.x.x.
- Clone the repo.
- Install dependencies:
yarn
- Build the tool:
yarn build
Signs hash-of-zero Merkle root and sends it as a vote for uptime voting to FlareSystemsManager
.
bin/signing-tool uptime --reward-epoch-id <reward_epoch_id>
Fetches the reward distribution data from reward calculation results. It prints out the data and once confirmed it signs them with SIGNING_POLICY_PRIVATE_KEY
and sends them to FlareSystemsManager
smart contract.
bin/signing-tool rewards --reward-epoch-id <reward_epoch_id>
Checks the signing status for both uptime vote and reward
bin/signing-tool status --first-reward-epoch-id <reward_epoch_id>
The tool communicates with FlareSystemsManager
smart contract that handles the steps in the Flare Systems Protocol.
The part of the protocol immediately after the end of each reward epoch includes voting for uptime and voting for rewards by data providers that held voting weight in the reward epoch.
The tool handles two actions:
- signing and sending Merkle root for up time voting,
- signing and sending Merkle root for the reward distribution.
Note that signing and sending constitute voting for the signed Merkle root with the signers weight. The vote is concluded once 50%+ of the weight votes for the same Merkle root.
In current deployments uptime voting is not fully supported and used. But since Flare Systems Protocol requires concluded uptime voting in order to start reward distribution voting the data providers have to sign Merkle root which is the hash (sha256). The method signUptimeVote
on FlareSystemsManager
smart contract is used.
Currently Flare calculates rewards using the reward calculation algorithm and publishes the results. If data providers agree on those results they can sign them using the Signing tool as described above. The method signRewards is used on FlareSystemsManager
smart contract.