NFT Reveal Mechanics: Fair Randomness with Chainlink VRF
Reveal is the moment when an NFT "opens": the placeholder image is replaced with the final one. Technically, it's an update of baseURI in the contract or a switch in tokenURI logic. The problem isn't implementing the reveal itself—it's fairness: who knew the final tokenId→trait mapping before opening, and could they use it to snipe rare tokens? Without verifiable randomness, the community loses trust, and rare tokens go to snipers rather than random minters. We develop such mechanics turnkey, guaranteeing transparency and verifiable randomness. Our team has experience in dozens of production projects where fair reveal was a key trust factor.
Let's look at the existing technical solutions and why Chainlink VRF is the only reliable choice for a fair reveal.
How Chainlink VRF Solves the Fairness Problem
Chainlink VRF (Verifiable Random Function) v2 is the only production-ready way to obtain verifiably random numbers on-chain. The scheme:
- The contract requests randomness via
requestRandomWords(keyHash, subId, confirmations, callbackGasLimit, numWords) - The Chainlink oracle generates a random number plus cryptographic proof
- After 1-3 blocks,
fulfillRandomWords(requestId, randomWords)is called in our contract - The contract stores
revealOffset = randomWords[0] % totalSupply
After reveal: tokenURI(tokenId) returns metadata for (tokenId + revealOffset) % totalSupply. The team does not know revealOffset until receiving the response from VRF—fairness is guaranteed cryptographically.
Subscription vs Direct Funding
VRF v2 supports two payment models. Subscription—you top up a LINK balance on a subscriptionId; multiple contracts can share one subscription. Direct Funding—each request is paid separately. For reveal we use Subscription: one request per project, cost per call on Polygon is approximately 0.01 USD, on Ethereum 0.1–0.2 LINK. Important: callbackGasLimit must cover fulfillRandomWords execution. If the gas is too low, the callback fails and randomness is lost. For simple reveal, 100k gas is enough.
Why On-Chain Randomness Is Not a Solution
Early projects used blockhash(block.number - 1) or keccak256(abi.encodePacked(block.timestamp, msg.sender)) as randomness sources. Both are predictable. The miner (on PoW) or validator (on PoS) controls block.timestamp within a few seconds. An attacking contract can check which trait it will receive and revert if unfavorable—this is called a reroll attack.
Any on-chain randomness source is vulnerable because the result is deterministic and visible in advance to whoever builds the block. VRF is 100% more reliable: it uses a cryptographic proof that cannot be forged.
Why Order Custom NFT Reveal Mechanics from Us
We have implemented over 30 NFT projects with reveal, including VRF integration on Ethereum, Polygon, and BNB Chain. Our engineers are Chainlink certified and have passed audits by leading firms. Contact us for a consultation on integrating a fair reveal today.
Alternative Approaches
| Method | Security | Transparency | Trust-minimization |
|---|---|---|---|
| Commit-reveal by team | Low (trust in team) | Medium (hash fixed) | No |
| Delayed metadata upload | Medium (no fairness guarantee) | Low | No |
| Provenance hash | High (content commitment) | High | Partial |
| Chainlink VRF | High (crypto proof) | High | Yes |
Cost and Time Comparison
| Method | Cost (LINK) | Setup time | Sniping risk |
|---|---|---|---|
| Chainlink VRF | 0.1–0.2 on Ethereum, 0.01 on Polygon | 2–4 days | None |
| Commit-reveal | 0 (gas for 2 txs) | 1–2 days | Yes (team trust) |
| Delayed upload | 0 (gas for upload) | 1 day | Yes (server dependent) |
What's Included
- Audit of the current contract for reveal compatibility
- Development/modification of smart contract with VRF integration
- Chainlink VRF configuration (subscription, consumer)
- Full documentation and launch instructions
- Testnet testing (Sepolia, Goerli, etc.)
- 30-day post-deployment support
Our team's experience: 7+ years in blockchain development, 30+ NFT projects delivered. We have worked with Ethereum, Polygon, BNB Chain, and others.
Contract Implementation
uint256 public revealOffset; bool public revealed; string public unrevealedURI; function tokenURI(uint256 tokenId) public view override returns (string memory) { if (!revealed) return unrevealedURI; uint256 revealedId = (tokenId + revealOffset) % totalSupply(); return string(abi.encodePacked(baseURI, revealedId.toString(), ".json")); } // Called only once after mint completion function requestReveal() external onlyOwner { require(!revealed, "Already revealed"); // Chainlink VRF v2 request COORDINATOR.requestRandomWords(keyHash, subId, 3, 100000, 1); } function fulfillRandomWords(uint256, uint256[] memory randomWords) internal override { revealOffset = randomWords[0] % totalSupply(); revealed = true; emit Revealed(revealOffset); } How to test VRF with Foundry?
Use VRFCoordinatorV2Mock from the Chainlink library. Deploy the mock, create a subscription, and add a consumer. In tests, call requestReveal and simulate the callback:
function testReveal() public { // mint tokens // request reveal // mock fulfillRandomWords vm.prank(coordinatorAddress); vrfCoordinator.fulfillRandomWords(revealRequestId, address(nft)); assertTrue(nft.revealed()); } A full example is in our documentation.
Work Process
VRF Configuration (1 day). Register a subscription on vrf.chain.link, fund LINK, add consumer contract.
Development and tests (1-2 days). Contract with VRF integration. Foundry mock for local fulfillRandomWords testing.
Sepolia testing (1 day). VRF works on all major testnets. Verify the full flow: mint → requestReveal → wait for callback → check tokenURI.
Timeline Estimates
Reveal mechanics as a standalone component for an existing contract: 2-4 days. As part of a full collection development: included in the main scope.
Chainlink VRF is the de facto standard for verifiable randomness, recommended by audit firms (ConsenSys Diligence, OpenZeppelin). Our engineers are certified and have integrated VRF in dozens of production projects.
Contact us—we will estimate your project within 1-2 days and propose the optimal solution. Request a consultation on fair reveal integration today.







