# Step debugging with truffle and ganache

By [N00b21337](https://paragraph.com/@n00b21337) · 2023-01-11

---

Truffle has decent step debugger in its CLI, what is extra convinient is that you could step debug any transaction on any chain with it. Use this little trick. Run Ganache as fork of mainet or any other chain you want (check the docs for other chains)

    ganache --fork  
    

This will start a fork of mainet locally and all you have to do next is to find some transaction you want to step debug and add it to line like below

    truffle debug 0x75923601c12bb33d67a83d876f23f030abaaa9b21eae4b1e79c8532f821db902 --fetch-external --url http://127.0.0.1:8545
    

this will take up to 5 minutes to load from node but once it does you can quickly debug all in that transaction.

One note, it is said things are faster if you add your etherscan api key to the truffle-config.js like so, but I didnt see much improvement 

      etherscan: {
        apiKey: "0123456789abcdef0123456789abcdef", //replace this with your API key if you have one
      },

---

*Originally published on [N00b21337](https://paragraph.com/@n00b21337/step-debugging-with-truffle-and-ganache)*
