Skip to content

minaVRFpy is the python adaptation of the batch-check-wittness step from zkvalidator's mina-vrf-rs. This is VERY much work in progress and made available to the mina community for experimental reasons!

License

Notifications You must be signed in to change notification settings

bakebrain/minavrfpy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

minaVRFpy

minaVRFpy is the python adaptation of the batch-check-wittness step from zkvalidator's mina-vrf-rs. This is VERY much work in progress and made available to the mina community for experimental reasons!

Intro

Please refer to mina-vrf-rs for the overall approach. Typically the wittness data is generated by the block producer and shared, then the delegator can run the check (via mina-vrf-rs):

cat witnesses | cargo run --release -- batch-patch-witness --pub B62qpge4uMq4Vv5Rvc8Gw9qSquUYd6xoW1pz7HQkMSHm6h1o7pvLPAN --epoch 5 > patches
cat patches | mina advanced vrf batch-check-witness | sed 's/Using password from environment variable CODA_PRIVKEY_PASS//g' > check
cat check | cargo run --release -- batch-check-witness --pub B62qpge4uMq4Vv5Rvc8Gw9qSquUYd6xoW1pz7HQkMSHm6h1o7pvLPAN --epoch 5

This python script offers an alternative to the batch-check-witness part in order to e.g. gather the data over multiple epochs or to further examine and enrich the data via e.g. jupyter notebooks. See the demos provided.

Setup

clone and install via pip install .. The script relies also on https://github.com/bakebrain/coda-python-client/tree/query-sgqlc-refactoring - an https://github.com/profusion/sgqlc version of the python-coda-client - currently also not "officially" made available. An examples is e.g. https://github.com/bakebrain/coda-python-client/blob/query-sgqlc-refactoring/examples/mina_explorer.ipynb

config.py

this file needs to be edited, inparticular LEDGER_PATH and VRF_CHECKED_PATH need to be created/setup.

MINA_EXPLORER_ENDPOINT - minaexplorer enpoint

LEDGER_PATH - path to a folder where the ledgers are stored, e.g. '/home/user/minavrfpy/data/legers/'.

LEDGER_DOWNLOAD_SOURCE - url of a ledger repo to download unavailable ledgers from, the default is https://raw.githubusercontent.com/zkvalidator/mina-graphql-rs/master/data/epochs

VRF_CHECKED_PATH - path to folder where the "checked" data is stored, e.g. '/home/user/minavrfpy/data/vrf_checked/'. Inside this folder there should be another folder name after the key of the block producer. The checked data should reside inside this folder. In order to deal with mutiple epoch data simultaneously the final data's naming convention is e.g. check-epoch-{epoch_number}, An example structure could be like this:

❯ tree data
data
├── ledgers
│   ├── jwAAZcXndLYxb8w4LTU2d4K1qT3dL8Ck2jKzVEf9t9GAyXweQRG.json
│   ├── jwAXd4GZgxE3YCwqs99g4MpLNiEV2ZfZPstyah4jxo753AVgL6R.json
│   ├── jwJXdYzAikMHnTsw2kYyS1WQxJrGQsy1FKT5c18eHP2wGANafKf.json
│   ├── jwPwVsSPZ2tmmGbp8UrWGmDgFDrrzTPpYcjpWosckmcVZV2kcW7.json
│   ├── jwe63YTTUcc2b4sFdP54ehCZ3Dp9sZKshwCmtoVP3bidzfPfcxw.json
│   ├── jwq7sAxDuN9MrdLjAQULoyrY5hWa6g52SVq8EmajBeBY38zamgz.json
│   ├── jx2XUFjvsvtTKB4HPAzih5boAtuoR34kxjEoU1RUhfXTATyx8tw.json
│   ├── jx4itrnmDkG3ptAiwhitJHt9K8stgFFoenrkZrm2prbtaS54xQU.json
│   ├── jx7buQVWFLsXTtzRgSxbYcT8EYLS8KCZbLrfDcJxMtyy4thw2Ee.json
│   ├── jxBBSjakhQRKLbUM7z99KXNnMke2GbdcJyqpD9gyRoJJybsMRqh.json
│   ├── jxPj7F7aRew1zvpW9JaGSgt9xmJitenrRSM6YGKnuhe5HXqyZtZ.json
│   ├── jxQgtuyHp8nA2P6F9CSRrLcVeHi8Ap7wVHeNnH2UbSX15izcSHK.json
│   ├── jxRySSfk8kJZVj46zveaToDUJUC2GtprmeK7poqWymEzB6d2Tun.json
│   ├── jxVF5YbC3B5Rk6ibfsL97WaqojfxrgWtEqMJST9pb4X8s3kRD2T.json
│   ├── jxVLvFcBbRCDSM8MHLam6UPVPo2KDegbzJN6MTZWyhTvDrPcjYk.json
│   ├── jxct9rteQ7wjhQVf7h4mGQmGZprJMkjbzEWgU7VvV6HEq2DN5yA.json
│   ├── jxhjiLBeMR7pgtV8ogcJvqXdr6asoNrC3g6hoUzEDLBSnZoxUDJ.json
│   └── jxn15ATGoe4WGgYpbssxJH9XW8NXRDy22WvSsBqvMqcnLPgPAwN.json
└── vrf_checked
    ├── B62qob1tGxx1BhychEzzah7yvdbRH3E7SNSTrEtkuSZzR2UBezMChg2
    │   ├── check-epoch-18
    │   ├── check-epoch-19
    │   └── check-epoch-20
    └── B62qpge4uMq4Vv5Rvc8Gw9qSquUYd6xoW1pz7HQkMSHm6h1o7pvLPAN
        ├── check-epoch-0
        ├── check-epoch-1
        ├── check-epoch-10
        ├── check-epoch-11
        ├── check-epoch-12
        ├── check-epoch-13
        ├── check-epoch-14
        ├── check-epoch-15
        ├── check-epoch-16
        ├── check-epoch-17
        ├── check-epoch-2
        ├── check-epoch-3
        ├── check-epoch-4
        ├── check-epoch-5
        ├── check-epoch-6
        ├── check-epoch-7
        ├── check-epoch-8
        └── check-epoch-9

4 directories, 39 files

Examples

checking current epoch

image

block time by outcome

image

See more in the notebook demos.

About

minaVRFpy is the python adaptation of the batch-check-wittness step from zkvalidator's mina-vrf-rs. This is VERY much work in progress and made available to the mina community for experimental reasons!

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages