2

Can I safely represent the counter that goes into each transaction to prevent a replay attack with a 32-bit two's complement integer, or a 64-bit one, or do I need a number type which is unbounded to represent the counter in the general case?

2

First of all, account's counter can't be greater than the global counter. The global counter grows with each manager operation. In other words, the global counter is the number of manager operations. Therefore, there is no max value.

For two years the global counter has reached ~6M, which is equal to ~3M per year.

Let's imagine, Tezos will process x10 operations in the future, it's 30M per year. In this case you can safely use single int within the next 2^31 / 30M = 71 years =)

That being said, the internal representation in the node software uses an unbounded integer.

| improve this answer | |
  • But is the type in the client/reference implementation/definition implemented as a arbitrary size integer? – Thorkil Værge Sep 7 at 11:22
  • Yes, they use arbitrary-precision integers. Small integers internally use a regular OCaml int. When numbers grow too large, they switch transparently to GMP numbers. – Groxan Sep 7 at 13:35
  • This should be part of the answer, in my opinion: that they are not upper bounded, although they (probably) are upwards bounded in the foreseeable future. – Thorkil Værge Sep 8 at 4:58

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.