Hashlips生成NFT数量未达预期问题求助
解决Hashlips Art Engine生成NFT数量不足问题
问题描述
我使用Hashlips [版本:1.1.1]搭配Node JS(v16.13.2)生成NFT集合,Layers文件夹包含2个子文件夹:45个Background文件、135个Shoes文件,理论应生成45×135=6075张图片,但实际生成到5615张左右就停止,终端提示需添加更多图层才能生成更多唯一图片,且重复生成时数量略有波动。已确认两个文件夹内均为不同的同尺寸PNG,设备为Windows 10,剩余存储空间200G。
当前Config.js配置
const basePath = process.cwd(); const { MODE } = require(`${basePath}/constants/blend_mode.js`); const { NETWORK } = require(`${basePath}/constants/network.js`); const network = NETWORK.eth; // General metadata for Ethereum const namePrefix = "Nft collection article Name example"; const description = "example NFT description "; const baseUri = "ipfs://NewUriToReplace"; const solanaMetadata = { symbol: "EX", seller_fee_basis_points: 500, // Define how much % you want from secondary market sales 1000 = 10% external_url: "https://www.example.com", creators: [ { address: "jdk3R0000EXAMPLEADRESSD0000oUKeB433SSh", share: 10000, }, ], }; // If you have selected Solana then the collection starts from 0 automatically const layerConfigurations = [ { growEditionSizeTo: 6075, layersOrder: [ { name: "Background" }, { name: "Shoes" }, ], }, ]; const shuffleLayerConfigurations = false; const debugLogs = true; const format = { width: 2048, height: 2048, smoothing: false, }; const gif = { export: false, repeat: 0, quality: 100, delay: 500, }; const text = { only: false, color: "#ffffff", size: 20, xGap: 40, yGap: 40, align: "left", baseline: "top", weight: "regular", family: "Courier", spacer: " => ", }; const pixelFormat = { ratio: 2 / 128, }; const background = { generate: false, brightness: "80%", static: false, default: "#000000", }; const extraMetadata = { creator: "d3fco man", }; const rarityDelimiter = "#"; const uniqueDnaTorrance = 10000; const preview = { thumbPerRow: 5, thumbWidth: 50, imageRatio: format.height / format.width, imageName: "preview.png", }; const preview_gif = { numberOfImages: 5, order: "ASC", // ASC, DESC, MIXED repeat: 0, quality: 100, delay: 500, imageName: "preview.gif", }; module.exports = { format, baseUri, description, background, uniqueDnaTorrance, layerConfigurations, rarityDelimiter, preview, shuffleLayerConfigurations, debugLogs, extraMetadata, pixelFormat, text, namePrefix, network, solanaMetadata, gif, preview_gif, };
解决方案
- 调大
uniqueDnaTorrance参数:当前配置中uniqueDnaTorrance设为10000,这是引擎尝试生成唯一DNA的最大重试次数。虽然理论生成量6075小于该值,但随机生成时的DNA碰撞会消耗重试次数,导致提前停止。建议将该值修改为100000,给引擎足够的重试空间来覆盖所有组合。 - 清理生成缓存:每次生成前,删除项目目录下的
build文件夹和dnaList.json文件,避免之前的生成记录干扰新的生成流程,确保引擎从全新状态开始工作。 - 验证文件名规范:检查所有图层文件名,确保没有特殊字符、空格,且稀有度分隔符
#使用正确(与配置中的rarityDelimiter一致),避免引擎读取图层时出现异常。 - 强制遍历所有组合(进阶方案):如果上述方法仍未解决问题,可以修改Hashlips的核心生成逻辑,将随机生成DNA改为遍历Background和Shoes的所有组合。找到生成DNA的核心函数,替换为循环遍历两个图层文件夹的所有文件,直接生成所有可能的组合,彻底避免随机碰撞问题。
内容的提问来源于stack exchange,提问作者d3fcom
相关产品推荐
相关产品推荐

