# Struggling with assigning token name during mint (New Dev)

**URL:** <https://forum.openzeppelin.com/t/struggling-with-assigning-token-name-during-mint-new-dev/34025>\
**Category:** Contracts\
**Tags:** erc721, solidity, nft\
**Created:** [December 29, 2022, 9:53pm UTC](https://forum.openzeppelin.com/t/struggling-with-assigning-token-name-during-mint-new-dev/34025 "2022-12-29T21:53:45Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![ernestognw](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/ernestognw/32/18576_2.png) [@ernestognw](https://forum.openzeppelin.com/u/ernestognw)\
**Post date:** [December 31, 2022, 1:10am UTC](https://forum.openzeppelin.com/t/struggling-with-assigning-token-name-during-mint-new-dev/34025/4 "2022-12-31T01:10:48Z")

</div>

No problem, happy to help.

> So I was running into a weird issue where abi.encodePacked was actually causing the safeMint to revert, but by dropping 'Packed' for abi.encode the transactions would work without a problem.

⚠ Beware there are differences between `encode` and `encodePacked` that may result in a unexpected result, please check [this post](https://forum.openzeppelin.com/t/abi-encode-vs-abi-encodepacked/2948/2) and the [ABI spec docs](https://docs.soliditylang.org/en/v0.8.17/abi-spec.html) just to make sure you're doing what you want, otherwise it may be dangerous to blindly rely on them. I'd assume you'll be fine practicing.

> The concatenations are all working in my code as well, so the immediate question is how to write the code to set the concatenated strings as token names specifically, so that they don't just churn out as tokenIds as default.

I don't think that's possible. Your NFT contract is **not a single NFT** , it's just a contract that creates tokens (like a collection), so, setting the name will set the name of the whole collection, not a single NFT.

This may work if your contract was a collection with just 1 token, but since you're adding a `batchMint`, I think you're misunderstanding the properties of the contract.

Also, I see your [metadata](https://ipfs.io/ipfs/Qmc9C6PywPykjLpPqEtbnAwMgtFVKYxEo3mS6baE3X4oFY) is uploaded in the `baseUri`, which should be a directory with the metadata of each `tokenId`.

I'd suggest taking a look to [our docs](https://docs.openzeppelin.com/contracts/4.x/erc721#constructing_an_erc721_token_contract), and have a read to the [EIP721 specification](https://eips.ethereum.org/EIPS/eip-721) to get a better sense of what's the contract designed for.

Best

---

_[View the full topic](https://forum.openzeppelin.com/t/struggling-with-assigning-token-name-during-mint-new-dev/34025)._
