I am using a clone of the pancakeSwap lottery and attempting to use a write function. I keep getting an error in the BSC testnet VRFCoordinatorV2 contract saying revert InvalidCalldata();. The function I'm calling only takes a uint as an input, but somewhere along the line it checks if data.length == 32 and it's failing. Here is my failed tx:


Why is this happening?

  • what values are you setting for _keHash and _seed param inputs? for _keyHash for BSC testnet it should be 0xd4bb89654db74673a187bd804519e65e3f71a52bc55f11da7601a13dcf505314. For seed it should be any not null value Apr 8 at 0:52
  • Oh I was uisng 0xcaf3c3727e033261d383b315559476f48034c13b18f8cafed4d871abe5049186 which is the V1 keyHash. Could this explain the problem?
    – EKN
    Apr 8 at 16:23
  • I switched keyhases to the one you listed, still same error.
    – EKN
    Apr 8 at 21:56
  • what are you using for the seed phrase input parameter? Apr 11 at 0:06
  • Are you referring to the requestRandomness() fxn? That input is not entered manually; it is a keccak256 hash of the lotteryId and currentTicketId, which is calculated by the lottery contract, and then passed to the RNG generator contract which does the rest.
    – EKN
    Apr 11 at 15:46


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.