oceanprotocol-archive / pdr-predictoor

Server to submit predvals to chain every 5 min
Apache License 2.0
0 stars 0 forks source link

First cut: it may work, with errors

Flow

How to run

For full flow see README

export RPC_URL=http://127.0.0.1:8545
export SUBGRAPH_URL="http://172.15.0.15:8000/subgraphs/name/oceanprotocol/ocean-subgraph"
export PRIVATE_KEY="xxx"
export STAKE_AMOUNT=1

where:

Install requirements if needed

pip install -r requirements.txt

Start the predictoor:

python3 main.py

Additional ENV variables used to filter:

Fork and customize

The actual prediction code is in predict.py.

We call predict_function with 2 args:

BLOCKS_TILL_EPOCH_END

If we want to predict the value for epoch E, we need to do it in epoch E - 2 (latest. Of course, we could predictor values for a distant epoch in the future if we want to) And to do so, our tx needs to be confirmed in the last block of epoch (otherwise, it's going to be part of next epoch and our prediction tx will revert)

But, for every prediction, there are some steps involved, each one taking it's toll on duration:

TO DO