0

I'm debugging a smart contract through a dApp I built. The contract I'm building has some adding and some removing. When I add something, everything works, but when I remove stuff then something explodes. Every time this happens I have to:

  • Kill the dapp
  • Kill ganache
  • Restart ganache
  • Rebuild the contracts if I changed something ad migrate them
  • Restart the dApp
  • Modify my address in MetaMask (importing the new ganache account or importing a new mnemonic)

I need to kill and restart Ganache because MetaMask gives weird errors like

  • Infinite loop (just the spinner going on forever)
  • Something about the blocks of the dApp being old
  • Errors about how the delete transaction needed more gas (which I believe it means my contract is doing too many things and I'm investigating why), which makes MetaMask behave weirdly and forces me to follow the above mentioned steps
  • Sometimes I issue a single request and there are 2 instead of one in queue, sometimes triggering the infinite loop thing

These errors can only be solved by restarting ganache and changing address. So I'm really getting tired of doing this over and over, is there a way to make the debugging of a smart contract simpler?

1

Maybe this will help you: http://truffleframework.com/tutorials/debugging-a-smart-contract (I also recommend the cryptozombies tutorial, in case you haven't done it yet)

  • Thank you for the answer, I only followed the Truffle tutorial. I will definitely look into the resources you mentioned. My question was more related to what infrastructure I should use to quickly do what I am doing right now with all those steps. – Masiar Apr 12 '18 at 6:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.