CCIP is now live for all developers. See what's new.

Back to QuickStarts

Batch Collection Reveal

Use Chainlink VRF and Automation in generative art collections.


Using Chainlink VRF in generative art collections is the standard approach for getting provably random source in smart contracts. By batching the reveal process, instead of making VRF calls for each NFT you can save cost up to 100x in a collection of 10,000 with batch size of 100.

This template uses the Chainlink Automation decentralized network to automate the reveal process so you don't have to stand up and maintain an in-house system for automation.


In this tutorial, you will use a demo user interface that helps you learn how to automate batch reveal of NFT mints, using Chainlink Automation and VRF. VRF is used to randomize the metadata for the NFTs, and Automation is used to set trigger conditions for when the NFT metadata is revealed via batch size and/or time interval parameters.

The demo includes:

  • Setting up and funding a Chainlink VRF subscription
  • Automatically generating a smart contract that will then be used by both VRF (as a consumer) and in Automation (as the target contract).

Before you begin

Before you start this tutorial, complete the following items:

  • If you are new to smart contract development, learn how to Deploy Your First Smart Contract.
  • Set up a cryptocurrency wallet
  • To deploy this contract on testnets, ensure the deployer account has testnet ERC-677 LINK. Use the LINK faucet to retrieve testnet LINK.

Steps to implement

1 Enter your collection information
  1. Go to the demo app and connect to your wallet with the right network. Then click on the Get Started button.

    Batch Collection Quickstart Step 1
  2. Enter the basic information regarding your collection. You can hover over the question mark icon to learn more about each field.

    Batch Collection Quickstart Step 2
2 Configure your VRF subscription
  1. At this stage, you will need to create a VRF subscription and fund it with LINK by visiting the Chainlink VRF Subscription Manager. Follow the steps outlined in the interface to create a subscription. You will receive a confirmation message upon successful creation.

  2. Add funds to your subscription. Copy the resulting subscription ID to your clipboard. For this demo, you can add 20 LINK.

Batch Collection Quickstart Step 3 Batch Collection Quickstart Step 4
  1. Navigate back to the demo app. Paste the VRF Subscription ID into the Subscription ID field and fill out the fields for Queue Size Trigger and Time Trigger (seconds).

  2. Upon successful creation, you will see a confirmation page. Copy the address and navigate back to the VRF Subscription Manager.

Batch Collection Quickstart Step 5
  1. In the subscription manager, click Add Consumer and paste the address in the blank field. Click Add Consumer and wait until you receive confirmation. Your consumer should not be added to your subscription. Note: you may have to refresh the page to see the consumer.
Batch Collection Quickstart Step 6
3 Create an Automation Upkeep
  1. The next step is to register a new Upkeep using Chainlink Automation. Visit the Chainlink Automation App to get started. Click the button Register New Upkeep and connect your wallet.

  2. You will be directed to a screen where you will choose your Trigger from a dropdown menu. Select Custom logic. Paste your address into the Target contract address field. Then, click Next.

  3. You will be directed to a form to fill out more information on your upkeep. Fill out these details and set the gas limit to 200000 to ensure the Chainlink Automation network can perform the upkeep when the trigger conditions are met. Once all the information is filled in, click Register Upkeep. Wait until the upkeep has been registered and click View Upkeep. You'll be able to see all the details of your Upkeep.

4 Trigger the upkeep
  1. Navigate back to the demo app page. Check off both boxes and click View Collection. Your screen will look similar to this:
Batch Collection Quickstart Step 7
  1. Mint NFTs until the trigger condition is met. At that point, the demo app will display the message "Pending Batch Reveal". The Chainlink Automation upkeep will be triggered automatically. This will internally make a call to Chainlink VRF for randomness and assign the random traits to the tokens for the reveal.

  2. If the reveal is a success, your screen will look similar to this. You have now completed the tutorial.

Batch Collection Quickstart Step 8

Stay updated on the latest Chainlink news