Developing the Hello World example with solidity language via Ethereum wallet

Source: Internet
Author: User
Use * * Ethereum wallet DEVELOPMENT * * To achieve the classic Helloword smart contract class. In this article, we'll see how to write a simple contract and deploy it to a blockchain. We'll also learn how to interact with our smart contracts by sending and reading data. Solidity's contract syntax is actually similar to classes in object-oriented programming languages. Smart contracts have functions that we can call and variables that can be stored and read. Our ' Counter ' contract will store the number of times it has been called, making this value available for everyone to read from the blockchain. "' Pragma solidity ^0.4.11; Contract Counter {/* Define variable count of the type UINT */UINT count = 0;/* This runs when the contract is executed */function increment () public {count = count + 1;}/* Used to read the value of Count */function GetCount () constant Returns (UINT) {return count;}} "1. First release our smart contract to the blockchain, open Ethereum wallet Ethereum Wallet, and click on" Smart contract "contracts. [] (Http://blog.hubwiz.com/2018/06/21/solidity-hello-world-with-ethereum-wallet/hello_world_1.png) 2. Then click " Deploy a new contract "deployment a new contract.! [] (Http://blog.hubwiz.com/2018/06/21/solidity-hello-world-with-ethereum-wallet/hello_world_2.png) 3. Fill out our ' Counter ' contract code in the code text editing area of Ethereum wallet. [] (Http://blog.hubwiz.com/2018/06/21/solidity-hello-world-with-ethereum-wallet/hello_world_3.png) 4. Choose the contract you want to deploy on the right side of the Ethereum wallet: our ' Counter ' smart contract. [] (http://blog.hubwiz.com/2018/06/21/solidity-hello-world-with-ethereum-wallet/hello_world_4.png) 5. Enter your password and press "Send Transaction" send transaction. Gas price is the amount you need to post your contract to the blockchain, and another article discusses [How to calculate the smart contract gas] (http://blog.hubwiz.com/2018/04/12/how-to-estimate-gas/). [] (http://blog.hubwiz.com/2018/06/21/solidity-hello-world-with-ethereum-wallet/hello_world_5.png) You can see that the counter value equals 0. There is no cost to reading a value on the blockchain, which is why you can see the value shown here. Now, if you execute our value-added function, guess what happens? Our counter value is equal to 1. This may take some time, because the execution of the code must be written in the blockchain when the next block is mined. If you execute the increment function again, you will see a change in the counter value! This allows you to interact with [Ethereum Wallet development] (http://xc.hubwiz.com/course/5a952991adb3847553d205d1?affid=csdn621) and deploy your first Ethereum smart contract. >-[Ethereum E-commerce] (http://xc.hubwiz.com/course/5abbb7acc02e6b6a59171dd6?affid=csdn621), mainly introduces the use of node. js, MongoDB, Blockchain, IPFs realize to the center of e-commerce dapp actual combat. reprinted from [Ethereum Blog] (http://blog.hubwiz.com/2018/06/21/solidity-hello-world-with-ethereum-wallet/) 202 reads  
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.