Why programming smart contracts in Javascript is a bad idea?

Hi everyone. My name is Francisco León and I’m glad for participating in this community.

I’ve seen an increasing interest from the dev community on new blockchain platforms that allow programming smart-contracts by using popular programming languages that most developers known well and have been learned comfortably. The most common complain about Ethereum and Solidity is that they fill it hard to understand and need to invest some time and effort in learning a complete new language with their particular concepts.

The reason of why Ethereum is the platform of choice for smartcontracts, it’s because it enforces deterministic behavior of programs by employing an specialized programming language that was conceived for secure execution of these contracts by ensuring the consistency of the operations.
By contrast, platforms like LISK or NEO lack of the functionality for ensuring the correctness of the execution for programs. Languages like javascript allows running untrusted code and performs ambiguous numeric conversions. The same can be attributed to high-level structured languages like Java or C# .NET, due to their expressiveness and complex functionality that are also prone to allow programmers to commit big mistakes if they’re careless and cannot assert the strict behavior of their programs at runtime, instead these high-level languages were more focused on productivity and efficient computation for high-performance applications, while they’re good enough for general purpose applications they aren’t well suited for business trustless programs whose behavior need to be replied in every node at the network.

Disadvantages of LISK:

  • Lisk “sandbox” cannot be used to run untrusted code
  • Lisk framework provides no protections against non-deterministic behavior
  • Lisk doesn’t have the ability to prevent infinite loops and/or measure total computation
  • Lisk doens’t have the ability to prevent unbounded memory growth and/or measure memory consumption
    Common JavaScript language features (such as iterating over keys in an object) results is hidden non-deterministic behavior

Here is and interesting discussion about the issues of using a general-purpose language for programming smart contracts.
https://ethereum.stackexchange.com/questions/2104/how-does-lisk-differ-from-ethereum

1 Like