We’re excited to announce that Atlas CORP has integrated Chainlink Verifiable Random Function (VRF) on Ethereum mainnet. By integrating the industry-leading decentralized oracle network, we now have access to a tamper-proof and auditable source of randomness needed to mint from a contract and receive a verifiably random selection of an 1155 collection .
Atlas CORP, a leading provider of web3 development services, has recently launched a smart contract that demonstrates a novel way of minting from ERC-1155 collections. Using Chainlink VRF, users can mint from a contract and receive a verifiably random selection of an 1155 collection. This is a first of a kind implementation which we expect to see deployed in many different forms in subsequent use cases.
Created in partnership with the PHTO team, web3 purveyors of fine art photography, the Atlas CORP team recently developed the PHTO – Innovation of Influence smart contract. The latest PHTO initiative is “a collection of historically significant mid century fine art photography showcasing a rarely-seen series of portraits of an emerging brunette starlet named Norma Jeane in 1946 when she was an Armed Forces pinup.” Holders of the PHTO All Access Pass could claim a free mint, followed by an open mint where anyone can purchase.
A mint would select from one of 102 unique collections on the 1155 contract, but the choice of token number is randomly assigned by a Chainlink VRF call. Each mint makes its own call to Chainlink VRF which would result in the user receiving a random token, each with varying degrees of rarity.
Gas Savings & Optimization
One of the primary challenges the team solved was the cost to mint. As the team was providing free mints to Access Pass holders, minimizing gas per mint was of the utmost importance to ensure the project mint costs were feasible. In addition purchasers were not required to bring their own $LINK to the contract to fund the VRF calls; the team provided $LINK on behalf of the users to simplify the purchasing experience. As the VRF callback would trigger the minting on the 1155 smart contract, the majority of the gas spent minting NFTs was paid in $LINK.
This means the team was responsible for covering the costs of the majority of the gas expenditures – both for claims and purchases! It was extremely important to optimize the amount of gas required.
To do so, the Atlas CORP team implemented a binary search tree to determine which token number to assign on the return of the VRF call. Binary search trees are ideal for probability density functions with even distributions; it would have been optimal if each of the 102 tokens on the contract had the exact same supply. As the tokens came in varying supplies and rarities, it was discovered that the execution of the function could be further optimized using a weighted binary tree. This got to the token to be distributed more quickly, further reducing the gas requirement of the mint to that of a more standard ERC-1155 mint.
Why We Chose Chainlink VRF
In order to help determine which ERC-1155 token users receive on mint, we need access to a secure random number generator (RNG) that any user could independently audit. However, RNG solutions for smart contracts require several security considerations to prevent manipulation and ensure system integrity. For instance, RNG solutions derived from blockchain data like block hashes can be exploited by miners/validators, while off-chain RNG solutions derived from off-chain APIs are opaque and don’t provide users with definitive proof about the integrity of the process.
After reviewing various solutions, we selected Chainlink VRF because it’s based on cutting-edge academic research, supported by a time-tested oracle network, and secured through the generation and on-chain verification of cryptographic proofs that prove the integrity of each random number supplied to smart contracts.
Chainlink VRF works by combining block data that is still unknown when the request is made with the oracle node's pre-committed private key to generate both a random number and a cryptographic proof. The PHTO smart contract will only accept the random number input if it has a valid cryptographic proof, and the cryptographic proof can only be generated if the VRF process is tamper-proof. This provides our users with automated and verifiable assurances directly on-chain that the mint selection is provably fair and was not tampered with by the oracle, outside entities, or the Atlas CORP team.
The pioneering of this technology opens the door for several additional use cases for Chainlink VRF. Project teams can now mint “card packs” – groups of 1155s of varying rarity – in a single, verifiably random transaction. Just like opening a pack of baseball cards where there are standard cards with varying rarities. NFTs can be sold the same way instead of leveraging ERC-721s that don’t stack and have to be separately managed, allowing all the individual cards to be part of the same contract with a small number of token-numbered collections.
This project also portends a future state of the world in which project teams can encourage their community members to “bring their own $LINK” when minting. While the historical trend has been for project teams to supply the $LINK needed for randomness, this typically considers the use case where a single call to Chainlink VRF is used at the onset of a mint and not a unique call to Chainlink VRF with every mint. Contracts can be architected to accept $LINK in lieu of or in addition to the cost of minting an NFT.
If you are looking to build smart contracts that leverage Chainlink VRF, reach out to Atlas CORP today!
Chainlink is the industry-standard Web3 services platform that has enabled trillions of dollars in transaction volume across DeFi, insurance, gaming, NFTs, and other major industries. As the leading decentralized oracle network, Chainlink enables developers to build feature-rich Web3 applications with seamless access to real-world data and off-chain computation across any blockchain and provides global enterprises with a universal gateway to all blockchains.