Book a free call

How NFT Developers Write and Deploy NFTs

Writing an NFT means coding a smart contract, testing it, then deploying it to a blockchain so wallets and marketplaces can read it. Here is the path, step by step.

Hertiv engineering teamReviewed by a senior engineer
7 min read
How NFT Developers Write and Deploy NFTs
On this page

Short answer

NFT developers write and deploy NFTs by coding a smart contract that follows the ERC-721 or ERC-1155 standard, testing it on a local network, deploying it to a test network and then to a main network, and verifying the code so wallets and marketplaces can read it. The contract, not the image file, is what makes the token an NFT.

What does it mean to write and deploy an NFT?

Writing and deploying an NFT means creating a smart contract on a blockchain that can mint, own and transfer unique tokens. The contract holds the rules: who can mint, how many tokens exist, what each token points to, and how transfers work.

The image or file itself is not the NFT. The token is an entry in the contract that points to metadata, usually a JSON file with the name, description and image link. The contract is the source of truth, and wallets and marketplaces read it to show the owner and the details.

Deployment means publishing that contract to a blockchain network. Once deployed, the contract has an address, and anyone can call its functions to mint or transfer tokens. That is why the code must be tested before deployment: a deployed contract is hard to change.

The path below covers the standard workflow a developer follows, from choosing a token standard to listing the collection. For the buyer side of the story, what NFT minting is explains what happens when someone mints a token.

Which token standard should you use?

The token standard decides what your NFT can do and which wallets and marketplaces support it. The table below compares the two standards developers use most.

StandardBest forKey feature
ERC-721One-of-one art and collectiblesEach token is unique
ERC-1155Editions and game itemsMany copies per token id
ERC-20Fungible tokens, not NFTsTokens are identical
SoulboundCredentials and badgesCannot be transferred

ERC-721 is the default for unique items: each token has its own id and its own metadata. ERC-1155 fits editions and game items, because one contract can hold many token types and batch transfers in a single transaction, which saves gas.

Pick the standard before you write any code, because it shapes the whole contract. If you are unsure, ERC-721 is the safer choice for a first collection, since every major marketplace supports it.

How do you write an NFT contract?

You write an NFT contract in Solidity, using the OpenZeppelin library for the standard parts instead of writing them from scratch. OpenZeppelin gives you tested implementations of ERC-721 and ERC-1155, so you add only your own rules on top.

A basic contract does four things. It sets the collection name and symbol, it defines a mint function that creates tokens and assigns them to an owner, it stores the metadata link for each token, and it sets any limits, such as a maximum supply or a mint price.

Keep the contract small. Every extra function is a new place for a bug, and every line costs gas to deploy. Put the art, the metadata and the website off chain, and keep only the ownership rules and the token links on chain.

Write the metadata as a JSON file per token, with a name, a description and an image link, and store the files on IPFS or a similar decentralised store. A metadata link that points to a server you control can change or vanish, which breaks the token.

How do you test the contract before deployment?

Test the contract on a local network first, then on a public test network, before it touches a main network. Testing is the only cheap place to find bugs, because fixing a deployed contract is slow and expensive.

Start with unit tests for each function: minting creates the token and the right owner, transfers move it, and limits hold. Then test the unhappy paths: minting past the supply, minting without payment, and calling admin functions from the wrong address.

Run the tests on a local chain such as Hardhat or Foundry, which is fast and free. Then deploy to a test network such as Sepolia and mint a few tokens from a real wallet, checking that the metadata loads and the token shows up correctly.

For a collection that will hold real value, get an audit. An audit does not guarantee safety, but it catches the common mistakes that unit tests miss, such as reentrancy and access control errors.

How do you deploy to a network?

Deploy the contract in a fixed order, and check each step before moving to the next. A rushed deployment is how collections end up with the wrong supply or the wrong metadata link.

  1. Pick the network. Ethereum is the most supported, while Polygon and Base cost less in gas; match the network to your buyers.
  2. Fund the deployer wallet. Deployment costs gas, so hold enough of the network token and keep the key safe.
  3. Deploy to a test network first. Run the full mint flow there and check the token in a wallet and a marketplace.
  4. Deploy the final contract to the main network. Use the same code and settings you tested, with no last-minute edits.
  5. Verify the source code. Publish it on the block explorer so anyone can read what the contract does.
  6. Set the metadata base link. Point the contract at the metadata folder, then mint one token and check it displays.

Keep the deployer key in a hardware wallet or a multisig, not in a developer laptop. Whoever holds that key can change the contract settings, so treat it like a production credential. The Ethereum deployment guide covers the tooling in more depth.

How do you verify and list the collection?

Verify the contract by publishing its source code on the block explorer, so buyers can read the rules instead of trusting a claim. A verified contract shows a green check on the explorer, and marketplaces use it to confirm the collection is real.

After verification, list the collection on the marketplaces your buyers use. Most marketplaces read the contract automatically once it has tokens, but you should still claim the collection, add a description and a banner, and set the royalty for secondary sales.

Set the royalty carefully. A high royalty discourages resales, while a zero royalty gives away the income that funds the project. Marketplaces enforce royalties differently, so check how each one handles them before you promise a rate.

Finally, test the full buyer flow yourself: mint from a fresh wallet, list the token, buy it from another wallet, and check the royalty lands. A collection that has never been bought end to end is not ready to launch.

Example (hypothetical): a 500-piece collection

Example (hypothetical): a developer builds a 500-piece art collection on Ethereum. The contract is ERC-721 with a maximum supply of 500, a mint price of 0.05 ETH, and metadata stored on IPFS. Deployment costs 0.4 ETH in gas, and the contract is verified on the block explorer the same day.

In the first week, 300 tokens mint, which brings in 15 ETH at the mint price. The developer lists the collection on two marketplaces and sets a 5 percent royalty. Over the next month, 40 tokens resell at an average of 0.08 ETH, which is 3.2 ETH in sales and 0.16 ETH in royalties.

One bug appears: the metadata for token 12 points to the wrong image, because the file was uploaded twice. The developer fixes the metadata file on IPFS and updates the contract link, then checks all 500 tokens display correctly. The fix is cheap because the metadata is off chain.

What are the common mistakes?

The most common NFT deployment mistakes are skipping tests, hardcoding a metadata link that can break, and leaving the deployer key in a developer laptop.

  • Deploying untested code. A bug in a deployed contract is hard to fix, so test every function and every unhappy path first.
  • Centralised metadata. A metadata link on a server you control can change or vanish; use IPFS or a similar store.
  • Wrong supply or price. A maximum supply of 5,000 instead of 500, or a price with one decimal wrong, cannot be undone cheaply.
  • Unverified contract. Buyers cannot read what an unverified contract does, so they trust less and buy less.
  • Deployer key in one place. Whoever holds the key controls the contract, so use a hardware wallet or a multisig.

For the wider development picture, smart contract development covers the tools and patterns that sit behind every NFT contract.

Key takeaways

  • The contract, not the image file, is what makes a token an NFT
  • ERC-721 fits unique items; ERC-1155 fits editions and game items
  • Test on a local chain, then a test network, before any main network deploy
  • Verify the source code so buyers can read the rules themselves
  • Metadata belongs on IPFS, not on a server you control

Frequently asked questions

What is the difference between writing an NFT and minting one?

Writing an NFT means coding and deploying the smart contract that defines the collection. Minting means creating one token from that contract. The developer writes the contract once, and buyers mint tokens from it afterwards.

Do I need to write code to create an NFT?

Not always. Marketplaces let you mint single NFTs without code, but a collection with custom rules, a fixed supply or a mint price needs a smart contract, and that means writing and deploying code.

Which blockchain should I deploy my NFT on?

Ethereum has the widest marketplace support, while Polygon and Base cost less in gas. Match the network to your buyers: collectors on Ethereum expect higher prices, while game and edition buyers often prefer cheaper networks.

How much does it cost to deploy an NFT contract?

Deployment costs gas, which varies by network and by contract size, so no single figure is honest. Test networks are free, and cheaper networks cost far less than Ethereum. Budget for deployment, verification and a few test mints.

What is IPFS, and why does NFT metadata use it?

IPFS is a decentralised file store where a file is addressed by its content, not by a server location. NFT metadata uses it so the image and details cannot be changed or removed by one server going down.

Can I change an NFT contract after deployment?

Usually not. A deployed contract is fixed unless it was written with an upgrade pattern, which adds risk. That is why testing and an audit matter before deployment: the code you deploy is the code you live with.

Found this useful? Share it.
Hertiv engineering team

Written from projects we build for clients: blockchain systems in production. Every post is reviewed by a senior engineer before publishing and updated when practice changes.

About HertivHow we work

Building an NFT collection and need the contract done right? Talk to Hertiv.

A senior engineer replies within one business day. Or see our Smart Contract Development service.

Book a free call

Keep reading

All posts

Tell us what you want to build

A senior engineer reads every request and replies within one business day with questions, a rough range, or a call link.

  • NDA on request before any details
  • You own all code, models and IP
  • US, UK and EU time-zone overlap

Your email app should open with your message ready to send. If it does not, write to contact@hertiv.com.

Prefer email? Write to contact@hertiv.com
Estimate costBook a call