Diese Präsentation wurde erfolgreich gemeldet.
Die SlideShare-Präsentation wird heruntergeladen. ×

Introduction to Solidity and Smart Contract Development (9).pptx

Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Wird geladen in …3
×

Hier ansehen

1 von 26 Anzeige

Introduction to Solidity and Smart Contract Development (9).pptx

Herunterladen, um offline zu lesen

Blockchain is a revolutionary technology that is changing the way we handle digital transactions. It is a technology that can be applied in many different fields, from logistics and supply chain management to real estate and voting systems.

In order to help our clients to plan and execute digital transformation, we need to understand foundational elements, including smart contracts and languages that are popular in developing smart contracts.

In this presentation, we share an overview of what a smart contract is and how it functions, look into the real-world examples of smart contracts, and tools that are used to develop smart contracts. We look into Solidity, a powerful programming language that enables developers to create complex and sophisticated smart contract applications on Ethereum-compatible blockchains.

There is no expectation of prior knowledge of blockchain technology or smart contracts development and we are expecting to have a lively and engaging session.

Blockchain is a revolutionary technology that is changing the way we handle digital transactions. It is a technology that can be applied in many different fields, from logistics and supply chain management to real estate and voting systems.

In order to help our clients to plan and execute digital transformation, we need to understand foundational elements, including smart contracts and languages that are popular in developing smart contracts.

In this presentation, we share an overview of what a smart contract is and how it functions, look into the real-world examples of smart contracts, and tools that are used to develop smart contracts. We look into Solidity, a powerful programming language that enables developers to create complex and sophisticated smart contract applications on Ethereum-compatible blockchains.

There is no expectation of prior knowledge of blockchain technology or smart contracts development and we are expecting to have a lively and engaging session.

Anzeige
Anzeige

Weitere Verwandte Inhalte

Ähnlich wie Introduction to Solidity and Smart Contract Development (9).pptx (20)

Weitere von Gene Leybzon (20)

Anzeige

Aktuellste (20)

Introduction to Solidity and Smart Contract Development (9).pptx

  1. 1. INTRODUCTION TO SOLIDITY AND SMART CONTRACT DEVELOPMENT Gene Leybzon Blockchain Applications and Smart Contracts Meetup 2/2/2023
  2. 2. DISCLAIMER § The views and opinions expressed by the Presenter are those of the Presenter. § Presentation is not intended as legal or financial advice and may not be used as legal or financial advice. § Every effort has been made to assure this information is up-to-date as of the date of publication.
  3. 3. Solidity Language 03 Introduction to Blockchain Meetup Plan 01 02 Smart Contracts Blockchain Tools 04
  4. 4. has property Blockchain Records transactions across a network of computers Decentralized Digital Ledger Ledger is composed of a chain of blocks, where each block contains a number of transactions Chain of Blocks The transactions are grouped together and added to the chain in a linear, chronological order and once added, the information in the block cannot be altered or deleted Records are Immutable Cryptography is used to secure the information stored in the blocks, and enables secure transfer of digital assets and information Cryptographic Security Blockchain “Blockchain is a digital ledger that keeps a record of all transactions across a network of computers.” composed of is is based on
  5. 5. Block N-2 Block N-1 Block N Block N+1 Block N+2 Block N+3 ... Blockchain Blockchain from the technical point of view Block N Block N Header Block N Transactions Hash(Block N-1 header) Hash of (Block N transactions) Hash() Block N-1 Block N Header Block N-1 Transactions Hash(Block N-2 header) Hash of (Block N-1 transactions) Hash() Hash()
  6. 6. Permissionless Types of Blockchains Permissioned Hybrid Public (No central authority ) Hybrid (Central authority + Permission Process) Consortium Private
  7. 7. Blockchain Technology Choices Ethereum is the standard for smart contracts and blockchain based finance applications Ethereum Virtual Machine (EVM) is the runtime environment for transaction execution in Ethereum-like networks EVM-based Custom Blockchain solutions based on open- source code Tendermint- and similar consensus-based solutions. Polkadot and Cosmos parachains. Substrate framework for use case-optimized blockchains Custom Foundation for enterprise- grade blockchain software projects Hyperledger technologies are open source code bases built with collaborative design and governance, enterprises have embraced them as trusted infrastructure for building blockchain utions. Hyperledger
  8. 8. Ether (ETH) Ether is the native cryptocurrency of the Ethereum network. It is used to pay for transactions and smart contract execution, and it is also used as a form of payment for gas. Solidity Solidity is the primary programming language used for writing smart contracts on the Ethereum network. It is a contract-oriented, high-level language for implementing smart contracts. SMART CONTRACTS These are self-executing contracts with the terms of the agreements directly written into lines of code. Smart contracts are used to facilitate, verify, and enforce the negotiation or performance of a contract. Ethereum Virtual Machine (EVM) EVM is the runtime environment for smart contracts in Ethereum. It is a virtual machine that executes the code of smart contracts on the Ethereum network. Ethereum Blockchain “Ethereum is a blockchain with a computer embedded in it. It is the foundation for building apps and organizations in a decentralized, permissionless, censorship- resistant way.”
  9. 9. Ethereum Gas “Ethereum gas is a unit of measurement for the computational effort required to execute transactions on the Ethereum blockchain.” Gas prices in Ethereum are dynamic and determined by market demand. When the demand for gas is high, the gas price increases, and when demand is low, the gas price decreases. Gas is required for every transaction and smart contract execution on the Ethereum network, and is used to pay for the computational resources consumed by the nodes that validate and execute the transactions. The amount of gas required for a transaction or smart contract execution is dependent on the complexity of the operation ADD .... 3 MUL .... 5 SUB .... 3 DIV .... 5 MOD .... 5 ADDMOD . 8 MULMOD . 8
  10. 10. EVM Compatible Blockchains Some of the blockchain networks that use the EVM and are able to interact with the Ethereum ecosystem through smart contracts
  11. 11. Traditional Architecture Decentralized l Architecture Decentralized Application and Smart Contracts Web Server Database Decentralized Application Blockchain Smart Contract
  12. 12. Benefits of Decentralized Applications 1 Once data is recorded on a blockchain, it cannot be altered, which provides a high level of trust and security. Immutability 2 Decentralized blockchains do not rely on a central authority, which reduces the risk of censorship or control. Decentralization 3 Blockchain technology allows for a high degree of transparency, as all transactions are recorded on a public ledger that is accessible to anyone. Transparency 4 Blockchain technology allows for the creation of smart contracts which can automate the execution of agreements without the need for intermediaries. Uses Smart Contracts
  13. 13. Exemplary Blockchain Development Tools Wallet and key management Code Development SDKs and APIs Explorer and Analytics Security Interoperability and cross- chain Decentralized App Development
  14. 14. Smart Contract Development and Deployment 1 Design Design the contract, including defining its structure, state variables, functions, and events Code Writing Implementing the functions, events, and conditions defined in the design step 2 Compilation Solidity code compiled into bytecode that can be deployed on the blockchain. 3 Deployment Compiled code get deployed on the blockchain and make it available to the network 4 Testing Performing various tests on the contract, including unit tests integration tests, security tests 5 Maintenance Monitoring performance and detecting abnormal usage 6
  15. 15. Solidity Language Solidity is a high-level, contract-oriented programming language that is used for writing smart contracts on the Ethereum -compatible blockchain ● Solidity developed specifically for the Ethereum platform and is influenced by C++, Python, and JavaScript. ● Solidity is designed to provide a simple and secure way to create self-executing contracts that enforce the rules and conditions of an agreement between parties ● Solidity contracts are executed on the Ethereum Virtual Machine, which is built into the Ethereum blockchain and allow developers to create decentralized applications and automate the transfer of digital assets based on the conditions encoded in the contract. ● Supports features such as multiple inheritance, user-defined types, events, modifiers which makes it possible to write complex, feature-rich smart contracts
  16. 16. Examples of Smart Contracts A smart contract is a computer program that automatically executes the terms of a contract when certain conditions are met. // SPDX-License-Identifier: GPL-3.0 pragma solidity >=0.7.0 <0.9.0; contract Hello { function sayHello() public pure returns (string memory) { return 'Hello World!'; } } pragma solidity >=0.7.0 <0.9.0; contract Count { uint public value = 0; event Changed( uint _value ); function plus() public returns (uint) { value++; emit Changed(value); return value; } } https://github.com/leybzon/solidity-baby-steps/blob/master/contracts/00_hello.sol https://github.com/leybzon/solidity-baby-steps/blob/master/contracts/03_count.sol
  17. 17. Solidity Compiler pragma solidity >=0.7.0 <0.9.0; contract Count { uint public value = 0; event Changed( uint _value ); function plus() public returns (uint) { value++; emit Changed(value); return value; } Solidity Compiler [ { "anonymous": false, "inputs": [ { "indexed": false, "internalType": "uint256", "name": "_value", "type": "uint256" } ], "name": "Changed", "type": "event" }, { "inputs": [], "name": "plus", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "value", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" } ] Source Code ABI 60806040526000805534801561001457600080fd5b506101b8806100246000396000f3fe60806040 5234801561001057600080fd5b50600436106100365760003560e01c806318b0c3fd1461003b5780 633fa4f24514610059575b600080fd5b610043610077565b60405161005091906100f0565b604051 80910390f35b6100616100d1565b60405161006e91906100f0565b60405180910390f35b60008060 0081548092919061008b9061013a565b91905055507f938d2ee5be9cfb0f7270ee2eff90507e94b3 7625d9d2b3a61c97d30a4560b8296000546040516100c191906100f0565b60405180910390a16000 54905090565b60005481565b6000819050919050565b6100ea816100d7565b82525050565b600060 208201905061010560008301846100e1565b92915050565b7f4e487b710000000000000000000000 0000000000000000000000000000000000600052601160045260246000fd5b6000610145826100d7 565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361 01775761017661010b565b5b60018201905091905056fea26469706673582212207c2c3d1a4e7374 4455de5b07325e41a92072f087363cc013c4499cb7d84eac6164736f6c63430008110033 Bytecode
  18. 18. Blockchain Explorer Allows users to search and view detailed information about blocks, transactions, and addresses on the Ethereum network Users can verify and call smart contracts on the Ethereum network Tracks the movement and distribution of Ethereum-based tokens Provides real-time network statistics and charts on various metrics such as hash rate, gas usage, and active addresses Offers various analytics tools for Ethereum network data analysis, such as rich list, token holders, and top contracts
  19. 19. Demonstration of Remix Development Environment
  20. 20. Thank You
  21. 21. Backup Slides
  22. 22. https://www.eventbrite.com/e/developerweek-2022-registration- 164532975559?discount=MU7872&utm_campaign=MU7872&utm_source=meetup
  23. 23. ChatGPT3
  24. 24. ChatGPT3 generated Solidity Code pragma solidity ^0.8.0; contract MeetupGold { string public name = "Meetup Gold"; string public symbol = “MG"; uint256 public totalSupply = 1000000000000000000000; uint256 public decimals = 18; mapping(address => uint256) public balanceOf; event Transfer(address indexed from, address indexed to, uint256 value); constructor() public { balanceOf[msg.sender] = totalSupply; } function transfer(address _to, uint256 _value) public returns (bool) { require(balanceOf[msg.sender] >= _value && _value > 0, "Insufficient balance"); balanceOf[msg.sender] -= _value; balanceOf[_to] += _value; emit Transfer(msg.sender, _to, _value); return true; } }
  25. 25. Blockchain Research Areas 1. Decentralized finance (DeFi): The development of decentralized financial applications on blockchain platforms such as Ethereum. 2. Scalability: Improving the speed, capacity, and efficiency of blockchain networks to handle increasing numbers of users and transactions. 3. Privacy and Confidentiality: Research into ways to enhance the privacy and confidentiality of data stored on blockchains. 4. Interoperability: Developing solutions that allow different blockchain networks to communicate and interact with each other. 5. Regulation: Studying the impact of regulatory frameworks on the adoption and development of blockchain technology. 6. Blockchain for Supply Chain Management: The integration of blockchain technology into supply chain management systems to improve transparency and efficiency. 7. Energy Efficiency: Research into ways to make blockchain more energy-efficient, particularly for proof- of-work consensus algorithms. 8. Identity Management: The use of blockchain technology for secure and efficient identity management. 9. Security: Further research into the security of blockchain networks, including the prevention of hacking attacks and the protection of user data.
  26. 26. Blockchain and Smart Contracts Learning Path 1. Fundamentals of Blockchain Technology: Start by learning the basics of blockchain technology, including how it works, its key components, and the different types of blockchain networks. Study the history of blockchain, its potential applications, and its current status. 2. Cryptography: Study the basics of cryptography, including symmetric and asymmetric encryption, hashes, and digital signatures. Understanding cryptography is crucial for building secure blockchain systems. 3. Solidity and Smart Contracts: Study Solidity, the programming language used for writing smart contracts on the Ethereum platform. Learn how to write, deploy, and execute smart contracts. 4. Decentralized Applications (dApps): Study the design and development of decentralized applications (dApps) on blockchain platforms. Learn about the key components of dApps, such as smart contracts, consensus algorithms, and storage solutions. 5. Blockchain Development Platforms: Study popular blockchain development platforms, such as Ethereum, EOS, and Hyperledger. Learn how to use these platforms to build decentralized applications. 6. Web3.js: Study the Web3.js library, which is used to interact with blockchain networks from web applications. Learn how to send transactions, retrieve data, and interact with smart contracts using Web3.js. 7. Cryptocurrency: Study cryptocurrency and the different types of tokens that exist, including utility tokens, security tokens, and stablecoins. Learn how cryptocurrencies can be used in decentralized applications. 8. Blockchain Security: Study the security aspects of blockchain technology, including the prevention of hacking attacks, the protection of user data, and the mitigation of security risks. 9. Project Work: Work on building a decentralized application using blockchain technology. This could be a simple smart contract or a more complex dApp. 10. Stay up-to-date with the latest developments: Keep up-to-date with the latest developments in blockchain technology by attending meetups, workshops, and conferences, and by following key players in the industry.

×