0

I'm currently building an app where cNFTs are minted by a backend service on behalf of users, therefore not directly minted by users (like with Candymachine).

Ideally, I was thinking about having a queue of mint requests and microservices that process these messages, but I was wondering if it actually works if two services try to mint two cNFTs of the same collection at the same time. I don't fully understand the inners of that topic, but I was thinking that both transactions would modify the Merkle tree at the same time without the knowledge of the other, so one of them may fail. Could it work in practice, or this is impossible?

In my case, it would also be okay to pre-mint all NFTs, then transfer them to the user on-demand. Could it be a better solution?

1 Answer 1

2

You can mint two or more cNFTs in the same block because the implementation of cNFTs actually uses the account compression program which is specifically based on a concurrent merkle tree.

Basically, under the hood, the merkle tree keeps tracks of every change by keeping a log of the last valid hashes, so the previous modifications to a merkle tree don't get lost. But this has a limit and a cost, so when you configure the merkle tree that will hold your cNFTs you will have to specify a buffer which represents the max number of concurrent changes to the tree in a single block.

You can get more info here or in this video.

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.