TimeShift-NFT is an advanced dynamic NFT project built with Hardhat and Ignition, designed for modern Web3 developers.
Dynamic NFTs, Real-Time Visuals:
Each NFT updates its on-chain SVG color based on the current time, creating a living, interactive asset.
- Smart Contract:
DynamicNFT.sol
On-chain logic for minting and dynamic SVG generation. - Testing:
DynamicNFT.test.js
Comprehensive unit tests for contract reliability. - Deployment:
DynamicNFTModule.js
Automated deployment with Hardhat Ignition.
- Smart Contract:
DynamicNFT.sol
On-chain logic for minting and dynamic SVG generation. - Testing:
DynamicNFT.test.js
Comprehensive unit tests for contract reliability. - Deployment:
DynamicNFTModule.js
Automated deployment with Hardhat Ignition.
- Contract Address:
0xA7FF038011ab80e0837262c9BAe3814352317cF4 - Etherscan: View Code
- Sourcify: Full Match
-
Install dependencies
npm install -
Configure environment
SEPOLIA_RPC_URL=your_sepolia_rpc_url
PRIVATE_KEY=your_private_key
ETHERSCAN_API_KEY=your_etherscan_api_key
-
Run tests
npx hardhat test -
Deploy to Sepolia
npx hardhat ignition deploy ./ignition/modules/DynamicNFTModule.js --network sepolia -
Verify on Etherscan npx hardhat verify --network sepolia <CONTRACT_ADDRESS> ```
A dedicated frontend is available to interact with the TimeShift-NFT smart contract. You can mint NFTs, view real-time dynamic SVGs, and explore your collection visually.
- Live Demo (Vercel): https://time-shift-nft-frontend.casaislabs.com/
- Source Code (GitHub): https://github.com/martinperezcss/TimeShift-NFT-Frontend
The frontend is fully integrated with the deployed contract on Sepolia. Connect your wallet and experience dynamic NFTs in real time!
After deployment, you can interact with the contract using Hardhat Console or scripts.
npx hardhat console --network sepolia
const [owner] = await ethers.getSigners();
const contract = await ethers.getContractAt(
"DynamicNFT",
"0xA7FF038011ab80e0837262c9BAe3814352317cF4" // Replace with your contract address if needed
);
await contract.mint();
const uri = await contract.tokenURI(1);
console.log(uri); // Returns base64-encoded JSON with dynamic SVG
If you query a non-existent token, the contract will revert with "Token does not exist".
-
Unique NFT Minting:
Each token is unique and can be minted by users. -
Dynamic SVG Metadata:
ThetokenURIfunction returns a base64-encoded SVG whose color changes with the time of day. -
Robust Error Handling:
Querying a non-existent token reverts with"Token does not exist".
Connect. Build. Shift Time.
Push the boundaries of dynamic NFTs with TimeShift-NFT.
Most wallets and NFT marketplaces (including MetaMask and OpenSea) cache the metadata at the time of minting and do not update it in real time.
Although this NFT generates its SVG image dynamically on-chain, you may not see the color change in your wallet or marketplace view.
To see the current, real-time SVG, you can call the tokenURI function directly on the contract (e.g., using Hardhat Console or Etherscan).
To see your NFT's current color and time, use the provided script:
npx hardhat run scripts/mint-and-view-nft.js --network sepoliaThis script will mint a new NFT and display its real-time SVG (with current UTC hour, minute, and second) decoded directly from the blockchain.