Hi all,
I use a very simple ERC1155 to generate token. Today I just do a 10 threads testing to mint 100 tokens by 10 batchMint run at the same time. However, I found I only can mint 1 batchToken in 1 block. rest of the submission are pushed to next block. How can I mint several different batch tokens by mintBatch within one block?
On the other hand, I also notices that same situation happened with batchTransfer. I can only send one batchTransfer at a time, if I send multi batchTransfer, the 2nd submission will be push to next block. I don’t recall any limitation in the ERC1155 specification. Did I do anything wrong?
Environment
- Ubuntu with geth 1.19.20 Ethereum chain
- Openzeppelin 3.1.0
- Python web3 5.12.0
Details
- include OpenZeppelin ERC1155 library
- Generate 10 threads to mint 100 token by 10 batchMint function
- Observed that only 1 batchMint in one block. Others are pushed to next. In total 10 blocks to complete.
- Observed that same situation with batchTransfer. I only can do 1 batchTransfer at a time.
Code to reproduce
// contracts/GameItems.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
contract GameItems is ERC1155 {
constructor() public ERC1155("https://game.example/api/item/{1}.json") {
}
myMintFunc(address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data) public onlyOwner {
_mintBatch(to, ids, amounts, data);
}
}