How to ensure that the transaction is minted?

Hello, how can I ensure that the transaction gets minted? For example, I have something like the example code from the infura docs:

const Web3 = require("web3");

async function main() {
  // Configuring the connection to an Ethereum node
  const network = process.env.ETHEREUM_NETWORK;
  const web3 = new Web3(
    new Web3.providers.HttpProvider(
  // Creating a signing account from a private key
  const signer = web3.eth.accounts.privateKeyToAccount(

  // Estimatic the gas limit
  var limit = web3.eth.estimateGas({
    from: signer.address, 
    to: "0xAED01C776d98303eE080D25A21f0a42D94a86D9c",
    value: web3.utils.toWei("0.001")
  // Creating the transaction object
  const tx = {
    from: signer.address,
    to: "0xAED01C776d98303eE080D25A21f0a42D94a86D9c",
    value: web3.utils.numberToHex(web3.utils.toWei('0.01', 'ether')),
    gas: web3.utils.toHex(limit),
    nonce: web3.eth.getTransactionCount(signer.address),
    maxPriorityFeePerGas: web3.utils.toHex(web3.utils.toWei('2', 'gwei')),
    chainId: 3,                  
    type: 0x2

  signedTx = await web3.eth.accounts.signTransaction(tx, signer.privateKey)
  console.log("Raw transaction data: " + signedTx.rawTransaction)

  // Sending the transaction to the network
  const receipt = await web3.eth.sendSignedTransaction(signedTx.rawTransaction)


My question is that this transaction will always be minted or if it can fail? If it can fail, what is the best practice to retry the transaction? (Like storing the receipt in a DB and then each hour for example check if it was minted or it has an error?) how can I check if the receipt was minted successfully?


To respond to myself, I stored the hash transaction in a db and then each hour I do a getTransaction and if it is null I repeat the transaction and if it is not null and have passed 10 blocks from the current block I delete the transaction from the db, is it correct?

Hey, yeah that’s one good way to do it.