How to define NFT pricing on NEAR?

Hey everyone,

I’m working on an NFT project using the NEAR blockchain and I’m stuck on something. I want to set a price for my NFTs, but I’m not sure where to put this information.

I’m using the near-contract-standards library for minting. The thing is, I need to make sure my NFTs are compatible with the NEP 171 standard. So I’m wondering if there’s a way to include the price in the metadata somehow?

Has anyone done this before? Any tips or code examples would be super helpful. I’m pretty new to this, so please explain it like I’m five!

Thanks in advance for any help!

Having worked on several NFT projects on NEAR, I can attest that pricing isn’t directly addressed in NEP-171. A common approach is to implement a separate marketplace contract to handle pricing and sales logic. This keeps your NFT contract compliant with the standard while allowing flexibility in pricing mechanisms.

Consider storing a mapping of token IDs to prices within your marketplace contract. When a user wants to purchase an NFT, they’d interact with this contract, which would then handle the payment and transfer processes. This separation of concerns also allows you to easily update pricing or implement dynamic pricing models without modifying the core NFT contract.

For implementation details, I’d recommend reviewing some open-source marketplace contracts on NEAR to see how they’ve tackled this issue. It’s a common pattern in the ecosystem and can provide valuable insights for your project.

hey there pixstar54! :raised_hands:

i’ve been tinkering with nfts on near too, and pricing can be a bit tricky at first. from what i understand, the nep-171 standard doesn’t actually include price info in the metadata itself. but don’t worry, there are ways around this!

have you thought about creating a separate contract to handle the sales? that way, you could keep your nft contract nice and clean, following the standard, and then use another contract to manage pricing and transactions. it’s like having a shop separate from the warehouse, y’know?

or maybe you could store the price in an off-chain database and just reference it when needed? that might be simpler if you’re not looking to do on-chain sales.

btw, what kind of nfts are you making? sounds exciting! :smiley:

let me know if you want to brainstorm more ideas. always fun to chat about nft projects!

yo pixstar! been there, done that :sweat_smile: nep-171 doesn’t handle pricing directly. but here’s a trick: create a separate ‘marketplace’ contract. it’ll manage prices & sales, keeping ur nft contract clean. u can link em using the nft’s token id. this way u stay standard-compliant & flexible. good luck with ur project! :rocket: