Skip to content

southernlabs/tnft-generator

Repository files navigation

TrueNFT generative NFT

ducks

🔮 How it works?

This project helps to create genertive NFT collection on Everscale Blockchain.

In this project we have example images set for EverDucks collection. This images were created in Aseprite (source included). Each layer is also a trait. NFT image is a mix of different layers. Each layer shuffle and them puts together with image generator. They are highly customizable, you can easily add your own layers.

Layers in this sample (top-down):

  • hair
  • accessory
  • face
  • body
  • background

Deployed collection to FLD testnet:

0:f886bf8b123dc7d85786ce115ff3ce8eba3c6fc2608ab0f2275460f52a9ef933

Deployed tnft-explorer: tnft-generator.pages.dev

✨ Get started

This toolset support several methods and solutions of storing images and matadata

Approach 🖼️ Images 📋 Metadata
Persistent 🌐 IPFS 🌐 IPFS
Opensea-like 🌐 IPFS 📄 API
Simple 📄 API 📄 API
tNFT simplified ⛓️ Onchain 📄 API
tNFT full ⛓️ Onchain ⛓️ Onchain

✅🪢🟢🟡🟠🔮🔗⛓️🗒️📂📁

  1. Follow the 🧐 Noobs Guide to lear how to setup environment.

  2. Choose one of the approaches and follow its deploy guide:

    1. 🌐 Persistent
    2. 🌐📄 Opensea-like
    3. 📄 Simple

You can watch the video tutorial!

Watch the video

🪜 Dependencies

Better to run this project in VS Code, but you can use this sources as you want.

  • Visual Studio Code
  • Python 3.10
  • Node.js
  • Everdev

Check out 🧐 Noobs Guide to lear how to setup and install all this tools.

Workflow

  • Install all dependencies
  • Prepare your trait layers and put them in image-sources directory
  • Modify generator.ipynb to add your traits and new layers. Also set number of images to generate.
  • Run generator.ipynb to generate traits and NFT images. Images will be stored in images-output directory and traits in metadata
  • Upload images. There 3 ways to store them: on IPFS, onchain, on server
  • Setup traits API or upload metadata to IPFS
  • Deploy collection to blockchain

🪐 Uploading images

Store data

IPFS

We are using pinata.cloud for storing images

  • Create account on pinata.cloud (Free plan for 1 GB storage)
  • Get keys https://app.pinata.cloud/keys (click on admin key toggle), save them to ./uploaders/ipfs-image-uploader.ipynb
  • Run IPFS uploader to upload all of images ./uploaders/ipfs-image-uploader.ipynb

Proceed with Persistent approach guide or Opensea-like approach guide to learn how to setup collection with images on IPFS.

Your own server

You can easily store images on your own server or CDN. Just make sure they are accessible via direct link. As http://localhost/token/1.png. Proceed with Simple approach guide to learn how to use api-server and serve images offchain.

Onchain

Onchain storage is an Everscale TrueNFT feature. You can put image directly into blockhcian. It is quite expensive and have much limitations.

🪐🪐 Uploading metadata

Metadata is your NFT traits

IPFS

You can also upload metadata to IPFS. In this case you will not be able to edit it and add new traits to collection. But it is most simple way to store traits, cause you don't need API server for this.

As with images upload to IPFS we will use pinata.cloud. Set keys and run ./uploaders/ipfs-metadata-uploader.ipynb

Proceed with Persistent approach guide to learn how to setup collection with traits and metadata on IPFS.

API Server

You need to setup API server to serve metadata for your NFTs. It is the same way as traits works on Opensea.

You can easily write your own server or just serve static json files, remember we have generated them to metadata directory. In this project there is API Server out of a box. Check out api-server directory.

Proceed with Opensea-like approach guide or Simple approach guide to learn how to setup API server and serve metadata offchain.

🐋 Testing

image

You can test your collection on local machine. First make sure you have installed local blockchain in docker (everdev node se).

  • Run everdev se start
  • Navigate to "true-nft" directory: cd true-nft
  • Run yarn install
  • Run lerna bootstrap
  • Test with yarn run test-minter-ipfs

Next you can use tnft-explorer to check out your collection in convinent web interface.

Proceed with Persistent approach guide or Opensea-like approach guide or Simple approach guide to learn more.

🚀 Deploying

This example shows up how to deploy collection to the actual network.

  • Prepare your Multisig wallet (With balance more than 20 EVER ). It will be used to deploy and interact with contracts.
  • Make sure all previous steps are complete (images and traits are generated and uploaded).
  • Navigate to "true-nft" directory: cd true-nft
  • Put Multisig wallet address and keys into .env file in components/true-nft-core directory. There is already .env.example file, just replace data and rename this file.
  • components/true-nft-core/.env file must contains: NETWORK= - one of the networks: LOCAL, DEVNET, MAINNET, FLD, MULTISIG_ADDRESS=, MULTISIG_PUBKEY=, MULTISIG_SECRET= should also be set with predeployed SetCodeMultisig wallet. Also make sure this wallet has enough balance.
  • Run yarn deploy
  • Don't forget to save NFT Root address, Minter address, and keys (Without it you lost access to your collection). They are printed to console.
  • Now you can call MintNft method of Minter smart contract and mint first NFT in your collection.
  • Also you can setup price for NFT in Minter.sol contract. Change value of MINT_FEE before deploy or use setMintFee(uint128 _newFee) function to change price. To transfer funds from this contract use sendTransaction function. You can use mintNftAdmin() function to mint without paying fees.

Proceed with your approach guide to learn more.

Sources

Josh

Made up by the guys who ran the First NFT Collection on EverScale: waifuston.com. 😎

https://github.com/tonlabs/True-NFT https://github.com/benyaminahmed/nft-image-generator