Back to Blog

 

Is that Solidity stuff Turing-complete in any way? What is the location of these "Smart Contracts"? 


We believe we can conclude that today's Smart Contracts are as intelligent as Alan Turing's British Bombe, which exploited the Enigma machine's lack of randomization in 1939. 


Being “Turing-complete” is a term used to describe someone who has completed all of the 
Smart contracts in Ethereum are authored in the Solidity programming language and operate on the Ethereum Virtual Machine (EVM). The EVM can be thought of as a massive Turing-complete, the decentralized virtual machine that is deployed overall Ethereum nodes worldwide (now around 8500 if I'm not mistaken). 


Some blockchains, such as Ethereum or Hyperledger Fabric (public or private blockchains), make use of Turing complete programming languages, which allow developers to write smart contracts that can perform a wide range of operations, from simple to complicated. Turing complete means it can perform any real-world general-purpose function and is computationally universal. 

 

The Ethereum Virtual Computer, for example, is a Turing complete decentralized virtual machine, which means it can simulate any computing logic or function. Smart contracts, which can be created in the Solidity programming language, are used to implement this computing logic in Ethereum (although they can be written in other languages too as we will see below). 
A smart contract is a component of a computer program that allows two parties to carry out a contractual agreement. Smart contracts are capable of carrying out almost any contractual condition or function. They are Turing-complete, which means they use conditional statements and conditional branching in their programming languages. These are programming languages that use the “if, then, else” construct and can mimic any computer logic. 


Returning to Smart Contracts 
Smart contracts are self-executing, which means they don't require third-party involvement to execute and can't be halted once they've been implemented. Smart contracts have the ability to self-enforce the rules that were written/coded into them. For example, a smart contract can be programmed to operate as an escrow and settlement service, receiving cash from Alice and releasing them to Bob once Bob pays asset D to Alize. Code is the law of a smart contract. You may even set up a smart contract to lock $1000 in cryptocurrencies and only unlock it in 2030. You won't be able to amend this contract after it's been launched, and the money will be kept in this vault until 2030.

Anything you program in a smart contract will execute on its own later. 
Smart contracts are stored on a blockchain, such as Ethereum, and run on the Ethereum Virtual Machine (EVM). Smart contracts are present on many other blockchains, including private blockchains. 
A piece of a blockchain-based escrow smart contract is depicted. 

 

The following are some of the characteristics of smart contracts: 
Smart contracts are self-executing contracts. 
The turning-completeness of smart contracts 
Pseudonymous parties continue to exist. 
Smart contracts are completely transparent and auditable. 
Smart contracts can't be changed. 


Note that Turing completeness is a simplification. In actuality, computers and virtual machines are constrained by memory and processing power limitations. Furthermore, the execution of smart contracts on the blockchain necessitates the payment of fees. As a result, smart contracts are constrained and thus not Turing-complete. To operate a simple ERC-20 (fungible tokens) or ERC-721 (NFT) smart contract, it may cost the equivalent of $100 in Gas costs just for a few hundred lines of code, so... yep, to run a truly complex smart contract and prove it to be fully Turing-complete, you'd have to spend a lot of money! Oh, and that's why Defi is investing so heavily in it! 
Languages for smart contracts. Choices, choices...

 
When deciding on a protocol and programming language to use to create a smart contract, we must also evaluate the contract's expressiveness and complexity. There is an efficient frontier, and trade-offs between the expressiveness and complexity of smart contracts must be evaluated. The amount of processing power required to execute it, as well as the costs that one is prepared to pay to have it executed (more functions equals more fees). 

The Efficient Frontier theory, developed by Nobel Laureate Harry Markowitz in 1952, is commonly employed in modern portfolio theory to efficiently design optimal investment portfolios. For a given degree of risk, the efficient frontier displays the maximum projected return. If we apply it to the Turing-completeness of blockchains, I believe that's very cool. 
Distinct blockchains and programming languages offer varying levels of return/complexity, which are correlated with different levels of risk and contract expressiveness. More complicated programming languages may be possible with looser programming languages. Still, they may be more difficult to reason about, because developers make more mistakes and are more prone to bugs, and the blockchain's capacity limits them in terms of computing power, throughput, and fees that can be paid. 
Developers in Ethereum can use the Solidity programming language, as well as Kotlin and C++. DAML, on the other hand, is a more secure technique to program smart contracts. Given that Ethereum is Turing-complete, these smart contracts can acquire various levels of complexity. 


Although it is conceivable, it is not recommended to create excessively complicated smart contracts because the execution of more sophisticated smart contracts consumes more gas (the fee that is paid in Ether to execute smart contracts). The Ethereum nodes (anyone can have an Ethereum node because it is a permissionless network) execute the smart contracts, and these nodes run the EVM Ethereum Virtual Machine. The gas prices paid by the customers compensate the nodes for processing transactions and smart contract operations. 

Each Ethereum smart contract has an address that may be used to interact with it, including interacting with other smart contracts, allowing for more automation. 


For the first time in IT history, smart contracts enable the creation of decentralized applications (dApps) that provide new benefits: 
Enhanced security: public-key cryptography and the blockchain consensus mechanism, which ensures the accurate execution of smart contracts, have increased the security of apps. 


Autonomy: apps are built on top of smart contracts (the app logic), which run on the blockchain in a decentralized manner. Without the need for third-party interference, dApps may function automatically and autonomously. 


Traceable: Because the information (connected to the smart contracts) is maintained in the blockchain, transactions or any occurrences of the dApp may be tracked (note that a dApp may also have off-chain information) 
Stability: Because smart contracts are distributed across many nodes on the blockchain, the dApps will continue to function normally even if some nodes fail. 


Smart contracts can be created and executed on other permissionless blockchains. Smart contract writing is also possible on blockchains such as Cardano, Tron, Lisk, Stellar, Monax, RSK, and Counterparty, which can be a good alternative to Ethereum. Because they were inspired by Ethereum, some of these blockchains use the same programming languages as Ethereum. Don't forget about private/permissioned blockchains, too. Smart contracts are also possible on Hyperledger blockchains, Corda, and other platforms. 


Wow, we've covered a lot of ground! Do you have a sense of wit?

 


You can start building your own Smart Contract with Finage free Cryptocurrency API key.

Build with us today!

Get a Free API key