1. What is a Smart Contract?
According to an opinion smart contract is a special protocol intended to contribute, verify or implement the negotiation or performance of the contract.[1] The key element of smart contracts as well as one of most attractive things is opportunity to perform reliable transactions without intermediaries or any third parties. These transactions are trackable, transparent and irreversible. Smart contracts contain all the information about the contract terms and execute all envisaged actions automatically.[2]
According to another opinion smart contracts are self-executing electronic instructions drafted in computer code.[3] Smart contracts self-execute the stipulations of an agreement when predetermined conditions are triggered.[4] The parties “sign” the smart contract using cryptographic security and deploy it to a distributed ledger, or blockchain.[5]
Considering both information technology and legal aspects of the smart contracts’ nature, the smart contract application issue frequently rises many complex questions currently being unregulated in most of jurisdictions.
2. Legal issues related to Smart Contracts
Previous post mirrored certain of major legal issues related to smart contracts. Nevertheless, it is not possible to cover absolutely all aspects of pros and cons or drawbacks of new technology in general and smart contracts particularly. In this regard it is important to notice that legislative bodies of the countries willing to legally regulate of smart contracts will have to pay attention also to following questions:
Smart contract equality to traditional contract. [6] Legislators will have to identify smart contracts as an act equal to a traditional contract or it will be identified as the tool for enforcement of obligations;[7]
Certifying Authority. States most likely will need to create a regulator dealing with certification keys and monitoring of involved parties into transaction in order to create a reliable mechanism and avoid any fraudulent actions or misconduct of the contracting parties.
Understanding of coded terms. If a contract is partly expressed in code, then the understanding of that code by the parties is relevant. [8] This relevance can be a matter of regulation, such as whether particular parties (such as consumers) can be bound by terms which they do not understand, or it can be a matter of fundamental contract law, such as whether there was sufficient mutual understanding of the terms to form the contract at all;[9]
Evidence of coded terms. Even though the parties can agree to express specific terms of their relationship in computer code, it is important that that expression is admissible in any judicial and arbitral proceedings which arise out of that relationship. [10] An inability to admit this record of the parties’ agreement would impair its legal effectiveness.[11]
3. Smart Contract’s Structure
Each smart contract has a small database and provides methods for changing its data. Since contracts are replicated across all nodes, their databases also are. Data changes occur via transactions.
A smart contract usually has at least the following structure[12]:
- Transaction sender
- Transaction recipient
- The amount of sending currency
- Gas limit per transaction (it’s the maximum amount of units of gas you are willing to spend on a transaction)
- Price per gas unit (the payment received by the network participant for calling a smart contract code)
- Arbitrary data (optional) – If you’re told that you can sendarbitrary data yourself, it means you can send anything you want. [13]
ERC stands for “Ethereum Request for Comments”, while ERCXX are technical standards used for smart contracts on the Ethereum blockchain. Most of the major tokens on the Ethereum blockchain are ERC20-compliant. ERC20 tokens must use ‘gas’ to process transactions. Gas represents the work needed to perform a computation, for example a smart contract. Gas is not a token or a cryptocurrency. Gas is paid out in Ethereum. Transactions with more gas will be prioritized by the blockchain network, and processed more quickly.
4. Gas[14] & Price
Every transaction in Ethereum requires Gas to be mined, and the Gas costs Ethers. So, each Smart contract transaction requires Ethers (which is paid not by the Smart Contract itself but rather by the users)[15]. Gas is an abstract number that represents the relative complexity of operations. While gas is fixed per operation, the amount a user pays per gas — gas price — is dynamic and dictated by market conditions. Gas price is a value representing how much Ether the user is willing to pay per gas. When a user sends a transaction, they specify the gas price, and the total fee that they pay is equal to formula: gas_price multiply to gas_used. Miners are paid out this fee and so they prioritize transactions with a higher gas price. The higher gas price you are willing to pay, the faster your transaction will be processed.
5. Stages of Smart Contracts creation
To create a Smart contract, you need to go through several stages as follows[16]:
Creation – To write smart contracts there are a few different languages: Solidity, which is like JavaScript and has .sol as a file extension, Serpent, Python-like with extension .se, and a 3rd, LLL, based on Lisp. Serpent was popular a while back but Solidity is the most popular right now and more robust, so just use Solidity. [17]
Compiling – After writing a contract in Solidity, use Solc to compile it. It’s from the C++ libraries (different implementations complementing each other again) which can be installed here.
Deployment – Once a Solidity contract is compiled with Solc and sent to the network, you can call it using the Ethereum web3.js JavaScript API and build web apps that interact with contracts.
Testing – The tests needs to cover the features of your code and assert that everything is working as predicted. As we are writing smart contracts that can deal with money, writing tests is a really important task for us. This includes: a) code review; b) testing audits; c) correctness proofs.
6. Language for writing Ethereum Smart-Contract: Solidity
A contract in the sense of Solidity is a collection of code (its functions) and data (its state) that resides at a specific address on the Ethereum blockchain. Solidity is a contract-oriented, high-level language that is designed to target the Ethereum Virtual Machine (EVM – The Ethereum Virtual Machine or EVM is the runtime environment for smart contracts in Ethereum). The code is statically typed, supports inheritance, libraries and complex user-defined types among other features[18].
7. Deploying smart contract in Ethereum blockchain
Once you have written a contract, you need to test it by actually deploying it and testing if they are functioning as expected. This is where testnets come to the rescue. Testnets simulate the Ethereum network and EVM. They enable developers to upload and interact with smart contracts without paying the cost of gas.
References*:
[1] https://cointelegraph.com/explained/smart-contracts-explained
[2] https://cointelegraph.com/explained/smart-contracts-explained
[3] SAMUEL BOURQUE & SARA FUNG LING TSUI, A LAWYER’S INTRODUCTION TO SMART CONTRACTS 4 (2014).
[4] Reggie O’Shields,Smart Contracts: Legal Agreements for the Blockchain, 21N.C. Banking Inst.177 (2017). Available at:http://scholarship.law.unc.edu/ncbi/vol21/iss1/11
[5] INST. OF INT’L FIN., GETTING SMART: CONTRACTS ON THE BLOCKCHAIN 2 (2016).
[6] https://medium.com/smartz-blog/smart-contracts-key-legal-issues-a2af15f50c2a
[7] https://medium.com/smartz-blog/smart-contracts-key-legal-issues-a2af15f50c2a
[8] https://medium.com/smartz-blog/smart-contracts-key-legal-issues-a2af15f50c2a
[9] https://medium.com/smartz-blog/smart-contracts-key-legal-issues-a2af15f50c2a
[10] https://medium.com/smartz-blog/smart-contracts-key-legal-issues-a2af15f50c2a
[11] https://medium.com/smartz-blog/smart-contracts-key-legal-issues-a2af15f50c2a
[12] https://medium.com/@smartum.pro/ethereum-smart-contracts-insight-into-smart-contract-development-9627f3cc8111
[13] https://medium.com/@smartum.pro/ethereum-smart-contracts-insight-into-smart-contract-development-9627f3cc8111
[14] https://hackernoon.com/ether-purchase-power-df40a38c5a2f
[15] https://x-team.com/become-blockchain-developer/smart-contracts/
[16] https://medium.com/@ConsenSys/a-101-noob-intro-to-programming-smart-contracts-on-ethereum-695d15c1dab4
[17] https://medium.com/@ConsenSys/a-101-noob-intro-to-programming-smart-contracts-on-ethereum-695d15c1dab4
[18] https://codeburst.io/build-your-first-ethereum-smart-contract-with-solidity-tutorial-94171d6b1c4b