使用Remix作为开发工具,Remix是基于浏览器的IDE,提供了集成的编译器和Solidity的运行环境.

地址是: https://remix.ethereum.org

首先在左边新建一个文件myfirstcontract.sol

文件内容:

pragma solidity ^0.4.0;

contract MyFirstContract {
    string private name;
    uint private age;
    
    function setName(string newName) public {
        name=newName;
    }
    
    function getName() public constant returns (string){
        return name;
    }
    function setAge(uint newAge) public {
        age=newAge;
    }
    
    function getAge() public constant returns(uint){
        return age;
    }
}

右边run 可以setName,getName,setAge,getAge

比如:

Solidity学习(一)




相关文章:

  • 2021-07-25
  • 2021-06-14
  • 2021-09-19
  • 2022-12-23
  • 2022-02-12
  • 2021-09-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-06-06
  • 2022-03-01
  • 2021-09-27
  • 2022-12-23
  • 2021-09-27
  • 2021-11-27
  • 2021-07-02
相关资源
相似解决方案