A Note on Determinism

The logic for blockchain transaction processing must be deterministic. If the application logic was not made to be deterministic a consensus would not be reached among the Tendermint Core replica nodes.

Solidity on Ethereum is a great language of choice for blockchain applications because, among other reasons, it is a completely deterministic programming language. However, it is also possible to create deterministic applications using existing popular languages like Java, C++, Python, or Go. Game programmers and blockchain developers are already familiar with creating deterministic programs by avoiding sources of non-determinism such as:

  • random number generators (without deterministic seeding)

  • race conditions on threads (or avoiding threads altogether)

  • system clocks

  • uninitialised memory (in unsafe programming languages like C or C++)

  • floating point arithmetic

  • language features that are random (e.g. map iterations in Go)

While programmers can avoid non-determinism by being careful it is also possible to create a special linter or static analyser for each language to check for determinism. In future, we may work with partners to create such tools.

Last updated