Building NFTs with
IPFS and Filecoin
FILECOIN CLUB
Yusef Napora
Engineer & Technical
Writer
Build smart contracts
for unique
non-fungible tokens
Using IPFS
content addressing
for durable links
With provable
long-term storage
on Filecoin
Goal: learn how NFTs
work, so we can build
digital artifacts that
last
Introduction
Contracts
Storage
Development
Introduction
How does an NFT
contract work?
Introduction
Contracts
Storage
Development
Introduction
What is an NFT,
anyway?
Introduction
Contracts
Storage
Development
Introduction
How to store NFT data
Introduction
Introduction
Contracts
Storage
Development
Developing applications
for NFTs
Introduction
Introduction
Contracts
Storage
Development
Contracts
Contracts
Storage
Development
Introduction
Contracts
Storage
Development
Introduction
How does a smart contract
work?
● Contract developer writes Solidity code (or Vyper, etc)
● Compiles to bytecode for the Ethereum Virtual Machine
● Contract is deployed in a transaction
● Once a contract is deployed, you can call its functions
● Read-only functions are “free” and fast
● Modifying state costs gas and happens asynchronously
Contract basics
Contracts
Storage
Development
Introduction
What is an NFT, when you
get right down to it?
• Has a unique identity on a blockchain smart contract
• Can be owned and transferred to a new owner
• Can generally store a small amount of data on-chain
• Can link to external (off-chain) data using a URI
Key Properties
Standards
● First formal NFT standard
● Evolution of CryptoPunks & other early NFT projects
● Defines ownership mechanics
● Allows each token to have a unique metadata URI
● Defines a basic “baseline” metadata schema
ERC-721
Standards
● “Multi-token” standard
● Allows many token types to share one contract
● Supports efficient batch transfers
● Tokens can be fungible, non-fungible, or
“semi-fungible”
● Made for gaming use case, but not gaming
specific
ERC-1155
Coding Challenge #1
Deploy an NFT contract to a local blockchain
Resources:
hardhat.org/getting-started
openzeppelin.com/contracts/4.x/erc721
docs.ipfs.io/how-to/mint-nfts-with-ipfs
Deploy an NFT
Smart Contract
Coding Challenge #1:
Coding Challenge #2
Mint an NFT by calling the contract
> const cid = ‘bafybeieeomufuwkwf7sbhyo7yiifaiknm7cht5tc3vakn25vbvazyasp3u’
> const tx = await gameItem.awardItem(player, `ipfs://${cid}`)
> await tx.wait()
> const uri = await gameItem.tokenURI(1)
> uri
“ipfs://bafybeieeomufuwkwf7sbhyo7yiifaiknm7cht5tc3vakn25vbvazyasp3u”
Call a function, mint an NFT
Coding Challenge #2:
Calling contracts with ethers.js:
docs.ethers.io/v5/api/contract
Storage Introduction
Contracts
Storage
Development
PSA:
Friends don’t let friends
mint NFTs with HTTP links
● On-chain data storage is incredibly expensive
● Almost all NFTs contain links to off-chain data
● HTTP links are familiar and easy to use
● But, they’re super fragile!
● Data at the other end of the link can change or disappear
without any change to the NFT on-chain
bafkreiem4...
❓bafkreiem4...
❓bafkreiem4...
❓bafkreiem4...
❓bafkreiem4...
❓bafkreiem4...
Caveat #1
Caveat #1
Caveat #2
Caveat #2
������
Caveat #2
📌 📌 📌
Coding Challenge #3
Store NFT data with NFT.Storage
> const client = new NFTStorage({ token })
> const metadata = await client.store({
name: ‘Crypto Koala #123’,
description: ‘Eats shoots and leaves’,
image: new File([ imageData ], ‘koala-123.png’),
})
> metadata.url
“ipfs://bafybeieeomufuwkwf7sbhyo7yiifaiknm7cht5tc3vakn25vbvazyasp3u”
Store NFT data
Coding Challenge #3:
NFT.Storage client library docs:
ipfs-shipyard.github.io/nft.storage/client/
Development Introduction
Contracts
Storage
Development
Ethereum Dev Resources
Introduction
Contracts
Storage
Development
● github.com/austintgriffith/scaffold-eth
● buidlguidl.com
● ethereum.org/en/developers/docs
● github.com/gianni-dalerta/awesome-nft
● nftschool.dev
● use-nft.spectre.xyz
● NFTE.app
Introduction
Contracts
Storage
Development
Viewing NFTs
thegraph.com
Introduction
Contracts
Storage
Development
Indexing Events
● Contracts emit events when tokens are transferred, etc
● Scanning over historical events is possible, but slow
● The Graph provides decentralized indexing infrastructure
for Ethereum events
● Use GraphQL to query any Ethereum contract history
NFTs with IPFS & Filecoin
FILECOIN CLUB
YOU HAVE COMPLETED
That’s all, folks.
Thank you!

Intro to NFTs