Wednesday, July 8, 2020

Ethereum Tutorial For Beginners - Ethereum Architecture

Ethereum Tutorial For Beginners - Ethereum Architecture Ethereum Tutorial A Deeper Look Into Ethereum! Back Home Categories Online Courses Mock Interviews Webinars NEW Community Write for Us Categories Artificial Intelligence AI vs Machine Learning vs Deep LearningMachine Learning AlgorithmsArtificial Intelligence TutorialWhat is Deep LearningDeep Learning TutorialInstall TensorFlowDeep Learning with PythonBackpropagationTensorFlow TutorialConvolutional Neural Network TutorialVIEW ALL BI and Visualization What is TableauTableau TutorialTableau Interview QuestionsWhat is InformaticaInformatica Interview QuestionsPower BI TutorialPower BI Interview QuestionsOLTP vs OLAPQlikView TutorialAdvanced Excel Formulas TutorialVIEW ALL Big Data What is HadoopHadoop ArchitectureHadoop TutorialHadoop Interview QuestionsHadoop EcosystemData Science vs Big Data vs Data AnalyticsWhat is Big DataMapReduce TutorialPig TutorialSpark TutorialSpark Interview QuestionsBig Data TutorialHive TutorialVIEW ALL Blockchain Blockchain TutorialWhat is BlockchainHyperledger FabricWhat Is EthereumEthereum TutorialB lockchain ApplicationsSolidity TutorialBlockchain ProgrammingHow Blockchain WorksVIEW ALL Cloud Computing What is AWSAWS TutorialAWS CertificationAzure Interview QuestionsAzure TutorialWhat Is Cloud ComputingWhat Is SalesforceIoT TutorialSalesforce TutorialSalesforce Interview QuestionsVIEW ALL Cyber Security Cloud SecurityWhat is CryptographyNmap TutorialSQL Injection AttacksHow To Install Kali LinuxHow to become an Ethical Hacker?Footprinting in Ethical HackingNetwork Scanning for Ethical HackingARP SpoofingApplication SecurityVIEW ALL Data Science Python Pandas TutorialWhat is Machine LearningMachine Learning TutorialMachine Learning ProjectsMachine Learning Interview QuestionsWhat Is Data ScienceSAS TutorialR TutorialData Science ProjectsHow to become a data scientistData Science Interview QuestionsData Scientist SalaryVIEW ALL Data Warehousing and ETL What is Data WarehouseDimension Table in Data WarehousingData Warehousing Interview QuestionsData warehouse architectureTalend T utorialTalend ETL ToolTalend Interview QuestionsFact Table and its TypesInformatica TransformationsInformatica TutorialVIEW ALL Databases What is MySQLMySQL Data TypesSQL JoinsSQL Data TypesWhat is MongoDBMongoDB Interview QuestionsMySQL TutorialSQL Interview QuestionsSQL CommandsMySQL Interview QuestionsVIEW ALL DevOps What is DevOpsDevOps vs AgileDevOps ToolsDevOps TutorialHow To Become A DevOps EngineerDevOps Interview QuestionsWhat Is DockerDocker TutorialDocker Interview QuestionsWhat Is ChefWhat Is KubernetesKubernetes TutorialVIEW ALL Front End Web Development What is JavaScript â€" All You Need To Know About JavaScriptJavaScript TutorialJavaScript Interview QuestionsJavaScript FrameworksAngular TutorialAngular Interview QuestionsWhat is REST API?React TutorialReact vs AngularjQuery TutorialNode TutorialReact Interview QuestionsVIEW ALL Mobile Development Android TutorialAndroid Interview QuestionsAndroid ArchitectureAndroid SQLite DatabaseProgramming A De... Ethereum Develo pment Certification (10 Blogs) Become a Certified Professional AWS Global Infrastructure Blockchain Introduction What is Blockchain? Step-by-Step Guide for BeginnersBlockchain Technology â€" Everything you need to know about Blockchain and BitcoinDifferent Types Of Blockchain And Why We Need ThemBlockchain Tutorial - A Beginner's Guide to Blockchain TechnologyBlockchain Applications That Are Changing The WorldBlockchain Security: Is Blockchain Really Secure?Everything You Need to Know about Blockchain ArchitectureBlockchain Mining- All You Need To Know Blockchain Basics What is Blockchain Technology? How Blockchain WorksBlockchain Technology â€" Everything you need to know about Blockchain and BitcoinBitcoin Blockchain Explained : Understanding Bitcoin and BlockchainAll You Need to Know about Blockchain Programming Ethereum What Is Ethereum? A Platform To Decentralize The WorldEthereum Tutorial â€" A Deeper Look Into Ethereum!Ethereum Upgrades: All you need to know about Et hereum's IstanbulBest Ethereum Development Tools To Create DappsBlockchain 2.0: Ethereum DApps and Job TrendsTruffle Ethereum Tutorial â€" Developing Ethereum DApps with TruffleEthereum Private Network â€" Create your own Ethereum Blockchain!Solidity Tutorial â€" Solidity Programming For Beginners Smart Contracts What are Smart Contracts? A Beginner's Guide To Smart ContractsSetting Up A Smart Contract Development EnvironmentHow to write your first Smart Contract?Ethereum Smart Contract â€" How to execute a Smart Contract? Hyperledger What is Hyperledger â€" An Industrial Approach to BlockchainHyperledger Fabric â€" A Platform For Business SolutionsHyperledger vs Ethereum â€" Which Blockchain Platform Will Benefit Your Business? Career Opportunities Top 10 Reasons Why You Should Learn BlockchainHow to learn Blockchain? Advantages, Learning path and FutureHow to Become a Blockchain Developer? â€" Types, Roles and SkillsBlockchain Beyond Bitcoin â€" Blockchain Platforms and Tren dsTop 5 Cryptocurrencies To Look Out For In 2019 Interview Questions Top 55 Blockchain Interview Questions You Must Prepare In 2020Blockchain Topics CoveredBlockchain (18 Blogs)Ethereum Development Certification (10 Blogs)SEE MORE Ethereum Tutorial A Deeper Look Into Ethereum! Last updated on May 22,2019 11.4K Views Paul Research Analyst at edureka with a proficiency in Ethereum, Cybersecurity and Cryptography! Research Analyst at edureka with a proficiency in Ethereum, Cybersecurity and Cryptography! Bookmark 2 / 8 Blog from Ethereum Become a Certified Professional Ethereum Tutorial:In this Ethereum Tutorial blog, I will explain the inner working of ethereums architecture and I will also show you the implementation of ethereum through a simple smart contract.I see Ethereum as a programmable blockchain that will serve a majorityof B2C enterprise in the future. Ethereum grants developers the freedom of creating complex models to be executed on the blockchain, instead of res tricting them to predefined operations like the Bitcoin blockchain.With this approach, Ethereum has turned itself into a platform for a plethora of decentralized applications and organizations which includes, but isnt limited to crypto-currencies.Ill be covering a variety of topics in an exhaustive manner through the run of this Ethereum Tutorial blog. These topics include:Ethereum AccountsEthereum Virtual MachineThe Ethereum NetworkEther GasEthereum MiningYou may go through this recording of Ethereum Tutorial where our instructors have explained the topics in a detailed manner with real-world problems and projectsthat will help you to understand this concept better.Ethereum Tutorial | Ethereum Smart Contracts | EdurekaEthereum Tutorial: Ethereum AccountsThe Ethereum network has two types of accounts, namely:External AccountsContract AccountsThese accounts, both External and Contract are referred to as state objects and comprise the state of the ethereum network. Every state object has a well-defined state. For external accounts, the state comprises of the account balance while for contract accounts the state is defined by the memory storage and balance.Ill be referring to external accounts simply as accounts. These accounts are owned by are represented by external agents of the network which include every ordinary user, miners, automated agents, etc.These accounts are generally controlled with the help of public key cryptography algorithms like RSA. The main purpose of External accounts is to serve as a medium for users to interact with the Ethereum Blockchain.Contract accounts, on the other hand, are a collection of code that resides on the blockchain at a specific address. These contracts are invoked by external accounts, or by other contracts through a specific call-to-action function. These contracts are written in high-level scripting languages like Solidity, Serpent or LLL. Every contract that resideson the ethereum blockchain is stored in a specific f ormat called EVM (Ethereum Virtual Machine) bytecode which is an ethereum specific binary format. It will only be fair that I explain EVM now that Ive told you about EVM-bytecode.Ethereum Tutorial: EthereumVirtual MachineEthereum, in a rustic way, defines a set of generalized protocols which have become the pillars of the development of decentralized applications. At the heart of this, lies the Ethereum Virtual Machine. The figure below explains the architecture:It is important to note that, the Ethereum Virtual Machine is not only completely sandboxed, but also completely isolated. This means that code that is currently running on the EVM has no access to the network or the file-system and can sparingly access other contracts. Now that we understand the core of the platform, lets take a deeper look at the network nodes.Ethereum Tutorial: The Ethereum NetworkThe ethereum network is a public blockchain network. It forms the basis of all decentralized peer-to-peer applications and o rganizations run on the network. The network is comprised of two types of nodes namely, full nodes and light-weight-nodes.Full nodes contain the entire history of transactions since the genesis block. They are a full-fledged proof of the integrity of the blockchain network. Full nodes have to contain each and every transaction that has been verified according to the rules set up by Ethereums specifications.Light-weight nodes on the other hand only contain a subset of the entire blockchain. These types of nodes are mostly used in e-wallets which have to be light-weight in nature and hence the entire blockchain cannot be stored on them. These nodes, in contrast, do not verify every block or transaction and may not have a copy of the current blockchain state. They rely on full nodes to provide them with missing details (or simply lack particular functionality). The advantage of light nodes is that they can get up and running much more quickly, can run on more computationally/memory con strained devices, and dont eat up nearly as much storage. Every public blockchain has a currency attached to it. Ethereum is no different. Lets take a deeper look into Ethereums cryptocurrency.Ethereum Tutorial: Ether and GasEtheris the name of the crypto-currency used to pay for transactions on the ethereum network. Asides from paying for general transactions and services, Ether is also used to buy Gas, which in turn is used to pay for computation within the EVM.Ether is the metric unit and has a lot of denominations which help accurately pay for transactions and gas. The smallest denomination a.k.a base unit is called Wei. The denominations along with their specific names can be seen in the table below:UnitsWei ValueWeiwei1 wei1Kwei1e3 wei1,000Mwei1e6 wei1,000,000Gwei1e9 wei1,000,000,000microEther1e12 wei1,000,000,000,000milliEther1e15 wei1,000,000,000,000,000Ether1e18 wei1,000,000,000,000,000,000As discussed earlier, we know that EVM is responsible for running code that is deplo yed on its network. So whats stopping someone from running an infinite loop on the EVM and completely overloading its memory? This is where the concept of Gas comes in.Gas is used as a metric for paying for computational resources on the network. Every contract on the network has a set maximum amount of gas that it can use for its computations. This is known as the Gas Limit Other associated gas terms are as follows:Gas Price: This is the cost of gas in terms of tokens like Ether and its other denominations.To stabilize the value of gas, the Gas Price is a floating value such that if the cost of tokens or currency fluctuates, the Gas Price changes to keep the same real value.Gas Fee: This is effectively the amount of Gas needed to be paid to run a particular transaction or program (called a contract).Hence, if someone tries to run a piece of code that runs forever, the contract will eventually exceed its gas limit and the entire transaction that invoked the contract will be rolled b ack to its previous state. Now that we know about the currency, lets take a look at the process that generates new currency.Ethereum Tutorial: MiningEthereum, much like other public blockchain technologies ensures security through an incentive-based model. This is called a proof-of-work mechanism. The figure below shows how ethereum mining works:From a more technical perspective, the proof-of-work algorithm used is called Ethash, which is a hashing algorithm inspired by the Dagger-Hashimoto Algorithm.Now that weve seen the working architecture of ethereum and discussed its essential elements, lets see a real-world problem and the ethereum approach to solve the same.Ethereum Tutorial: Decentralized Crowd Funding Use CaseProblem Statement: A good idea isnt everything in todays world to start a successful business. A lot of funding and effort is needed to implement an idea. This is where organizations like Kickstarter come into the picture. They provide projects with the public exposur e needed for donations towards their project to get it up an running, but the centralized architecture of such a motive has its downsides, mainly in the way the rewards are handled. Since the centralized authority makes all the decisions, systems are prone to rules like:anyone who missed the deadline for the campaign cannot get in any moreany donor who changed their mind cant get outApproach:We take a decentralized methodology to address the problem as explained in the picture below:Solution:Here is the solidity smart contract for the above problem statement. pragma solidity ^0.4.16; interface token { function transfer(address receiver, uint amount); } contract Crowdsale { address public beneficiary; uint public fundingGoal; uint public amountRaised; uint public deadline; uint public price; token public tokenReward; mapping(address = uint256) public balanceOf; bool fundingGoalReached = false; bool crowdsaleClosed = false; event GoalReached(address recipient, uint totalAmountRaised); event FundTransfer(address backer, uint amount, bool isContribution); /** * Constrctor function * * Setup the owner */ function Crowdsale( address ifSuccessfulSendTo; // the address of the owner when funding is successful uint fundingGoalInEthers; // target amount to raise uint durationInMinutes; //given time uint etherCostOfEachToken; //cost of equity in ether address addressOfTokenUsedAsReward; //token address ) { beneficiary = ifSuccessfulSendTo; fundingGoal = fundingGoalInEthers * 1 ether; deadline = now + durationInMinutes * 1 minutes; price = etherCostOfEachToken * 1 ether; tokenReward = token(addressOfTokenUsedAsReward); } /** * Fallback function * * The function without name is the default function that is called whenever anyone sends funds to a contract */ function () payable { require(!crowdsaleClosed); uint amount = msg.value; balanceOf[msg.sender] += amount; amountRaised += amount; tokenReward.transfer(msg.sender, amount / price); FundTransfer(msg.sender, amount, true); } modifier afterDeadline() { if (now = deadline) _; } /** * Check if goal was reached * * Checks if the goal or time limit has been reached and ends the campaign */ function checkGoalReached() afterDeadline { if (amountRaised = fundingGoal){ fundingGoalReached = true; GoalReached(beneficiary, amountRaised); } crowdsaleClosed = true; } /** * Withdraw the funds * * Checks to see if goal or time limit has been reached, and if so, and the funding goal was reached, * sends the entire amount to the beneficiary. If goal was not reached, each contributor can withdraw * the amount they contributed. */ function safeWithdrawal() afterDeadline { if (!fundingGoalReached) { uint amount = balanceOf[msg.sender]; balanceOf[msg.sender] = 0; if (amount 0) { if (msg.sender.send(amount)) { FundTransfer(msg.sender, amount, false); } else { balanceOf[msg.sender] = amount; } } } if (fundingGoalReached beneficiary == msg.sender) { if (beneficiary.send(amountRaised)) { FundTransfer(beneficiary, amountRaised, false); } else { //If we fail to send the funds to beneficiary, unlock funders balance fundingGoalReached = false; } } } }In case you are interested in learning solidity, check out our blog on Solidity Programming, which is used for developing personalized smart-contracts.If you wish to learn Blockchain and build a career in Blockchain Technologies, then check out ourBlockchainCertificationTrainingwhichcomes with instructor-led live training and real-life project experience.This training will help you understand Blockchain in depth and help you achieve mastery over the subject.Got a question for us? Please mention it in the comments section and we will get back to you as soon as possible.Recommended blogs for you Different Types Of Blockchain And Why We Need Them Read Article Truffle Ethereum Tutorial Developing Ethereum DApps with Truffle Read Article Hyperledger vs Ethereum Which Blockchain Platform Will Benefit Your Business? Read Article Blockchain 2.0: Ethereum DApps and Job Trends Read Article Everything You Need to Know about Blockchain Architecture Read Article Ethereum Upgrades: All you need to know about Ethereums Istanbul Read Article Best Ethereum Development Tools To Create Dapps Read Article Ethereum Tutorial A Deeper Look Into Ethereum! Read Article Ethereum Private Network Create your own Ethereum Blockchain! Read Article Hyperledger Fabric A Platform For Business Solutions Read Article Ethereum Smart Contract How to execute a Smart Contract? Read Article Blockchain Through the Years: History and Recent Applications Read Article Blockchain Mining- All You Need To Know Read Article Defining Blockchain Technology Read Article How to Become a Blockchain Developer? Types, Roles and Skills Read Article What is Hyperledger An Industrial Approach to Blockchain Read Article Bitcoin Blockchain Explained : Understanding Bitcoin and Blockchain Read Article How to write your first Smart Contract? Read Article Blockchain Applications That Are Changing The World Read Article What Is Ethereum? A Platform To Decentralize The World Read Article Comments 0 Comments Trendi ng Courses in Blockchain Blockchain and Ethereum Certification Trainin ...17k Enrolled LearnersWeekendLive Class Reviews 5 (6750)

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.