All Projects → PatrickAlphaC → dungeons-and-dragons-nft

PatrickAlphaC / dungeons-and-dragons-nft

Licence: MIT license
#chainlink #nft

Programming Languages

javascript
184084 projects - #8 most used programming language
solidity
1140 projects
shell
77523 projects

Projects that are alternatives of or similar to dungeons-and-dragons-nft

alice-NFT
Ethereum for Javascript devs
Stars: ✭ 38 (-93.48%)
Mutual labels:  truffle, nft
Chainlink
node of the decentralized oracle network, bridging on and off-chain computation
Stars: ✭ 2,680 (+359.69%)
Mutual labels:  oracle, chainlink
fapro
Fake Protocol Server
Stars: ✭ 1,338 (+129.5%)
Mutual labels:  oracle
create-truffle-dapp
Create and deploy Truffle projects with no configuration.
Stars: ✭ 17 (-97.08%)
Mutual labels:  truffle
awesome-sql
List of tools and techniques for working with relational databases.
Stars: ✭ 199 (-65.87%)
Mutual labels:  oracle
Valheim-Free-Game-Server-Setup-Using-Oracle-Cloud
Valheim Oracle Cloud Server Setup
Stars: ✭ 24 (-95.88%)
Mutual labels:  oracle
carbon-footprint
Calculate your carbon footprint 🏭👣 from food, transport, purchases, fashion, electricity and digital activities like streaming, NFT or blockchain.
Stars: ✭ 59 (-89.88%)
Mutual labels:  nft
awesome-ethereum
一起学习以太坊
Stars: ✭ 60 (-89.71%)
Mutual labels:  truffle
Artion-Client
Client app for Artion, a global NFT marketplace on Fantom Opera.
Stars: ✭ 71 (-87.82%)
Mutual labels:  nft
jk64-plugin-reportmap
Report Google Map APEX Plugin
Stars: ✭ 37 (-93.65%)
Mutual labels:  oracle
Simple-Game-ERC-721-Token-Template
🔮 Very Simple ERC-721 Smart Contract Template to create your own ERC-721 Tokens on the Ethereum Blockchain, with many customizable Options 🔮
Stars: ✭ 83 (-85.76%)
Mutual labels:  nft
the-great-venus
🗿 The Great Venus (2018) - Turn-based web RPG based on Ethereum platform
Stars: ✭ 19 (-96.74%)
Mutual labels:  truffle
awesome-defi
Curated list of awesome DeFi protocols, dapps, wallets and other resources
Stars: ✭ 36 (-93.83%)
Mutual labels:  nft
apex-plugin-spotlight
Oracle APEX Dynamic Action Plugin - APEX Spotlight Search
Stars: ✭ 20 (-96.57%)
Mutual labels:  oracle
SOMns
SOMns: A Newspeak for Concurrency Research
Stars: ✭ 62 (-89.37%)
Mutual labels:  truffle
eReports-open-source
Sistema de envio e agendamento de relatórios
Stars: ✭ 30 (-94.85%)
Mutual labels:  oracle
snes-punks
Real world example of a full-stack Ethereum web app for supporting minting of NFT's from a collection using Tailwind, NextJS an nes.css. Contracts are written in Solidity with the help of HardHat.
Stars: ✭ 43 (-92.62%)
Mutual labels:  nft
ddlfs
Filesystem which represents Oracle Database objects as their DDL stored in .sql files
Stars: ✭ 31 (-94.68%)
Mutual labels:  oracle
solidity-contracts
📦 Resources for the Ethereum Smart Contract Development tutorial series.
Stars: ✭ 64 (-89.02%)
Mutual labels:  truffle
circleci-ethereum
CI/CD for Ethereum Smart Contracts with CircleCI and Truffle
Stars: ✭ 21 (-96.4%)
Mutual labels:  truffle

Chainlink Random Character Creation

This repo is a starting point for creating:

  1. NFTs built with verifiable RNG using the Chainlink VRF
  2. Create dynamic NFTs that change based on real world data. By using decentralized oracles to get data.
  3. Adding your randomized NFTs to the OpenSea Marketplace

Skip down to deploy To Opensea - to see how to add a tokenURI

We will easily create our own NFT on the Rinkeby Chain. We can edit the name of the character in the generate-character.js script.

This will create a character with 6 attributes from 0 - 99:

  • uint256 strength;
  • uint256 dexterity;
  • uint256 constitution;
  • uint256 intelligence;
  • uint256 wisdom;
  • uint256 charisma;

And then:

  • uint256 experience;
  • string name;

Quickstart

Right now this repo only works with rinkeby. Run the following.

Setup Environment Variables

You'll need a MNEMONIC and a rinkeby RINKEBY_RPC_URL environment variable. Your MNEMONIC is your seed phrase of your wallet. You can find an RINKEBY_RPC_URL from node provider services like Infura

Then, you can create a .env file with the following.

MNEMONIC='cat dog frog....'
RINKEBY_RPC_URL='www.infura.io/asdfadsfafdadf'

Or, set them in a bash_profile file or export them directly into your terminal. You can learn more about environment variables here.

To run them directly in your terminal, run:

export MNEMONIC='cat dog frog....'
export RINKEBY_RPC_URL='www.infura.io/asdfadsfafdadf'

Then you can get started with:

Clone The Repo and migrate

git clone https://github.com/PatrickAlphaC/dungeons-and-dragons-nft
cd dungeons-and-dragons-nft
yarn
truffle migrate --reset --network rinkeby

This will deploy your D&D NFT!

Generate a character

You can now try it out:

truffle exec scripts/fund-contract.js --network rinkeby
truffle exec scripts/generate-character.js --network rinkeby
truffle exec scripts/get-character.js --network rinkeby

This will create a new character with random stats! Depending how often you deploy, you can pick which character by changing the dnd.getCharacterOverView(1) command in get-character.js to swap the 0 out with whatever tokenId of the character you like.

This will give you the overview of your NFT. You'll see BN since the call returns big numbers, you can cast them to ints to see what they are.... Or you could go one step farther

See it on etherscan or oneclickdapp

You can get an Etherscan API key for free and interact with the NFTs on chain. Then set ETHERSCAN_API_KEY as an environment variable.

yarn add truffle-plugin-verify
truffle run verify DungeonsAndDragonsCharacter --network rinkeby --license MIT

This will verify and publish your contract, and you can go to the Read Contract section of etherscan that it gives you.

Otherwise, you can use oneclickdapp and just add the contract address and ABI. You can find the ABI in the build/contracts folder. Just remember it's not the whole file that is the ABI, just the section that says ABI.

Deploy to Opensea

Once we have our NFTs created, we need to give them a tokenURI. TokenURIs are the standard for showing the data of NFTs to the world. This makes it easier to store things like images since we don't have to waste the gas of adding them on-chain.

The TokenURI represents a URL or other unique identifier, and it is an .json file with a few parameters.

{
    "name": "Name for it ",
    "description": "Anything you want",
    "image": "https://ipfs.io/ipfs/HASH_HERE?file.png",
    "attributes": [...]
}

We are going to be storing these images and meta data in IPFS. You'll need both:

  1. IPFS
  2. IPFS companion
  3. Pinata

IPFS is a peer to peer network for storing files. It's free and open sourced, and we can use it to host our tokenURI. The IPFS companion let's us view IPFS data nativly in our browsers like Brave or Chrome. And Pinata allows us to keep our IPFS files up even when our node is down (don't worry about that for now)

Once our IPFS node is up, we can start adding files to it. We first want to upload the image of our NFT. What does this D&D character look like? Add it to your IPFS node and then "Pin" it. Once pinned, you can get the CID of the pinned file, and make sure it stays pinned by pinning it on your Pinata account. Don't worry, it's free! This will just help keep the data up even when our IPFS node is down.

Once we have the image pinned and up, we can get the link for that image. It'll look a little something like this:

https://ipfs.io/ipfs/QmTgqnhFBMkfT9s8PHKcdXBn1f5bG3Q5hmBaR4U6hoTvb1?filename=Chainlink_Elf.png

This is a real link, and if you click it and nothing renders, your IPFS companion might not be working, or your IPFS node is down.

Once we have our image, we can add it to our metadata .json file, and add our stats in there. You can see some samples in the metadata folder. We want to use the values of our characters that we got off-chain, so be sure to verify what the random numbers you got on etherscan! Once we have the .json metadata file, we want to add that to IPFS as well, and pin it too!

This metadata json file is going to be our tokenURI, so we will modify our set-token-uri.js with the tokenId of the NFT we are giving a picture to, and adding the ipfs tokenURI.

Then we just run it like:

truffle exec scripts/set-token-uri.js --network rinkeby

Now, we can get the address of our NFT and head on over to the opensea testnet marketplace to see if we did it correctly. If done correctly, it'll look something like this.

Here is the link for adding your testnet NFT contract to be viewed on opensea.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].