var contract = web3.eth.contract(abiDefinition).at(address);
     contract.test(value, gotResult);
     function gotResult(error, result) {
            if(!error) {
            else {


 contract A {
     function test(uint8 x) constant returns(uint8) {
         return x + 10;


enter image description here


result is a BigNumber object that is stringified to something like { [String: '5'] s: 1, e: 0, c: [ 5 ] }. You can use BigNumber methods, like result.toNumber() to see it better.

When integers are involved, web3.js uses BigNumber because native Javascript numbers are not large enough.

It's out of scope here to go into the internals of a general external library like BigNumber.

The main thing that helps is to recognize that when you get an object that looks like it, is that it's probably a BigNumber and you can call methods on it, as well as perform other additional BigNumber operations (without needing to know its internals).

  • 3
    What does S, C, E stand for? May 14 '18 at 23:15
  • 10
    @quantumpotato According to the BigNumber repo, S stands for sign, E for exponent and C for coefficient (or significand). May 17 '18 at 20:21

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.