This is a time statistics application that returns a random number of the vrf contract on the blockchain binance smart chain network.
- VRFv2DirectFundingConsumer.sol : This is a contract that provides a function to find random numbers based on chainlink
- Request.js : get the contract address and make a call to a large number of transactions and save the requestId in mongoDB
- Listen.js : get the contract address and listen to the event that generates a random number and then update the response time into mongodb. However, terminating the listening must be done manually.
- requestId : last requestId of smart contract
- requestTimeStamp : timestamp when calling random number function
- responseTimestamp : timestamp when event was heard
Get data from mongodb for scatterplot analyst
- Clone the repo
https://github.com/ngocban284/vrf-survey-time.git
- Install NPM packages
npm install
- You must enter your Environment variables
VRF_ADDRESS = vrf contract address in bsc testnet
MONGO_URI = your mongodb uri
- Request and Listen event
npx hardhat run ./scripts/Request.js --network bscTestnet
npx hardhat run ./scripts/Listen.js --network bscTestnet
- scatterplot analyst
python3 ./analysis/index.py
You must make sure vrf contract has LINK token and your wallet address must have BNB testnet