I am trying to figure out how to print values to the console while doing truffle debug <txhash>. So far I have tried using an event called "TestValue", but I am not seeing the output in the console window like so. Does anybody have any insight as to how I can print out a numeric value to the console? I have also looked into logx, such as doing log0(uint256Value) but saw that that is looking for bytes instead of a uint256.

This is the TestValue event that I tried that is not printing the output I am looking for:

enter image description here

Which is the method that I believe is making my contract fail like so:

enter image description here

Greatly appreciate in advance if somebody can help me to see the values being compared in that condition!


Now you can easily see the state of local variables pressing v during the debug. Also, you can see specific expression using the watch function.

For more information please read the following very good Truffle tutorial: Variable Inspection: going deeper with the truffle solidity debugger


If you want to see the value of a function that return uint256, try

(await [the function that return uint256]()).toString()

Uint256 is a kind of number but it is only ready to be displayed as string. On blockchain, every method is asynchronous, remember to add await before each method so that you can pipeline the result

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.