Deploying smart contracts on a blockchain

Smart contracts may or may not be deployed on a blockchain, but it makes sense to deploy them on a blockchain due to the distributed and decentralized consensus mechanism provided by blockchain. Ethereum is an example of a blockchain platform that natively supports the development and deployment of smart contracts. Smart contracts on Ethereum blockchain are usually part of a broader application such as Decentralized Autonomous organization (DAOs).

As a comparison, in Bitcoin blockchain, the transaction timelocks such as the nLocktime field and CHECKLOCKTIMEVERIFY (CLTV), CHECKSEQUENCEVERIFY script operator in the Bitcoin transaction can be seen as an enabler of a simple version of a smart contract. These timelocks enable a transaction to be locked until a specified time or until a number of blocks, thus enforcing a basic contract that a certain transaction can only be unlocked if certain conditions (elapsed time or number of blocks) are met. For example, you can implement conditions such as "Pay party X, N amount of bitcoins after 3 months". However, this is very limited and should be only viewed as an example of a basic smart contract. In addition to the example mentioned above, Bitcoin scripting language, though limited, can be used to construct basic smart contracts. One example, of a basic smart contract, is to fund a Bitcoin address that can be spent by anyone who demonstrates a "hash collision attack". This was a contest that was announced on the Bitcointalk forum where bitcoins were set as a reward for whoever manages to find hash collisions (we discussed this concept in Chapter 6, Public Key Cryptography) for hash functions. This conditional unlocking of Bitcoin only on the demonstration of a successful attack is a basic type of smart contract.

This idea was presented on the Bitcointalk forum, and more information can be found at https://bitcointalk.org/index.php?topic=293382.0. This can also be considered a basic form of smart contract.

Various other blockchain platforms support smart contracts such as Monax, Lisk, Counterparty, Stellar, Hyperledger fabric, corda, and Axoni core. Smart contracts can be developed in various languages. The critical requirement, however, is determinism, which is very important because it is vital that regardless of where the smart contract code executes, it produces the same result every time and everywhere. This requirement of deterministic nature of smart contracts also implies that smart contract code is absolutely bug-free. Validation and verification of smart contracts is an active area of research and detailed discussion of this topic will be presented in Chapter 16, Scalability and Other Challenges. Various languages have been developed to build smart contracts such as Solidity, which runs on Ethereum Virtual Machine (EVM). It's worth noting that there are platforms which already support mainstream languages for smart contract development, such as Lisk which supports JavaScript. However, another prominent example is Hyperledger fabric which supports Golang, Java, and JavaScript for smart contract development.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset