1

I'm having a question on how can works a Breed System on ERC-721.

What I know

I understand well who to make a smart contract with limited supply and how to import all images and metadata to IPFS buckets. Now when a user mint an element, the smart contract will take the next one on the list and make it the owner.

What I don't know

Now I thinking on how to implement breed system (like on CryptoKitties for example), when a user have 2 NFT and want to breed them.

How can I create a new element on the collection ?

Solution 1: Do I have to push new files into IPFS from my web client when user want to breed ? So this smart contract function will only works from my own website (And user will have to trust me so it's not a real answer). I'm probably sure it's not possible to generate a new JSON file and import it to IPFS from a smart contract. (Is it ?)

Solution 2: Forget about IPFS and store metadata only into the smart contract. But in this case how can I legitimate that the data is immutable ? Do IPFS isn't used for that ?

Thank everyone for your time.

1 Answer 1

0

Yes, you can calculate IPFS addresses and store on-chain even for content you are generating genetically on-chain.

To do this you must ensure that the entire content can be generated on-chain.

Typically this means only SVG files are supported.


In this case, do note that there is zero benefit to storing the files on IPFS versus just using data URLs like the way Onchain Monkeys does.

4
  • Wow okay. Your answer look awesome, but i'm not understanding it. You say that I can generate a new JSON file an upload it on IPFS from Solidity ? And what's mean "calculate IPFS addresses" ? And store on-chain you mean on the current chain ETH/BSC/Polygon (but not on IPFS right?). And also can you define "using data URLs". I did look the OnChain Monkey smart contract and I saw that they are building all from Solidity but cannot understand where they store the data.. Thank a lots
    – Arthur
    Commented Feb 7, 2022 at 15:04
  • Onchain Monkey stores on-chain the recipe for generating the SVG file. If you want to store data on IPFS you need to know its address, Solidity CAN do this part. Lots of questions here, you are welcome to look up/join "NFT/Web3 Community Service Hour" Commented Feb 7, 2022 at 20:05
  • Hey @WilliamEntriken Where we can join in this NFT/Web3 Community Service Hour I'm trying to create breeding smart contract as well but it's kinda hard to decide where the metadata for new nfts needs to be generated on-chain/off-chain and so on Commented Feb 22, 2022 at 19:04
  • Thank you for your interested // please see the link at phor.net/#speaking Commented Feb 22, 2022 at 19:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.