# How to: ERC-1155 ID Substitution for Token URI

**URL:** <https://forum.openzeppelin.com/t/how-to-erc-1155-id-substitution-for-token-uri/3312>\
**Category:** Contracts\
**Created:** [July 13, 2020, 5:15pm UTC](https://forum.openzeppelin.com/t/how-to-erc-1155-id-substitution-for-token-uri/3312 "2020-07-13T17:15:21Z")\
**Posts on this page:** 1\
**Showing post:** 16

<div class="post-metadata">

**Author:** ![soenkeba](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/soenkeba/32/9840_2.png) [@soenkeba](https://forum.openzeppelin.com/u/soenkeba)\
**Post date:** [October 24, 2021, 8:37am UTC](https://forum.openzeppelin.com/t/how-to-erc-1155-id-substitution-for-token-uri/3312/16 "2021-10-24T08:37:05Z")

</div>

Great idea and it works not only in theory 🙂 So no more reasons to have centralized NFTs 🙂

The URI function needs to be overwritten like this:

```auto
    import "@openzeppelin/contracts/utils/Strings.sol"
    
    function uri(uint256 _tokenID) override public view returns (string memory) {
    
       string memory hexstringtokenID;
         hexstringtokenID = uint2hexstr(_tokenID);
    
    return string(
        abi.encodePacked(
        "ipfs://f0",
        hexstringtokenID)
        );
    }

Here is an [example](https://soenkeba.medium.com/truly-decentralized-nfts-by-erc-1155-b9be28db2aae).
```

---

_[View the full topic](https://forum.openzeppelin.com/t/how-to-erc-1155-id-substitution-for-token-uri/3312)._
