1

I'm using alchemy to mint NFT and in the specific case this piece of code

  //the transaction
    const tx = {
        from: PUBLIC_KEY,
        to: blockChainAddress,
        nonce: nonce,
        gas: 500000,
        data: nftContract.methods.mintNFT(PUBLIC_KEY, urlS3Metadata.Location).encodeABI(),
    }

    try {
        var signPromise = await web3.eth.accounts.signTransaction(tx, PRIVATE_KEY);

        var signedTransaction = await web3.eth.sendSignedTransaction(
            signPromise.rawTransaction);

        if (signedTransaction.status == true)
            status = "IN PROGRESS";
        else
            status = "FAILED";

        var obj = { Hash: signedTransaction.transactionHash, Payload: signedTransaction, Token: token, Status: status, UserToken: userToken };

        return obj;
    }
    catch (err) {
        console.log(err);
    }

I'm still on Rinkeby network and during the test the process is quite fast. In the last days sometime it tooks more then the 15min that's the max time AWS can keep on a Lambda function and I was wondering if I can invoke the sendSignedTransaction and then leave it on the Alchemy side without waiting for a response.

Otherwise I think I should use a Fargate + a container and perform those steps on that side. Or even it's possible to pass some userdata to the Alchemy API then read them back when the notification api is invoked?

Thanks

2
  • A transaction can take a long time until it is confirmed if the gas price used is low. Perhaps it makes some sense to split in two task, sending the transaction, checking for confirmation (it doesn't have to be running all the time, perhaps waking up every few minutes, or the time you are able to wait).
    – Ismael
    Mar 20, 2022 at 14:15
  • I've done a similar approach and testing it, thanks for your hints!
    – advapi
    Mar 21, 2022 at 9:38

0

Your Answer

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

Browse other questions tagged or ask your own question.