智能合约Smart Contracts

郎献
2023-12-01

Why?

  • beyond value
  • rules of operarion
  • bussiness logic layer
  • message invoke function calls

解决问题

转账 服务 产品 功能 还有其他的rules,policies,governig

合约组成

定义

不可改变 存储追溯状态

结构

  • State Variables, Functions
  • Function Modifiers
  • Events
  • Struct Types and Enum Types
  • contracts can inherit from other contracts.

Remix

pragma solidity ^0.4.0;
contract Greeter{
    string public yourName;
    
    function Greeter() public{
        yourName = "world";
    }
    
    function set(string name) public{
        yourName = name;    
    }
    
    function hello() constant returns(string){
        return yourName;
    }
}
复制代码
pragma solidity ^0.4.0;
contract simpleStorage{
    uint storedData;
    function set(uint n) public{
        storedData = n;
    }
    function get() constant public returns(uint){
        return storedData;
    }
    function increment(uint n) public{
        storedData += n;
    }
    
    function decrement(uint n) public{
        storedData -= n;
    }   
}
复制代码

处理智能合约

compile artifacts

  • name
  • Address:
    • account
    • nonce
  • ABI
  • BYTECODE
  • WebDeploy script
  • Gas estimates
  • Function hashes
  • Instance Bytecode

部署

过程

Chap1

 类似资料: