Similar to a transfer of value on a blockchain, deployment of a smart contract on a blockchain occurs by sending a transaction from a
wallet for the blockchain. The transaction includes the compiled code for the smart contract as well as a special receiver address. Smart contracts on a blockchain can store arbitrary state and execute arbitrary computations. End clients interact with a smart contract through transactions. Such transactions with a smart contract can invoke other smart contracts. These transactions might result in changing the state and sending coins from one smart contract to another or from one account to another. On Ethereum,
smart contracts are typically written in a
Turing-complete programming language called
Solidity, and compiled into low-level
bytecode to be executed by the
Ethereum Virtual Machine. Due to the
halting problem and other security problems, Turing-completeness is considered to be a risk and is deliberately avoided by languages like
Vyper. Some of the other smart contract programming languages missing Turing-completeness are Simplicity, Scilla, Ivy and Bitcoin Script. However, measurements in 2020 using
regular expressions showed that only 35.3% of 53,757 Ethereum smart contracts at that time included recursions and loops — constructs connected to the halting problem. Several languages are designed to enable
formal verification: Bamboo, IELE, Simplicity, Michelson (can be verified with
Rocq), Nevertheless, real world application of smart contracts, such as
lotteries and
casinos, require secure randomness. In fact, blockchain technology reduces the costs for conducting of a lottery and is therefore beneficial for the participants. Randomness on blockchain can be implemented by using block hashes or timestamps, oracles, commitment schemes, special smart contracts like RANDAO and Quanta, as well as sequences from
mixed strategy Nash equilibria. ==Applications==