• Stars
    star
    803
  • Rank 56,759 (Top 2 %)
  • Language
    Solidity
  • License
    MIT License
  • Created over 3 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Update: You should use ipfs:// instead of https://ipfs.io/ for your tokenURI

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>

Then, make sure your brownie-config.yaml has:

dotenv: .env

You can also learn how to set environment variables 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

The simple contract and the advanced 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.

More Repositories

1

dungeons-and-dragons-nft

#chainlink #nft
JavaScript
603
star
2

hardhat-security-fcc

Solidity
410
star
3

all-on-chain-generated-nft

A repo for generating random NFTs with metadata 100% on chain!
JavaScript
356
star
4

dao-template

TypeScript
244
star
5

full-stack-web3-metamask-connectors

180
star
6

chainlink_defi

Build a defi yield farmable dApp. Get started here.
JavaScript
157
star
7

rwa-creator

Solidity
133
star
8

smart-contract-frameworks

A list of smart contract frameworks
C
119
star
9

hardhat-smartcontract-lottery-fcc

JavaScript
118
star
10

hardhat-nft-marketplace-fcc

JavaScript
114
star
11

hardhat-nft-fcc

JavaScript
101
star
12

simple-storage-fcc

Solidity
99
star
13

ethers-simple-storage-fcc

JavaScript
88
star
14

unstoppable-ui

JavaScript
87
star
15

async-python

Shows how to use async requests vs requests
Python
87
star
16

hardhat-fund-me-fcc

JavaScript
83
star
17

defi-stake-yield-brownie

Solidity
78
star
18

smartcontract-lottery

Solidity
75
star
19

PatrickAlphaC

75
star
20

hardhat-simple-storage-fcc

JavaScript
74
star
21

aave_brownie_py

Solidity
61
star
22

nextjs-smartcontract-lottery-fcc

JavaScript
60
star
23

foundry-play

Solidity
59
star
24

fund-me-fcc

Solidity
56
star
25

pokemon-nft

PokΓ©mon NFTs
Solidity
54
star
26

defi-stake-yield-brownie-freecode

Solidity
53
star
27

simple_storage

Solidity
51
star
28

erc20-brownie

Solidity
50
star
29

fund_me

Solidity
48
star
30

storage-factory-fcc

Solidity
45
star
31

web3_py_simple_storage

Python
45
star
32

nextjs-nft-marketplace-moralis-fcc

JavaScript
44
star
33

lens-blog

A minimal example of using Lens Protocol to build a blog
JavaScript
39
star
34

nextjs-nft-marketplace-thegraph-fcc

JavaScript
39
star
35

hardhat-erc20-fcc

JavaScript
38
star
36

html-js-ethers-connect

JavaScript
37
star
37

nft-demo

Python
37
star
38

defi_py_mix

Solidity
36
star
39

storage_factory

Solidity
35
star
40

hardhat-defi-fcc

Solidity
35
star
41

aave_web3_py

web3.py way to interact with aave
Python
35
star
42

denver-security

Solidity
34
star
43

html-fund-me-fcc

JavaScript
32
star
44

graph-nft-marketplace-fcc

TypeScript
32
star
45

sc-language-comparison

Solidity
31
star
46

smartcontract-upgrades-example

JavaScript
28
star
47

foundry-smart-contract-lottery-f23

Solidity
27
star
48

nextjs-ethers-metamask-connect

JavaScript
26
star
49

brownie_fund_me

Solidity
25
star
50

weather-nft

chainlink weather nfts
Solidity
24
star
51

brownie_simple_storage

Python
23
star
52

chainlink-the-graph

JavaScript
22
star
53

flashloan-forta-py

Python
22
star
54

chainlink-hardhat

JavaScript
20
star
55

upgrades-mix

Solidity
19
star
56

multicall-js

JavaScript
19
star
57

signatureVerification

Solidity
18
star
58

openweathermap_cl_ea

JavaScript
17
star
59

denver-security-challenges

Solidity
17
star
60

multicall

Python
16
star
61

hardhat-upgrades-fcc

JavaScript
16
star
62

hardhat-dao-fcc

TypeScript
15
star
63

ai-stablecoin

Solidity
15
star
64

staking-ui-demo

JavaScript
15
star
65

decentralized-raffle

TypeScript
15
star
66

ipfs_cl_ea

IPFS Chainlink External Adapter
JavaScript
14
star
67

get-all-transactions

Python
14
star
68

hardhat-simple-storage

JavaScript
13
star
69

aave_brownie_py_freecode

Solidity
13
star
70

hardhat-events-logs

JavaScript
12
star
71

nextjs-moralis-metamask-connect

JavaScript
12
star
72

hardhat-metamorphic-upgrades-fcc

JavaScript
12
star
73

defi-dapp

TypeScript
12
star
74

battle-game

JavaScript
11
star
75

foundry-vyper

A package for deploying and compiling vyper code in foundry
Solidity
11
star
76

fuzzing-example

Solidity
10
star
77

vyper-chain-info

Python
10
star
78

vrf_pizza

lol
Solidity
10
star
79

dapptools-demo

Solidity
10
star
80

nextjs-web3-react-metamask-connect

JavaScript
10
star
81

eth-global-live-audit

Solidity
10
star
82

filecoin_cl_ea

JavaScript
9
star
83

puppy-raffle-smartcon

Solidity
9
star
84

ape-fund-me-v23

Python
8
star
85

erc20-brownie-py

Python
8
star
86

brownie-events-logs

Python
7
star
87

patrickalphac.com

TypeScript
7
star
88

send_blob

Python
7
star
89

unfinished-defi-workshop

JavaScript
6
star
90

vrf_pizza_front_end

lol
CSS
6
star
91

gcp-weather

Solidity
6
star
92

nextjs-web3modal-metamask-connect

JavaScript
6
star
93

smartcon-hacker-house-hunt-rules

6
star
94

hardhat-fund-me-forked-fcc

JavaScript
5
star
95

geo_db_brownie

Solidity
5
star
96

clever-lottery-web3

JavaScript
5
star
97

scavenger-hunt

TypeScript
5
star
98

nextjs-ethers-introduction-fcc

JavaScript
5
star
99

vheader

A tool for making perfect vyper headers, inspired by transmissions11
Rust
5
star
100

nextjs-usedapp-metamask-connect

JavaScript
5
star