When I return a Big Number in the Truffle Console, the format of my results is something like:

truffle(development)> tokenInstance.balanceOf(accounts[2])
<BN: 64>

However, in one of the video tutorials that I'm using, the output that the video shows is something like:

truffle(development)> tokenInstance.balanceOf(accounts[2])
BigNumber { s: 1, e: 2, c: [ 100 ] }

Are there any config options in truffle so that my output can look like the latter? (And I'm not worried about converting my results to base 10: I know that I can do that with a callback and toNumber().)

  • Try const bigNumber = new BigNumber(bn.toString()). Commented Jan 30, 2019 at 14:48
  • @goodvibration I was hoping that the output would be formatted directly right after a call without any extra coding (otherwise I can do a callback as described in my question). I'll edit my question to make this a bit clearer.
    – Eric
    Commented Jan 30, 2019 at 14:56

2 Answers 2


The format changed in Truffle v5 since it is base on web3 v1 which uses bn.js. To have the format used previously you have to install Truffle v4 which is based on web3 v0.20 which uses bignumber.js.


You can change the number format to BigNumber by

// Choices are:  `["BigNumber", "BN", "String"].
const Example = artifacts.require("Example");
Example.numberFormat = "BigNumber";

as described in the 5.0 breaking changes section:

Numeric return values are now BN objects instead of the previously default BigNumber.js. These two projects use significantly different API semantics, so you may want to review those.

Truffle provides a compatibility mode for projects unable to make the switch wholesale. Set numberFormat to "BigNumber", "String", or "BN" to choose.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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