Chainlink
$15.54 -1.41%
LINK · 3w

How to get Random Numbers in an NFT (ERC721)

Introduction

Generating random numbers in a non-fungible token (NFT) following the ERC721 standard has always been an issue for smart contract developers. Now that Chainlink VRF is live on mainnet, Solidity-based smart contracts can seamlessly generate tamper-resistant on-chain random numbers that are provably fair and backed by a cryptographic proof. With Chainlink VRF, creating dynamic NFTs that need a secure source of randomness is now the easiest and most secure it’s ever been. While Chainlink also enables dynamic attributes of any kind for an NFT using off-chain data sources, we are going to focus on random numbers with ERC721, or NFTs.

In this tutorial, we are going to be looking at building a Dungeons & Dragons character on the Ethereum blockchain! D&D (Dungeons and Dragons) is a popular role playing game (RPG) where people create characters and go on adventures. One of the important pieces of creating characters is giving them attributes or statistics to show their strength, dexterity, intelligence, and so on. To create truly random numbers for their statistics on the blockchain, we will show how to give your characters random attributes using Chainlink VRF. Random number generation in blockchain is easy with Chainlink VRF!

What Is an NFT?

NFTs (following the ERC721 standard) define a framework for making tokens that are unique and different from each other (hence the term non-fungible), while the popular ERC20 standard defines tokens that are “fungible”, meaning the tokens are all interchangeable and guaranteed to have the same value. Examples of “fungible” currencies are the United States dollar, the Euro, and the Yen, while examples of fungible blockchain tokens are AAVE, SNX, and YFI. In these cases, 1 fungible token equals 1 of another of the same kind, just as one dollar equals one dollar, and 1 LINK equals 1 LINK. However, NFTs / ERC721s are different in that each token is unique and doesn't represent ...

Continue on blog.chain.link
No posts found
Recent news
No posts found