hemilabs / heminetwork

The hemi network core daemons.
MIT License
11 stars 6 forks source link

PoP Miner Stats Daemon for Absinthe Reporting #170

Open max-sanchez opened 2 weeks ago

max-sanchez commented 2 weeks ago

Confirmation

Problem

We need a way to inform Absinthe of PoP miners.

Suggested solution

Create a simple daemon we can run which scans our testnet for PoP payouts and reports them to Absinthe.

Suggested design: Daemon that can run 24/7 and is configured with a starting L2 height and a delay (in L2 blocks) which it scans up to. Upon initial startup, daemon scans from the starting L2 height up to the tip minus the delay. As additional L2 blocks come in, the daemon progresses scanning new L2 blocks, always up to tip - delay. As the Daemon progresses, it keeps track of a state machine which maps each EVM address to the L2 block height(s) in which it received a PoP payout. For each block it scans, it checks if a PoP Payout transaction exists. If it does, it extracts the payout EVM addresses from the transaction's data used to call the GovernanceToken contract, and uses that information to update the state machine it tracks.

TODO: Decide how to report this collected data to Absinthe - they've said they're "flexible" but I'm getting more details on exactly how this would look - probably a POST request to their endpoint, but need to decide whether we're reporting state changes, and how that gets processed on Absinthe's side for our points setup.

Additional Information

No response

gabmontes commented 2 weeks ago

@max-sanchez I have the deamon core functionality ready. Please provide the following parameters:

In addition, please provide more information on how to report the data to Absinthe or contact me with whoever I can talk to in order to obtain that definition.

gabmontes commented 1 week ago

Adding [edited] notes sent by @max-sanchez:

So the utility you wrote needs to be able to run for a specific day (basically pull PoP txes for each day based on start/end timestamps) and call the Absinthe endpoint to report points only once for each day. The data we'll need to send to Absinthe is: