Everything in this document should be executed from the root directory of the following git repository.
git clone https://github.com/Bisonai/vrf-consumer
yarn install
npx mnemonics
MNEMONIC=<YOUR MNEMONIC FROM STEP 1>
PROVIDER=https://api.baobab.klaytn.net:8651
npx hardhat address --mnemonic "<YOUR MNEMONIC FROM STEP 1>"
Insert your address from previous step and request $KLAY.
https://baobab.wallet.klaytn.foundation/faucet
https://github.com/Bisonai/vrf-consumer/blob/master/contracts/VRFConsumer.sol
function requestRandomWords(
bytes32 keyHash,
uint32 callbackGasLimit,
uint32 numWords,
address refundRecipient
) external payable returns (uint256 requestId);
function requestRandomWords(
bytes32 keyHash,
uint64 accId,
uint32 callbackGasLimit,
uint32 numWords
) external returns (uint256 requestId);
yarn compile
npx hardhat deploy --network baobab
npx hardhat run scripts/read-vrf.ts --network baobab
npx hardhat run scripts/request-vrf-direct.ts --network baobab
npx hardhat createAccount --network baobab
npx hardhat deposit \
--account-id $ACCOUNT \
--amount $AMOUNT \
--network baobab
npx hardhat addConsumer \
--consumer $CONSUMERADDRESS \
--account-id $ACCOUNT \
--network baobab
npx hardhat run scripts/read-vrf.ts --network baobab
npx hardhat run scripts/request-vrf.ts --network baobab