NFT(ERC721) with Physical Asset Delivery and Secondary Royalties(ERC2981)

Lim Chee Kin
3 min readNov 19, 2021

I think the NFT(ERC721) is an important use case that every Solidity developer needs to get familiar besides ERC20.

The token of the dApps known as Physical Asset Token with symbol PA as it is involved physical item delivery. The seller of the NFT needs to specify the "Lock From Date" and "Unlock Password" upon minting the NFT. The NFT is locked starting from the "Lock From Date". The buyer cannot sells/transfers the NFT until he/she unlocks the NFT with the "Unlock Password" that come with the physical item.

The project is created by referred to excellent tutorials on ERC721 and Secondary Sales Royalties published by Thomas Wiesner.

The project is using the following third party libraries:

  • Use nft.storage to store the image of the NFT and metadata.json file to the IPFS. You can find out more about nft.storage here.
  • Use @openzeppelin/contracts for implementation of ERC721.
  • Reuse the codes of @rarible/royalties/contracts.
  • Use truffle-assertions for writing unit tests.

It is tested with MetaMask Chrome extension and Android. I think it is good idea to test out the dApp hosted on Skynet yourself before looking into the code, the following is the main screen of the dApps:

The dApps is interacting with smart contracts running on Rinkeby testnet, hence you need some ETH in your wallet. If you don’t have any, you can request some ETH from Rinkeby Faucet.

After connected to MetaMask from the main screen, you will see the following screen which allow you to upload image to the IPFS and mint the NFT by click on the “Create” button.

After the token created successfully then click the list tab to view it, you will see the following screen:

Then you can view the minted NFT in the testnet/testsite of the following NFT marketplaces:

  • Mintable

However, it is unable to view on Mintable as per response from the Customer Support on 17 Nov 2021: “I’ve made a check with the devs. Our Rinkeby Testnet is currently outdated. The devs are working on it to get it updated, unfortunately, I do not have an ETA on when it’ll be updated. Hope this explains!”

Thanks for still following the article till here. Do you know how to test the secondary sales royalties feature to make sure it is working with OpenSea, Rarible or Mintable? If you know how to do so, appreciate you share it in the comment section.

If you are interested to look into the code and run it in your local machine, please check out the git repository hosted at https://github.com/limcheekin/eth-erc721-physical-asset-delivery/. Feel free to fork the repository and send me pull request.

I hope to hear from you soon! :)

--

--

Lim Chee Kin

A business-minded full stack developer. Experienced in Java technology, interested on DApps, Solidity, Flutter, online marketing and algorithmic trading.