# 记录一次失败的白名单Mint **Published by:** [plsdm7](https://paragraph.com/@dogsuisui/) **Published on:** 2022-12-19 **URL:** https://paragraph.com/@dogsuisui/mint ## Content 不想多说代码贴上。 import { Alchemy, Network, AlchemySubscription } from "alchemy-sdk"; import Web3 from "web3" const rpcURL = "https://arb-mainnet.g.alchemy.com/v2/vDHAR2QADrZE_MWvAbSrGIrWa0--plsN" const web3 = new Web3(rpcURL) const address = "0xDac752245d44f396630C84394E5dB9B5dE6614dD" const account = web3.eth.accounts.privateKeyToAccount("private key") const settings = { apiKey: "apiKey", // Replace with your Alchemy API Key network: Network.ARB_MAINNET, // Replace with your network }; const alchemy = new Alchemy(settings); function printTxn(tx) { if (tx.transaction.to == nftContractAddress) { if (tx.transaction.input.includes("9a76bffd0000000000000000000000000000000000000000000000000000000000000002")) { minEgg() } } } const nftContractAddress = "0x990eb28e378659b93a29d46ff41f08dc6316dd98" const hackrDaoMintEvents = { method: AlchemySubscription.MINED_TRANSACTIONS, } alchemy.ws.on( hackrDaoMintEvents, (tx) => printTxn(tx) ); let minted = false let es = await web3.eth.getGasPrice() console.log(es) async function minEgg() { if (!minted) { let es = await web3.eth.estimateGas() console.log(es) minted = true let signed = await account.signTransaction({ from: "wallet address", to: '0x990eb28e378659b93a29d46ff41f08dc6316dd98', gasLimit: 500000, gasPrice: 20000000000, data: "0x9a76bffd", value: web3.utils.toWei("0.043409629044988", "ether") }) let txn = await web3.eth.sendSignedTransaction(signed.rawTransaction) console.log(txn) } } 看起来都没毛病,alchemy的接口很好用,我测了一下速度非常也非常快(基本10毫秒以内),唯一问题是现在arbitrum还不支持pending transation,不过问题也不是很大。 问题来了!!!他妈的我看了之前的请求基本gaslimit都是4十多万,我就随手射了个50万,也没仔细看代码,妈的没想到阿没想到,这个mint阶段二前面好多判断,gaslimit直接就抄了,我他妈循环调用了十几次全失败了,还好这是arb不是eth,gas费还是小事,妈的别人手动都mint到了我自动居然全失败了。。 留作教训,以后gas limit给我狠狠设大一点!!!反正用不完会退,莫名其妙节约了个寂寞。这种不需要构造参数的机会错过了就得等着啦,可惜了~ ## Publication Information - [plsdm7](https://paragraph.com/@dogsuisui/): Publication homepage - [All Posts](https://paragraph.com/@dogsuisui/): More posts from this publication - [RSS Feed](https://api.paragraph.com/blogs/rss/@dogsuisui): Subscribe to updates - [Twitter](https://twitter.com/plsdm7): Follow on Twitter