GithubHelp home page GithubHelp logo

nft-mix's Introduction

nft-mix


NFT Shiba Inu NFT Pug NFT St.Bernard


This is a repo to work with and use NFTs smart contracts in a python environment, using the Chainlink-mix as a starting point.

If you'd like to see another repo using random NFTs that are deployed to mainnet, check out the D&D package.

Prerequisites

Please install or have installed the following:

Installation

  1. Install Brownie, if you haven't already. Here is a simple way to install brownie.
pip install eth-brownie

Or, if that doesn't work, via pipx

pip install --user pipx
pipx ensurepath
# restart your terminal
pipx install eth-brownie
  1. Clone this repo
brownie bake nft-mix
cd nft
  1. Install ganache-cli
npm install -g ganache-cli

If you want to be able to deploy to testnets, do the following.

  1. Set your environment variables

Set your WEB3_INFURA_PROJECT_ID, and PRIVATE_KEY environment variables.

You can get a WEB3_INFURA_PROJECT_ID by getting a free trial of Infura. At the moment, it does need to be infura with brownie. You can find your PRIVATE_KEY from your ethereum wallet like metamask.

You'll also need testnet rinkeby ETH and LINK. You can get LINK and ETH into your wallet by using the rinkeby faucets located here. If you're new to this, watch this video.

You can add your environment variables to the .env file:

export WEB3_INFURA_PROJECT_ID=<PROJECT_ID>
export PRIVATE_KEY=<PRIVATE_KEY>

AND THEN RUN source .env TO ACTIVATE THE ENV VARIABLES (You'll need to do this everytime you open a new terminal, or learn how to set them easier)

Or you can run the above in your shell.

Usage

There are 2 types of NFTs here.

  1. SimpleCollectibles.sol
  2. AdvancedCollectibles.sol

They each deploy unique dogs. The advanced version gives you a random breed (out of a Pug, Shiba Inu, and St. Bernard).

The advanced collection uses a Chainlink VRF to deploy the random dog.

You can 100% use the rinkeby testnet to see your NFTs rendered on opensea, but it's suggested that you test and build on a local development network so you don't have to wait as long for transactions.

Running Scripts

The simple collectibles work on a local network, however the advanced requires a testnet. We default to rinkeby since that seems to be the testing standard for NFT platforms. You will need testnet rinkeby ETH and testnet Rinkeby LINK. You can find faucets for both in the Chainlink documentation.

For the Simple ERC721

brownie run scripts/simple_collectible/deploy_simple.py --network rinkeby
brownie run scripts/simple_collectible/create_collectible.py --network rinkeby

For the Advanced ERC721

You'll need testnet Rinkeby and testnet LINK in the wallet associated with your private key.

brownie run scripts/advanced_collectible/deploy_advanced.py --network rinkeby
brownie run scripts/advanced_collectible/create_collectible.py --network rinkeby

Then:

brownie run scripts/advanced_collectible/create_metadata.py --network rinkeby
brownie run scripts/advanced_collectible/set_tokenuri.py --network rinkeby

Verify on Etherscan

Looking for help fixing this!

Currently, the advanced collectibles contract has an issue with ERC721 and the Chainlink contracts, so they have be verified manually. However, the simple contract can be verified if you just set your ETHERSCAN_TOKEN.

Misc

There are some helpful scripts in helpful_scripts.py.

Viewing on OpenSea

After running the scripts from the For the Advanced ERC721 section

  1. Create the metadata

Metadata is the URI needed to upload data. You can either:

  • Upload to IPFS yourself
  • Use the metadata already created when you cloned this repo.

If you want to upload to IPFS yourself

Download IPFS Set export IPFS_URL=http://127.0.0.1:5001 and export UPLOAD_IPFS=true environment variables Run the IPFS daemon: ipfs daemon Then Run

brownie run scripts/advanced_collectible/create_metadata.py --network rinkeby

Alternatively, you could upload the uri manually: Add the file created in metadata/rinkeby/NAME.json to IPFS or Pinata.

If you want to use the metadata from this repo

Just run:

brownie run scripts/advanced_collectible/create_metadata.py --network rinkeby
  1. Set the tokenURI Run
brownie run scripts/advanced_collectible/set_tokenuri.py --network rinkeby

And after some time, (you may have to wait up to 20 minutes for it to render on opensea), you should see your NFT on opensea! It'll look something like this.

NEW Pinata

If you want to auto-upload to pinata instead of IPFS automatically, you can do so by getting a Pinata API Key.

You'll need the following environment variables (you can get them from Pinata)

PINATA_API_KEY
PINATA_API_SECRET

Then run:

python scripts/upload_to_pinata.py

Testing

brownie test

Linting

pip install black 
pip install autoflake
autoflake --in-place --remove-unused-variables -r .
black .

Resources

To get started with Brownie:

Shoutout to TheLinkMarines on twitter for the puppies!

Any questions? Join our Discord

License

This project is licensed under the MIT license.

nft-mix's People

Contributors

patrickalphac avatar albertoxamin avatar sheenymeg avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.