Search code examples
hyperledger-composer

How are "long" type integers handled in Hyperledger Composer transaction processor functions?


When defining a Hyperledger Composer model, fields can be designated to have the type long, which is implemented as an int64.

How are long values passed onto transaction processor functions, when int64 is not natively supported by Node.js? Is it converted to a Number? If so, wouldn't that mean that it is effectively downgraded to 52 bits of precision?


Solution

  • Looking at preserve int64 values when parsing json in Go, it would seem that even if it is stored internally as an int64 and serialized into JSON from golang as such, Node.js would indeed parse this into a regular Number thereby losing precision.