Got transaction from contract, but then it stays in 'pending' - timeout after 50 blocks

I have developed a small contract which is calling another contract to mine some standard ERC20 token (OpenZeppelin contract v2.5).
On ganache it worked always fine.
Deoyed Sunday on Kovan, got a transaction id after contract .send(), then it stayed forever in ‘pending’ state.
Deployed it Monday on Rinkeby , initiated a transaction, and it worked fine, confirmed within 20 sec.
Doing the same again today on Rinkeby, now here as well the transaction stays in ‘pending’ state ! :frowning:

actually its just a contract which stores the deployed address of the OZ ErC20 token, cals .mint (owner, amout) and writes some data to its own datafield on the blockchain).
I increased gas price to 50 GWei, did not help.
Strangely when I had the problem already on kovan on Sunday, even the call from remix to the deployed contract was not mined … so yes, it looks like its actually something with the.contract (not the UI)

	function addItem(
			string memory _fileHash,
	    uint   _productAmount,
			string memory _productName,
      uint    _mintAmount,
      string memory _metadata)
		// check if any parameter is too long / out of scope

		// check if item does not already exist
    require(itemByHash[_fileHash].registrar == address(0), "item hash is already registered");

    // TODO implement payable contract
		// require(msg.value (uint) == price, "amount sent does not match price");  // number of wei sent with the message

    // check if a token contract has been set
		require(address(tokenContract) != address(0), 'No token contract defined');

		bool tokenMintResult =, _mintAmount);

		require(tokenMintResult, "Token mint process failed");

		Item memory item = Item({
			id              : itemCount,
			registrar       : msg.sender,  // tx.origin ?
			blockTimestamp  : block.timestamp,  // do we actually have to store that explicitly? TODO?
			productName     : _productName,
			productAmount   : _productAmount,
			tokenContractAddress : address(tokenContract), // tokenContract.address, .this (current contract’s type): the current contract, explicitly convertible to address // TODO
			mintAmount      : _mintAmount,
			fileHash        : _fileHash,
			// tokenMintTx     : tokenMintResult,
			metadata        : _metadata

	    // add new item to mapping : hash -> item
		itemByHash[_fileHash] = item;

		// add new item to mapping : id -> item
		items[itemCount++] = item;

		// add new item to registrar.array[] > item

		emit eventAddItem(int(itemCount - 1));
1 Like

I just met another ethereum developer and we came to the conclusion that due to missing gas some transaction were still pending (for whatever reason) stopping following transactions to execute. He suggested to start a simple transaction (internal transfer between 2 accounts with 0 ETH, but enough gas) and setting the transaction to the first failed nounce.
Looks like it worked !
This happened before to me when I was only developing on Ganache and re-/deploying, resusing Metamask, and eventually Metamask gets confused with the nounce …

1 Like

Hi @SvenMeyer,

Welcome to the community :wave:

I hadn’t seen anything obvious in the contract. Glad you were able to resolve.

It would be great when you get a chance if you could Introduce yourself here!