Ethernet Square has a variety of high-level language that can be used to write intelligent contracts. The most popular one is called Solidity, which is based on JavaScript . Solidity is by far the most mature Ethernet Square language, so it is strongly encouraged community language developers use today.
Remix Online Editor
New file, the file extension is .sol
The first program
pragma solidity ^0.4.0; //版本号 contract HelloWorld{ string Myname = "hxx";//这样的对象是默认存储在区块链之上的 function getName() public view returns(string){ return Myname; } }
^ Note the version number of representatives upward compatible, that is, to stop our program is a compilation older than 0.4.0 compiler
Solidity is required semicolon
Compile
Compile success
run
can be seen
We can see the account of money is reduced after deployment, a former 100. Because the deployment takes a certain amount of fuel, with the money to pay for Ethernet
pragma solidity ^0.4.0; //版本号 contract HelloWorld{ string Myname = "hxx";//这样的对象是默认存储在区块链之上的 function getName() public view returns(string){ return Myname; } function changeName(string newname)public{ Myname = newname; } }
Ethernet can see the amount of money the code to run more than consumption
Getname and will have the following two options changename
Solidity intelligent Ethernet Square contract
Guess you like
Origin blog.csdn.net/hxxjxw/article/details/105266556
Recommended
Ranking