ERC-5791: Physical Backed Tokens Smart Contract Module in Bunzz

The ERC-5791: Physical Backed Tokens module is an extension of the EIP-721 and a minimal interface for linking ownership of EIP-721 NFTs to a physical chip.

It proposes a minimal interface for a EIP-721 NFT to be “physically backed” and owned by whoever owns the NFT’s physical counterpart.

It is an implementation of PBT where all chipAddress -> tokenIds are preset in the contract by the contract owner.

You can access this Module and the code here: https://bit.ly/3JV9Ijl

How to Use

Each NFT is conceptually linked to a physical chip.

When the NFT is minted, it must also emit an event that includes the corresponding chip address (20-byte address derived from the chip’s public key). This lets downstream indexers know which chip addresses are mapped to which tokens for the NFT collection. The NFT cannot be minted without its token id being linked to a specific chip.

The interface includes a function called transferTokenWithChip that transfers the NFT to the function caller if a valid signature signed by the chip is passed in. A valid signature must follow the schemes set forth in EIP-191 and EIP-2 (s-value restrictions), where the data to sign consists of the target recipient address (the function caller) and a recent blockhash (the level of recency is up to the implementation).

The interface also includes other functions that let anyone validate whether the chip in the physical item is backing an existing NFT in the collection.

To aid recognition that an EIP-721 token implements physical binding via this EIP: upon calling EIP-165’s function supportsInterface(bytes4 interfaceID) external view returns (bool) with interfaceID=0x4901df9f, a contract implementing this EIP must return true.

The mint interface is up to the implementation. The minted NFT’s owner should be the owner of the physical chip (this authentication could be implemented using the signature scheme defined for {transferTokenWithChip}).

Functions

#WRITE

  • transferTokenWithChip
  • safeTransferFrom
  • transferFrom
  • transferTokenWithChip
  • approve
  • setApprovalForAll
  • safeTransferFrom

#READ

  • getApproved
  • isChipSignatureForToken
  • name
  • symbol
  • tokenIdFor
  • tokenURI
  • balanceOf
  • isApprovedForAll
  • ownerOf
  • supportsInterface
  • tokenIdMappedFor
  • getMaxBlockhashValidWindow

You can access this Module and the code here: https://bit.ly/3U7lg7T

If you still haven’t signed up to Bunzz, what are you waiting for?

Sign up here https://app.bunzz.dev/signup and get your smart contracts deployed in 5 minutes through our great GUI.

Share this article:

Leave a Comment

Your email address will not be published. Required fields are marked *