Use the Epoch Nonce seeds and compare with the Pool sigma derived VRF key of the Pool to calculate the block assignment schedule.
No cardano-node Required, data is taken from blockfrost.io and armada-alliance.com.
This is a rewritten in Haskell of the ScheduledBlocks in Python.
Get the scheduled block in past epoch (current epoch included)
$ scheduled-blocks history --epoch 321 \
--blockFrostApi $BLOCKFROST_API \
--poolId $POOL_ID \
--vrfSkey ~/vrf.skey
Checking current network epoch...done
Checking Pool Sigma from Pool History...done
Checking epoch parameters...done
Checking epoch info for active stake...done
Checking network genenis...done
Nonce: 97be25ab0a46a6537faaf32f882de17611c897f32c7eeef12f53a176b225e461
Active Slot Coefficient: 0.050
Epoch Length: 432000
Slot Length: 1
First Slot of Epoch: 53308800
Last Slot of Epoch: 53740800
Active Stake (epoch 321): 23,537,719,498,083,358
Pool Active Stake: 916,392,141,238
Pool Sigma: 0.000038933
Slot 53309568 block assigned. Time 2022-02-15 04:57:39 +0700
Working [==================>......] 74%
Get the scheduled block for the next epoch by query the nonce from armada-aliance.
Note: Next nonce is announce 1.5 days before the end of current epoch.
Perform the epoch schedule calculation for all epoch starting from --fromEpoch flag to current epoch.
With each iteration save the block schedule into file in output directory, under file name <epoch>.json name.
$ scheduled-blocks persistReport --output ./block-schedules/ --fromEpoch 321 --blockFrostApi $BLOCKFROST_API --poolId $POOL_ID --vrfSkey ~/vrf.skey
Checking current network epoch...done
./block-schedules/321.json file not exist
================================================================================
Checking current network epoch...done
Checking Pool Sigma from Pool History...done
Checking epoch parameters...done
Checking epoch info for active stake...done
Checking network genenis...done
Checking first Shelly block...done
Epoch: 321
Nonce: 97be25ab0a46a6537faaf32f882de17611c897f32c7eeef12f53a176b225e461
Active Slot Coefficient: 0.050
Epoch Length: 432000
Slot Length: 1
First Slot of Epoch: 53308800
Last Slot of Epoch: 53740800
Active Stake (epoch 321): 23,537,719,498,083,358
Pool Active Stake: 916,392,141,238
Pool Sigma: 0.000038933
Slot 53309568 block assigned. Time 2022-02-15 04:57:39 +0700
Slot 53719603 block assigned. Time 2022-02-19 22:51:34 +0700
CPU time: 69.54s
already check epoch 322
[]
already check epoch 323
[
{
"slot": 54456018,
"time": "2022-02-28T04:25:09Z"
}
]
This tool depends on libsodium for the calculation of the crypto vrf seed bytes.
Install by source: https://github.com/input-output-hk/libsodium
git clone https://github.com/input-output-hk/libsodium
cd libsodium
git checkout tdammers/rebased-vrf
./autogen.sh
./configure
make
sudo make installRecommend to use GHCup https://www.haskell.org/ghcup/
Use ghcup tui to select:
- ghc
8.10.7 - cabal
3.6.0.0
cabal build
# If cabal cannot find the correct lib path for libsodium, it can be provided by
# cabal build --extra-lib-dirs=/usr/local/libI’m trying to implement concurrency code for the slot leader calculation. At the moment, speed not yet change much as I’m still learning Haskell and the implementation may not correct.
If you like to try out the concurrency code. It can be run using RTS flag: +RTS -N4 where 4 is the number of available cores.
cardano blockchain, block schedule, epoch, blockfrost, armada-alliance
Copyright (c) 2022-, Quang Tran.