VRF Hash RanCh
In smart contract development, ensuring the security and tamper-proof nature of data is of utmost importance, particularly when random number generation is involved. Manipulation of such data can cause significant damage to the entire system. To tackle this problem, Scry introduces HashRanCh, a Verifiable Random Function (VRF) that provides a secure and verifiable way of generating random numbers in smart contracts.
HashRanCh VRF Hashing Process: The VRF hashing process involves the following steps:
Step 1: Use the private key of the oracle as the seed for the VRF hash. This step ensures that the hash is unique to the oracle and cannot be manipulated by external factors.
Step 2: Compute a sequence of hashes starting from the seed. The number of hashes to compute is determined by subtracting the feedID from 100,000. This is done to generate a unique random number for each input value without revealing the seed for future values.
Step 3: Hash the VRF seed with the request to get a value. This value can be used wherever needed in the smart contract.
Step 4: The verifiers can then check that the seed for their hash is the parent seed for all other hashes that have been committed, but not for future hashes. This ensures that the oracle could not have known the value without knowing the salt that was going to be provided as well as which ID was going to request it at the very start of the oracle's deployment.

Verifier
You can use the verifier to verify that any value from the oracle was created using the same seed.
Function: vrf
Description: This function calls the vrfHashCheck function and logs the expected hash value to the console.
Syntax:
Parameters:
upstream(string): The proof hash.startID(number): The ID of a parent request proof.tfeedID(number): The ID of the request to be verified.salt(string): The salt value used in the VRFvalue(string): The expected hash value.
Return Value: This function does not return any value, but it logs the expected hash value to the console.
Sample
contract
Last updated