AnswerBun.com

How to handle exceptions in ethreum private network using revert(),throw

Ethereum Asked by Arpit Gupta on January 3, 2022

I am running a private ethereum network using

 geth  --rpc  --rpccorsdomain "*" --datadir ./chaindata --port "30330" --nodiscover --rpcapi "db,th,net,web3" --networkid 2010 init genesis.json

and then

geth  --rpc  --rpccorsdomain "*" --datadir ./chaindata --port "30330" --gasprice 1 --nodiscover --rpcapi "db,eth,net,web3" --networkid 2010 console

when I calls a contract functions

 function checkValid( string Name)public returns(bool)
{
    if(isvaliduser[Name]==false)revert();
    Count[Name]+=1;        
 }

Which is deployed in remix solidity IDE, in web3 provider environment, I have given wrong parameters in order to call revert .The functions does not get executed and stays in transaction pending.

But my problem is : Now after giving correct parameters also function do not execute, what can be the reason.

Any help will be highly appreciated.

One Answer

A revert operation should not cause the transaction to remain in the pending state. The transaction should be processed, and included in the blockchain, but have no effect except for incrementing the sender account's nonce and spending any gas that was used up the point where the contract hit revert.

If your transactions are really getting stuck in a pending state, don't worry the content of your contract and instead look at some of these issues to see which matches what you're seeing: https://ethereum.stackexchange.com/search?q=transaction+stuck+pending

Answered by Edmund Edgar on January 3, 2022

Add your own answers!

Related Questions

Nethereum C# FilterInput.GetAllChanges always empty

1  Asked on February 12, 2021 by exaltedoil

       

Testing Gas Token on testnet failing transaction

0  Asked on February 9, 2021 by marr

   

I am unable to install web3 on my mac

1  Asked on February 5, 2021 by saiteja-kuruva

 

Out of stack DUP2 1/1024 when adding string to parameter

0  Asked on February 1, 2021 by koukotsu

   

How to find contract’s address?

6  Asked on January 31, 2021 by user3280964

   

Import error in Truffle Pet Shop tutorial

1  Asked on January 29, 2021 by xpain

   

Timeout w/ Mocha on deploying a contract

2  Asked on January 26, 2021 by tulun

   

How to send ERC20 token to smart contract in constructor

1  Asked on January 24, 2021 by user938363

 

Deploy bytecode

1  Asked on January 19, 2021 by william-entriken

   

Ask a Question

Get help from others!

© 2023 AnswerBun.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP