Skip to main content

Create an NFT Collection Using LSP8

This tutorial explains how to create a collection of unique Digital Assets based on the LSP8-Identifiable-Digital-Asset standard.


This guide builds on top of a Hardhat project using TypeScript as described in the Getting Started section.


The full code of this example can be found in the smart contract section of the πŸ‘Ύ lukso-playground repository.

When creating smart contracts representing digital assets on LUKSO, you need to specify the type of token you are deploying. This is done by setting the LSP4TokenType data key stored in the πŸ—‚οΈ ERC725Y storage of the Digital Asset. There are three different token types:

  • 0 = Token
  • 1 = NFT
  • 2 = Collection

For this example we will use the Collection token type. You can create a custom πŸŒ„ LSP8 Identfiable Digital Asset Collection that extends LSP8Mintable so that new assets can be created within the smart contract.

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

// modules
import {
} from "@lukso/lsp-smart-contracts/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.sol";

// constants
import {
} from "@lukso/lsp-smart-contracts/contracts/LSP8IdentifiableDigitalAsset/LSP8Constants.sol";
import {
} from "@lukso/lsp-smart-contracts/contracts/LSP4DigitalAssetMetadata/LSP4Constants.sol";

contract BasicNFTCollection is LSP8Mintable {
string memory nftCollectionName,
string memory nftCollectionSymbol,
address contractOwner
nftCollectionName, // NFT collection name
nftCollectionSymbol, // NFT collection symbol
contractOwner, // owner of the NFT contract (the address that controls it, sets metadata, can transfer the ownership of the contract)
_LSP4_TOKEN_TYPE_COLLECTION, // type of the token is collection
_LSP8_TOKENID_FORMAT_NUMBER // format of each `tokenId`s is number (represented as bytes32)

The contract is ready, it's time to deploy it. You can easily do it with hardhat deployment script.

import { ethers } from 'ethers';
import BasicNFTCollectionArtifacts from './artifacts/BasicNFTCollection.json';

const accounts = await ethers.getSigners();
const deployer = accounts[0];

const contractFactory = await new ethers.ContractFactory(

const nftCollection = contractFactory.deploy(
'NFT Collection Name', // collection name
'NFT', // collection symbol
const nftCollectionAddress = await nftCollection.getAddress();
console.log('NFT Collection deployed to:', nftCollectionAddress);
console.log('Check the block explorer to see the deployed contract');

Finally, run the deploy script:

npx hardhat run --network luksoTestnet scripts/deploy.ts

You can now check out the NFT collection contract on the execution block explorer by pasting the address logged on the console to the search field of the block explorer.