代币示例

本节内容将展示如何编译、部署、调用ERC20代币合约。

如果您对如何基于Seele开发和部署合约尚不熟悉,建议先阅读[基于Seele开发部署合约流程.md],尝试基础的合约部署成功后, 再开发和部署ERC20代币合约。

一个ERC20代币合约示例

这里我们使用一个LKBT代币合约作为示例,该合约包含了一个library的调用。

pragma solidity ^0.4.24;


library IterableMapping {
  struct itmap
  {
    mapping(address => IndexValue) data;
    KeyFlag[] keys;
    uint size;
  }
  struct IndexValue { uint keyIndex; uint value; }
  struct KeyFlag { address key; bool deleted; }
  function insert(itmap storage self, address key, uint value) public returns (bool replaced)
  {
    uint keyIndex = self.data[key].keyIndex;
    self.data[key].value = value;
    if (keyIndex > 0)
      return true;
    else
    {
      keyIndex = self.keys.length++;
      self.data[key].keyIndex = keyIndex + 1;
      self.keys[keyIndex].key = key;
      self.size++;
      return false;
    }
  }
  function iterate_start(itmap storage self) public view returns (uint keyIndex)
  {
    return iterate_next(self, uint(-1));
  }
  function iterate_valid(itmap storage self, uint keyIndex) public view returns (bool)
  {
    return keyIndex < self.keys.length;
  }
  function iterate_next(itmap storage self, uint keyIndex) public view returns (uint)
  {
    uint _tmpKeyIndex = keyIndex;
    _tmpKeyIndex++;
    while (_tmpKeyIndex < self.keys.length && self.keys[_tmpKeyIndex].deleted)
      _tmpKeyIndex++;
    return _tmpKeyIndex;
  }
  function iterate_get(itmap storage self, uint keyIndex) public view returns (address key, uint value)
  {
    key = self.keys[keyIndex].key;
    value = self.data[key].value;
  }
  function iterate_getValue(itmap storage self, address key) public view returns (uint value) {
      return self.data[key].value;
  }
}

// File: zeppelin-solidity/contracts/ownership/Ownable.sol

/**
 * @title Ownable
 * @dev The Ownable contract has an owner address, and provides basic authorization control
 * functions, this simplifies the implementation of "user permissions".
 */
contract Ownable {
  address public owner;


  event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);


  /**
   * @dev The Ownable constructor sets the original `owner` of the contract to the sender
   * account.
   */
    constructor () public {
        owner = msg.sender;
    }

  /**
   * @dev Throws if called by any account other than the owner.
   */
  modifier onlyOwner() {
    require(msg.sender == owner,"called by any account other than the owner");
    _;
  }


  /**
   * @dev Allows the current owner to transfer control of the contract to a newOwner.
   * @param newOwner The address to transfer ownership to.
   */
  function transferOwnership(address newOwner) public onlyOwner {
    require(newOwner != address(0),"owner address should not 0");
    emit OwnershipTransferred(owner, newOwner);
    owner = newOwner;
  }

}

// File: zeppelin-solidity/contracts/lifecycle/Pausable.sol

/**
 * @title Pausable
 * @dev Base contract which allows children to implement an emergency stop mechanism.
 */
contract Pausable is Ownable {
  event Pause();
  event Unpause();

  bool public paused = false;


  /**
   * @dev Modifier to make a function callable only when the contract is not paused.
   */
  modifier whenNotPaused() {
    require(!paused,"callable when the contract is not paused");
    _;
  }

  /**
   * @dev Modifier to make a function callable only when the contract is paused.
   */
  modifier whenPaused() {
    require(paused,"callable when the contract is paused");
    _;
  }

  /**
   * @dev called by the owner to pause, triggers stopped state
   */
  function pause() public onlyOwner whenNotPaused {
    paused = true;
    emit Pause();
  }

  /**
   * @dev called by the owner to unpause, returns to normal state
   */
  function unpause() public onlyOwner whenPaused  {
    paused = false;
    emit Unpause();
  }
}

/**
 * @title SafeMath
 * @dev Math operations with safety checks that throw on error
 */
library SafeMath {

  /**
  * @dev Multiplies two numbers, throws on overflow.
  */
  function mul(uint256 _a, uint256 _b) internal pure returns (uint256 c) {
    // Gas optimization: this is cheaper than asserting 'a' not being zero, but the
    // benefit is lost if 'b' is also tested.
    // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
    if (_a == 0) {
      return 0;
    }

    c = _a * _b;
    assert(c / _a == _b);
    return c;
  }

  /**
  * @dev Integer division of two numbers, truncating the quotient.
  */
  function div(uint256 _a, uint256 _b) internal pure returns (uint256) {
    assert(_b > 0); // Solidity automatically throws when dividing by 0
    uint256 c = _a / _b;
    assert(_a == _b * c + _a % _b); // There is no case in which this doesn't hold
    return _a / _b;
  }

  /**
  * @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
  */
  function sub(uint256 _a, uint256 _b) internal pure returns (uint256) {
    assert(_b <= _a);
    return _a - _b;
  }

  /**
  * @dev Adds two numbers, throws on overflow.
  */
  function add(uint256 _a, uint256 _b) internal pure returns (uint256 c) {
    c = _a + _b;
    assert(c >= _a);
    return c;
  }
}

/**
 * @title ERC20Basic
 * @dev Simpler version of ERC20 interface
 * See https://github.com/ethereum/EIPs/issues/179
 */
contract ERC20Basic {
  function totalSupply() public view returns (uint256);
  function balanceOf(address _who) public view returns (uint256);
  function transfer(address _to, uint256 _value) public returns (bool);
  event Transfer(address indexed from, address indexed to, uint256 value);
}


/**
 * @title Basic token
 * @dev Basic version of StandardToken, with no allowances.
 */
contract BasicToken is ERC20Basic {
  using SafeMath for uint256;
  IterableMapping.itmap balances;

  uint256 internal totalSupply_;

  /**
  * @dev Total number of tokens in existence
  */
  function totalSupply() public view returns (uint256) {
    return totalSupply_;
  }

  /**
  * @dev Transfer token for a specified address
  * @param _to The address to transfer to.
  * @param _value The amount to be transferred.
  */
  function transfer(address _to, uint256 _value) public returns (bool) {

    require(_value <= IterableMapping.iterate_getValue(balances, msg.sender),"not enough balances");
    require(_to != address(0),"0 address not allow");

    IterableMapping.insert(balances, msg.sender, IterableMapping.iterate_getValue(balances, msg.sender).sub(_value));
    IterableMapping.insert(balances, _to, IterableMapping.iterate_getValue(balances, _to).add(_value));
    emit Transfer(msg.sender, _to, _value);
    return true;
  }

  /**
  * @dev Gets the balance of the specified address.
  * @param _owner The address to query the the balance of.
  * @return An uint256 representing the amount owned by the passed address.
  */
  function balanceOf(address _owner) public view returns (uint256) {
      return IterableMapping.iterate_getValue(balances, _owner);
  }

}



/**
 * @title ERC20 interface
 * @dev see https://github.com/ethereum/EIPs/issues/20
 */
contract ERC20 is ERC20Basic {
  function allowance(address _owner, address _spender)
    public view returns (uint256);

  function transferFrom(address _from, address _to, uint256 _value)
    public returns (bool);

  function approve(address _spender, uint256 _value) public returns (bool);
  event Approval(
    address indexed owner,
    address indexed spender,
    uint256 value
  );
}

/**
 * @title Standard ERC20 token
 *
 * @dev Implementation of the basic standard token.
 * https://github.com/ethereum/EIPs/issues/20
 * Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
 */
contract StandardToken is ERC20, BasicToken {

  mapping (address => mapping (address => uint256)) internal allowed;


  /**
   * @dev Transfer tokens from one address to another
   * @param _from address The address which you want to send tokens from
   * @param _to address The address which you want to transfer to
   * @param _value uint256 the amount of tokens to be transferred
   */
  function transferFrom(
    address _from,
    address _to,
    uint256 _value
  )
    public
    returns (bool)
  {

    require(_value <= IterableMapping.iterate_getValue(balances, _from),"balance not enough");
    require(_value <= allowed[_from][msg.sender],"balance not enough");
    require(_to != address(0),"0 address not allow");

    IterableMapping.insert(balances, _from, IterableMapping.iterate_getValue(balances, _from).sub(_value));
    IterableMapping.insert(balances, _to, IterableMapping.iterate_getValue(balances, _to).add(_value));
    allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
    emit Transfer(_from, _to, _value);
    return true;
  }

  /**
   * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
   * Beware that changing an allowance with this method brings the risk that someone may use both the old
   * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
   * race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
   * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
   * @param _spender The address which will spend the funds.
   * @param _value The amount of tokens to be spent.
   */
  function approve(address _spender, uint256 _value) public returns (bool) {
    allowed[msg.sender][_spender] = _value;
    emit Approval(msg.sender, _spender, _value);
    return true;
  }

  /**
   * @dev Function to check the amount of tokens that an owner allowed to a spender.
   * @param _owner address The address which owns the funds.
   * @param _spender address The address which will spend the funds.
   * @return A uint256 specifying the amount of tokens still available for the spender.
   */
  function allowance(
    address _owner,
    address _spender
   )
    public
    view
    returns (uint256)
  {
    return allowed[_owner][_spender];
  }

  /**
   * @dev Increase the amount of tokens that an owner allowed to a spender.
   * approve should be called when allowed[_spender] == 0. To increment
   * allowed value is better to use this function to avoid 2 calls (and wait until
   * the first transaction is mined)
   * From MonolithDAO Token.sol
   * @param _spender The address which will spend the funds.
   * @param _addedValue The amount of tokens to increase the allowance by.
   */
  function increaseApproval(
    address _spender,
    uint256 _addedValue
  )
    public
    returns (bool)
  {
    allowed[msg.sender][_spender] = (
      allowed[msg.sender][_spender].add(_addedValue));
    emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
    return true;
  }

  /**
   * @dev Decrease the amount of tokens that an owner allowed to a spender.
   * approve should be called when allowed[_spender] == 0. To decrement
   * allowed value is better to use this function to avoid 2 calls (and wait until
   * the first transaction is mined)
   * From MonolithDAO Token.sol
   * @param _spender The address which will spend the funds.
   * @param _subtractedValue The amount of tokens to decrease the allowance by.
   */
  function decreaseApproval(
    address _spender,
    uint256 _subtractedValue
  )
    public
    returns (bool)
  {
    uint256 oldValue = allowed[msg.sender][_spender];
    if (_subtractedValue >= oldValue) {
      allowed[msg.sender][_spender] = 0;
    } else {
      allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
    }
    emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
    return true;
  }

}

/**
 * @title Pausable token
 *
 * @dev StandardToken modified with pausable transfers.
 **/

contract PausableToken is StandardToken, Pausable {

  function transfer(address _to, uint256 _value) public whenNotPaused returns (bool) {
    return super.transfer(_to, _value);
  }

  function transferFrom(address _from, address _to, uint256 _value) public whenNotPaused returns (bool) {
    return super.transferFrom(_from, _to, _value);
  }

  function approve(address _spender, uint256 _value) public whenNotPaused returns (bool) {
    return super.approve(_spender, _value);
  }

  function increaseApproval(address _spender, uint _addedValue) public whenNotPaused returns (bool success) {
    return super.increaseApproval(_spender, _addedValue);
  }

  function decreaseApproval(address _spender, uint _subtractedValue) public whenNotPaused returns (bool success) {
    return super.decreaseApproval(_spender, _subtractedValue);
  }
}

contract LKBT is PausableToken {
    string public name = "LKBT Token";
    string public symbol = "LKBT";
    uint8 public decimals = 18;
    uint256 public INITIAL_SUPPLY = 10000000000;

    constructor () public {
        totalSupply_ = INITIAL_SUPPLY;
        IterableMapping.insert(balances, msg.sender, INITIAL_SUPPLY);
    }

    function balancesStart() public view returns(uint256) {
        return IterableMapping.iterate_start(balances);
    }

    function balancesGetBool(uint256 num) public view returns(bool){
        return IterableMapping.iterate_valid(balances, num);
    }

    function balancesGetNext(uint256 num) public view returns(uint256) {
        return IterableMapping.iterate_next(balances, num);
    }
    function balancesGetValue(uint256 num) public view returns(address, uint256) {
        address key;
        uint256 value;
        (key, value) = IterableMapping.iterate_get(balances, num);
        return (key, value);
    }
}

编辑和编译合约

使用remix在线编辑器 编辑以及编译上述合约。注意选择相应的编译器版本与合约一致。

【注意:使用Seele部署合约,建议使用的solidity版本为0.4.24-0.4.26。】

  • 获得IterableMapping的字节码

    点击remix右侧的run,选择合约IterableMapping,点击Deploy,

    可以看到日志窗口的部署详情,复制input内容,即为IterableMapping的字节码。

0x610646610030600b82828239805160001a6073146000811461002057610022565bfe5b5030600052607381538281f300730000000000000000000000000000000000000000301460806040526004361061008f576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680634c5e1cae1461009457806375a3e8e8146100e857806388d0443714610159578063a21ab71614610197578063ab517b4f146101cb578063c8fccc691461023a575b600080fd5b6100d260048036038101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061027c565b6040518082815260200191505060405180910390f35b61011060048036038101908080359060200190929190803590602001909291905050506102cb565b604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390f35b610181600480360381019080803590602001909291908035906020019092919050505061035d565b6040518082815260200191505060405180910390f35b6101b5600480360381019080803590602001909291905050506103c6565b6040518082815260200191505060405180910390f35b8180156101d757600080fd5b5061022060048036038101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506103f9565b604051808215151515815260200191505060405180910390f35b6102626004803603810190808035906020019092919080359060200190929190505050610580565b604051808215151515815260200191505060405180910390f35b60008260000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010154905092915050565b60008083600101838154811015156102df57fe5b9060005260206000200160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1691508360000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015490509250929050565b60008082905080806001019150505b8360010180549050811080156103aa5750836001018181548110151561038e57fe5b9060005260206000200160000160149054906101000a900460ff165b156103bc57808060010191505061036c565b8091505092915050565b60006103f2827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff61035d565b9050919050565b6000808460000160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001549050828560000160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010181905550600081111561049e5760019150610578565b8460010180548091906001016104b49190610594565b9050600181018560000160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000018190555083856001018281548110151561051457fe5b9060005260206000200160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508460020160008154809291906001019190505550600091505b509392505050565b600082600101805490508210905092915050565b8154818355818111156105bb578183600052602060002091820191016105ba91906105c0565b5b505050565b61061791905b8082111561061357600080820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690556000820160146101000a81549060ff0219169055506001016105c6565b5090565b905600a165627a7a72305820b794fd1c17a9ff0d50981b40ff2dd307a38ab6776bc963e8a4bff7df0b11f5170029

同时日志中还显示了部署后该合约地址0x5e72914535f202659083db3a02c984188fa26e9f

  • 获得LKBT合约字节码

    在remix右侧回到compile窗口,选择LKBT合约,点击bytecode将复制该合约编译后信息,将该内容粘贴在一个文本编辑器内。

    这是一个JSON格式的数据,其中object字段值即为合约的字节码。

【图:LKBT byteCode.png】

60806040526000600560146101000a81548160ff0219169083151502179055506040805190810160405280600a81526020017f4c4b425420546f6b656e00000000000000000000000000000000000000000000815250600690805190602001906200006c92919062000227565b506040805190810160405280600481526020017f4c4b42540000000000000000000000000000000000000000000000000000000081525060079080519060200190620000ba92919062000227565b506012600860006101000a81548160ff021916908360ff1602179055506402540be400600955348015620000ed57600080fd5b5033600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060095460038190555073__browser/LKBTCoin.sol:IterableMapping__63ab517b4f6000336009546040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001935050505060206040518083038186803b158015620001e357600080fd5b505af4158015620001f8573d6000803e3d6000fd5b505050506040513d60208110156200020f57600080fd5b810190808051906020019092919050505050620002d6565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106200026a57805160ff19168380011785556200029b565b828001600101855582156200029b579182015b828111156200029a5782518255916020019190600101906200027d565b5b509050620002aa9190620002ae565b5090565b620002d391905b80821115620002cf576000816000905550600101620002b5565b5090565b90565b612b7f80620002e66000396000f30060806040526004361061011d576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde0314610122578063095ea7b3146101b257806318160ddd1461021757806323b872dd146102425780632ff2e9dc146102c7578063313ce567146102f25780633f4ba83a146103235780635c975abb1461033a578063661884631461036957806370a08231146103ce5780637e0c5747146104255780638456cb59146104995780638da5cb5b146104b057806395d89b4114610507578063a9059cbb14610597578063b8ba5c20146105fc578063cf2adac814610627578063d1505c5d14610668578063d73dd623146106ad578063dd62ed3e14610712578063f2fde38b14610789575b600080fd5b34801561012e57600080fd5b506101376107cc565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561017757808201518184015260208101905061015c565b50505050905090810190601f1680156101a45780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101be57600080fd5b506101fd600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061086a565b604051808215151515815260200191505060405180910390f35b34801561022357600080fd5b5061022c610929565b6040518082815260200191505060405180910390f35b34801561024e57600080fd5b506102ad600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610933565b604051808215151515815260200191505060405180910390f35b3480156102d357600080fd5b506102dc6109f4565b6040518082815260200191505060405180910390f35b3480156102fe57600080fd5b506103076109fa565b604051808260ff1660ff16815260200191505060405180910390f35b34801561032f57600080fd5b50610338610a0d565b005b34801561034657600080fd5b5061034f610beb565b604051808215151515815260200191505060405180910390f35b34801561037557600080fd5b506103b4600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610bfe565b604051808215151515815260200191505060405180910390f35b3480156103da57600080fd5b5061040f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610cbd565b6040518082815260200191505060405180910390f35b34801561043157600080fd5b5061045060048036038101908080359060200190929190505050610da1565b604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390f35b3480156104a557600080fd5b506104ae610e74565b005b3480156104bc57600080fd5b506104c5611053565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561051357600080fd5b5061051c611079565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561055c578082015181840152602081019050610541565b50505050905090810190601f1680156105895780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156105a357600080fd5b506105e2600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611117565b604051808215151515815260200191505060405180910390f35b34801561060857600080fd5b506106116111d6565b6040518082815260200191505060405180910390f35b34801561063357600080fd5b5061065260048036038101908080359060200190929190505050611284565b6040518082815260200191505060405180910390f35b34801561067457600080fd5b506106936004803603810190808035906020019092919050505061133c565b604051808215151515815260200191505060405180910390f35b3480156106b957600080fd5b506106f8600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506113f4565b604051808215151515815260200191505060405180910390f35b34801561071e57600080fd5b50610773600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506114b3565b6040518082815260200191505060405180910390f35b34801561079557600080fd5b506107ca600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061153a565b005b60068054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108625780601f1061083757610100808354040283529160200191610862565b820191906000526020600020905b81548152906001019060200180831161084557829003601f168201915b505050505081565b6000600560149054906101000a900460ff16151515610917576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260288152602001807f63616c6c61626c65207768656e2074686520636f6e7472616374206973206e6f81526020017f742070617573656400000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b610921838361178a565b905092915050565b6000600354905090565b6000600560149054906101000a900460ff161515156109e0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260288152602001807f63616c6c61626c65207768656e2074686520636f6e7472616374206973206e6f81526020017f742070617573656400000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b6109eb84848461187c565b90509392505050565b60095481565b600860009054906101000a900460ff1681565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610af8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a8152602001807f63616c6c656420627920616e79206163636f756e74206f74686572207468616e81526020017f20746865206f776e65720000000000000000000000000000000000000000000081525060400191505060405180910390fd5b600560149054906101000a900460ff161515610ba2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260248152602001807f63616c6c61626c65207768656e2074686520636f6e747261637420697320706181526020017f757365640000000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b6000600560146101000a81548160ff0219169083151502179055507f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a1565b600560149054906101000a900460ff1681565b6000600560149054906101000a900460ff16151515610cab576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260288152602001807f63616c6c61626c65207768656e2074686520636f6e7472616374206973206e6f81526020017f742070617573656400000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b610cb58383612088565b905092915050565b600073__browser/LKBTCoin.sol:IterableMapping__634c5e1cae6000846040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060206040518083038186803b158015610d5f57600080fd5b505af4158015610d73573d6000803e3d6000fd5b505050506040513d6020811015610d8957600080fd5b81019080805190602001909291905050509050919050565b60008060008073__browser/LKBTCoin.sol:IterableMapping__6375a3e8e86000876040518363ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018083815260200182815260200192505050604080518083038186803b158015610e1a57600080fd5b505af4158015610e2e573d6000803e3d6000fd5b505050506040513d6040811015610e4457600080fd5b81019080805190602001909291908051906020019092919050505080925081935050508181935093505050915091565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610f5f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a8152602001807f63616c6c656420627920616e79206163636f756e74206f74686572207468616e81526020017f20746865206f776e65720000000000000000000000000000000000000000000081525060400191505060405180910390fd5b600560149054906101000a900460ff1615151561100a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260288152602001807f63616c6c61626c65207768656e2074686520636f6e7472616374206973206e6f81526020017f742070617573656400000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b6001600560146101000a81548160ff0219169083151502179055507f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a1565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60078054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561110f5780601f106110e45761010080835404028352916020019161110f565b820191906000526020600020905b8154815290600101906020018083116110f257829003601f168201915b505050505081565b6000600560149054906101000a900460ff161515156111c4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260288152602001807f63616c6c61626c65207768656e2074686520636f6e7472616374206973206e6f81526020017f742070617573656400000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b6111ce838361231a565b905092915050565b600073__browser/LKBTCoin.sol:IterableMapping__63a21ab71660006040518263ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018082815260200191505060206040518083038186803b15801561124457600080fd5b505af4158015611258573d6000803e3d6000fd5b505050506040513d602081101561126e57600080fd5b8101908080519060200190929190505050905090565b600073__browser/LKBTCoin.sol:IterableMapping__6388d044376000846040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808381526020018281526020019250505060206040518083038186803b1580156112fa57600080fd5b505af415801561130e573d6000803e3d6000fd5b505050506040513d602081101561132457600080fd5b81019080805190602001909291905050509050919050565b600073__browser/LKBTCoin.sol:IterableMapping__63c8fccc696000846040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808381526020018281526020019250505060206040518083038186803b1580156113b257600080fd5b505af41580156113c6573d6000803e3d6000fd5b505050506040513d60208110156113dc57600080fd5b81019080805190602001909291905050509050919050565b6000600560149054906101000a900460ff161515156114a1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260288152602001807f63616c6c61626c65207768656e2074686520636f6e7472616374206973206e6f81526020017f742070617573656400000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b6114ab8383612922565b905092915050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611625576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a8152602001807f63616c6c656420627920616e79206163636f756e74206f74686572207468616e81526020017f20746865206f776e65720000000000000000000000000000000000000000000081525060400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515156116ca576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f6f776e657220616464726573732073686f756c64206e6f74203000000000000081525060200191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600081600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b600073__browser/LKBTCoin.sol:IterableMapping__634c5e1cae6000866040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060206040518083038186803b15801561191e57600080fd5b505af4158015611932573d6000803e3d6000fd5b505050506040513d602081101561194857600080fd5b810190808051906020019092919050505082111515156119d0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260128152602001807f62616c616e6365206e6f7420656e6f756768000000000000000000000000000081525060200191505060405180910390fd5b600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515611ac4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260128152602001807f62616c616e6365206e6f7420656e6f756768000000000000000000000000000081525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515611b69576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f302061646472657373206e6f7420616c6c6f770000000000000000000000000081525060200191505060405180910390fd5b73__browser/LKBTCoin.sol:IterableMapping__63ab517b4f600086611c738673__browser/LKBTCoin.sol:IterableMapping__634c5e1cae60008c6040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060206040518083038186803b158015611c2a57600080fd5b505af4158015611c3e573d6000803e3d6000fd5b505050506040513d6020811015611c5457600080fd5b8101908080519060200190929190505050612b1e90919063ffffffff16565b6040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001935050505060206040518083038186803b158015611cfd57600080fd5b505af4158015611d11573d6000803e3d6000fd5b505050506040513d6020811015611d2757600080fd5b81019080805190602001909291905050505073__browser/LKBTCoin.sol:IterableMapping__63ab517b4f600085611e438673__browser/LKBTCoin.sol:IterableMapping__634c5e1cae60008b6040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060206040518083038186803b158015611dfa57600080fd5b505af4158015611e0e573d6000803e3d6000fd5b505050506040513d6020811015611e2457600080fd5b8101908080519060200190929190505050612b3790919063ffffffff16565b6040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001935050505060206040518083038186803b158015611ecd57600080fd5b505af4158015611ee1573d6000803e3d6000fd5b505050506040513d6020811015611ef757600080fd5b810190808051906020019092919050505050611f9882600460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612b1e90919063ffffffff16565b600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600080600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050808310151561219a576000600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061222e565b6121ad8382612b1e90919063ffffffff16565b600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b600073__browser/LKBTCoin.sol:IterableMapping__634c5e1cae6000336040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060206040518083038186803b1580156123bc57600080fd5b505af41580156123d0573d6000803e3d6000fd5b505050506040513d60208110156123e657600080fd5b8101908080519060200190929190505050821115151561246e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f6e6f7420656e6f7567682062616c616e6365730000000000000000000000000081525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515612513576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f302061646472657373206e6f7420616c6c6f770000000000000000000000000081525060200191505060405180910390fd5b73__browser/LKBTCoin.sol:IterableMapping__63ab517b4f60003361261d8673__browser/LKBTCoin.sol:IterableMapping__634c5e1cae6000336040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060206040518083038186803b1580156125d457600080fd5b505af41580156125e8573d6000803e3d6000fd5b505050506040513d60208110156125fe57600080fd5b8101908080519060200190929190505050612b1e90919063ffffffff16565b6040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001935050505060206040518083038186803b1580156126a757600080fd5b505af41580156126bb573d6000803e3d6000fd5b505050506040513d60208110156126d157600080fd5b81019080805190602001909291905050505073__browser/LKBTCoin.sol:IterableMapping__63ab517b4f6000856127ed8673__browser/LKBTCoin.sol:IterableMapping__634c5e1cae60008b6040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060206040518083038186803b1580156127a457600080fd5b505af41580156127b8573d6000803e3d6000fd5b505050506040513d60208110156127ce57600080fd5b8101908080519060200190929190505050612b3790919063ffffffff16565b6040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001935050505060206040518083038186803b15801561287757600080fd5b505af415801561288b573d6000803e3d6000fd5b505050506040513d60208110156128a157600080fd5b8101908080519060200190929190505050508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b60006129b382600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612b3790919063ffffffff16565b600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000828211151515612b2c57fe5b818303905092915050565b60008183019050828110151515612b4a57fe5b809050929150505600a165627a7a7230582092e657485de4860937d530e1dd266cbb89b3c5b7f6be05431dee37e7120331cc0029

这里字节码内容中,包含了一部分特殊内容_browser/LKBTCoin.sol:IterableMapping_\,这是因为该合约引用了IterableMapping。 将该部分内容替换为IterableMapping合约的地址,即是该合约最终部署的字节码内容。

部署合约

部署合约前提须知

  1. 在部署合约之前,请先确保你正确的运行了Seele node全节点,并同步到当前最新区块高度。

  2. 请确认你希望将合约部署到哪个分片(分片1 - 分片4)

  3. 请确认你在该分片拥有一个账户,并且该账户内有足够的余额用于合约部署

本示例将使用一个分片4的账户,将合约部署到分片4。

示例合约部署步骤

  1. 部署IterableMapping合约

    ./client sendtx --amount 0 --from 0x2491daa1d3df8a0b84027eb75db328f1300557f1-shard4.json  --gas 20000000 --payload 0x610646610030600b82828239805160001a6073146000811461002057610022565bfe5b5030600052607381538281f300730000000000000000000000000000000000000000301460806040526004361061008f576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680634c5e1cae1461009457806375a3e8e8146100e857806388d0443714610159578063a21ab71614610197578063ab517b4f146101cb578063c8fccc691461023a575b600080fd5b6100d260048036038101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061027c565b6040518082815260200191505060405180910390f35b61011060048036038101908080359060200190929190803590602001909291905050506102cb565b604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390f35b610181600480360381019080803590602001909291908035906020019092919050505061035d565b6040518082815260200191505060405180910390f35b6101b5600480360381019080803590602001909291905050506103c6565b6040518082815260200191505060405180910390f35b8180156101d757600080fd5b5061022060048036038101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506103f9565b604051808215151515815260200191505060405180910390f35b6102626004803603810190808035906020019092919080359060200190929190505050610580565b604051808215151515815260200191505060405180910390f35b60008260000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010154905092915050565b60008083600101838154811015156102df57fe5b9060005260206000200160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1691508360000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015490509250929050565b60008082905080806001019150505b8360010180549050811080156103aa5750836001018181548110151561038e57fe5b9060005260206000200160000160149054906101000a900460ff165b156103bc57808060010191505061036c565b8091505092915050565b60006103f2827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff61035d565b9050919050565b6000808460000160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001549050828560000160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010181905550600081111561049e5760019150610578565b8460010180548091906001016104b49190610594565b9050600181018560000160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000018190555083856001018281548110151561051457fe5b9060005260206000200160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508460020160008154809291906001019190505550600091505b509392505050565b600082600101805490508210905092915050565b8154818355818111156105bb578183600052602060002091820191016105ba91906105c0565b5b505050565b61061791905b8082111561061357600080820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690556000820160146101000a81549060ff0219169055506001016105c6565b5090565b905600a165627a7a72305820b794fd1c17a9ff0d50981b40ff2dd307a38ab6776bc963e8a4bff7df0b11f5170029 -a 127.0.0.1:8026

    执行结果:

    account: 0x2491daa1d3df8a0b84027eb75db328f1300557f1, transaction nonce: 3
    transaction sent successfully
    {
         "Hash": "0x66419b4dcb8312c2c1f7a89036987d6bbcadb1113653e43db3f0f76ee62a9587",
         "Data": {
                 "Type": 0,
                 "From": "0x2491daa1d3df8a0b84027eb75db328f1300557f1",
                 "To": "0x0000000000000000000000000000000000000000",
                 "Amount": 0,
                 "AccountNonce": 3,
                 "GasPrice": 10,
                 "GasLimit": 20000000,
                 "Timestamp": 0,
                 "Payload": "0x610646610030600b82828239805160001a6073146000811461002057610022565bfe5b5030600052607381538281f300730000000000000000000000000000000000000000301460806040526004361061008f576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680634c5e1cae1461009457806375a3e8e8146100e857806388d0443714610159578063a21ab71614610197578063ab517b4f146101cb578063c8fccc691461023a575b600080fd5b6100d260048036038101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061027c565b6040518082815260200191505060405180910390f35b61011060048036038101908080359060200190929190803590602001909291905050506102cb565b604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390f35b610181600480360381019080803590602001909291908035906020019092919050505061035d565b6040518082815260200191505060405180910390f35b6101b5600480360381019080803590602001909291905050506103c6565b6040518082815260200191505060405180910390f35b8180156101d757600080fd5b5061022060048036038101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506103f9565b604051808215151515815260200191505060405180910390f35b6102626004803603810190808035906020019092919080359060200190929190505050610580565b604051808215151515815260200191505060405180910390f35b60008260000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010154905092915050565b60008083600101838154811015156102df57fe5b9060005260206000200160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1691508360000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015490509250929050565b60008082905080806001019150505b8360010180549050811080156103aa5750836001018181548110151561038e57fe5b9060005260206000200160000160149054906101000a900460ff165b156103bc57808060010191505061036c565b8091505092915050565b60006103f2827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff61035d565b9050919050565b6000808460000160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001549050828560000160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010181905550600081111561049e5760019150610578565b8460010180548091906001016104b49190610594565b9050600181018560000160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000018190555083856001018281548110151561051457fe5b9060005260206000200160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508460020160008154809291906001019190505550600091505b509392505050565b600082600101805490508210905092915050565b8154818355818111156105bb578183600052602060002091820191016105ba91906105c0565b5b505050565b61061791905b8082111561061357600080820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690556000820160146101000a81549060ff0219169055506001016105c6565b5090565b905600a165627a7a72305820b794fd1c17a9ff0d50981b40ff2dd307a38ab6776bc963e8a4bff7df0b11f5170029"
         },
         "Signature": {
                 "Sig": "Yl1HZUwfjkwQk/8CjwP4PKuAdek+d91PDA0h2XLAc5d7fBJSabf2zhqRGHam223psQaMNbmbFaZfeSy3iMGH/wA="
         }
    }
./client getreceipt --hash 0x66419b4dcb8312c2c1f7a89036987d6bbcadb1113653e43db3f0f76ee62a9587 -a localhost:8026

查询receipt结果:

{
        "contract": "0xbab79f5f0d136db78e5df967a48006f1d5360032",
        "failed": false,
        "poststate": "0x179fcde02a3d218e83e78572e38a35d22ccc80d4664873da5414ad247627b622",
        "result": "0x73bab79f5f0d136db78e5df967a48006f1d5360032301460806040526004361061008f576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680634c5e1cae1461009457806375a3e8e8146100e857806388d0443714610159578063a21ab71614610197578063ab517b4f146101cb578063c8fccc691461023a575b600080fd5b6100d260048036038101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061027c565b6040518082815260200191505060405180910390f35b61011060048036038101908080359060200190929190803590602001909291905050506102cb565b604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390f35b610181600480360381019080803590602001909291908035906020019092919050505061035d565b6040518082815260200191505060405180910390f35b6101b5600480360381019080803590602001909291905050506103c6565b6040518082815260200191505060405180910390f35b8180156101d757600080fd5b5061022060048036038101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506103f9565b604051808215151515815260200191505060405180910390f35b6102626004803603810190808035906020019092919080359060200190929190505050610580565b604051808215151515815260200191505060405180910390f35b60008260000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010154905092915050565b60008083600101838154811015156102df57fe5b9060005260206000200160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1691508360000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015490509250929050565b60008082905080806001019150505b8360010180549050811080156103aa5750836001018181548110151561038e57fe5b9060005260206000200160000160149054906101000a900460ff165b156103bc57808060010191505061036c565b8091505092915050565b60006103f2827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff61035d565b9050919050565b6000808460000160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001549050828560000160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010181905550600081111561049e5760019150610578565b8460010180548091906001016104b49190610594565b9050600181018560000160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000018190555083856001018281548110151561051457fe5b9060005260206000200160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508460020160008154809291906001019190505550600091505b509392505050565b600082600101805490508210905092915050565b8154818355818111156105bb578183600052602060002091820191016105ba91906105c0565b5b505050565b61061791905b8082111561061357600080820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690556000820160146101000a81549060ff0219169055506001016105c6565b5090565b905600a165627a7a72305820b794fd1c17a9ff0d50981b40ff2dd307a38ab6776bc963e8a4bff7df0b11f5170029",
        "totalFee": 4479770,
        "txhash": "0x66419b4dcb8312c2c1f7a89036987d6bbcadb1113653e43db3f0f76ee62a9587",
        "usedGas": 447977
}

failed为false,说明合约部署成功,合约地址0xbab79f5f0d136db78e5df967a48006f1d5360032。 可在Seele Scan查询到该合约

  1. 部署LKBT合约

    将编译步骤中得到的LKBT合约的字节码中_browser/LKBTCoin.sol:IterableMapping_\,替换为上一步骤中的合约地址bab79f5f0d136db78e5df967a48006f1d5360032。

    ./client sendtx --amount 0 --from 0x2491daa1d3df8a0b84027eb75db328f1300557f1-shard4.json --gas 200000000 --payload 0x60806040526000600560146101000a81548160ff0219169083151502179055506040805190810160405280600a81526020017f4c4b425420546f6b656e00000000000000000000000000000000000000000000815250600690805190602001906200006c92919062000227565b506040805190810160405280600481526020017f4c4b42540000000000000000000000000000000000000000000000000000000081525060079080519060200190620000ba92919062000227565b506012600860006101000a81548160ff021916908360ff1602179055506402540be400600955348015620000ed57600080fd5b5033600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060095460038190555073bab79f5f0d136db78e5df967a48006f1d536003263ab517b4f6000336009546040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001935050505060206040518083038186803b158015620001e357600080fd5b505af4158015620001f8573d6000803e3d6000fd5b505050506040513d60208110156200020f57600080fd5b810190808051906020019092919050505050620002d6565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106200026a57805160ff19168380011785556200029b565b828001600101855582156200029b579182015b828111156200029a5782518255916020019190600101906200027d565b5b509050620002aa9190620002ae565b5090565b620002d391905b80821115620002cf576000816000905550600101620002b5565b5090565b90565b612b7f80620002e66000396000f30060806040526004361061011d576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde0314610122578063095ea7b3146101b257806318160ddd1461021757806323b872dd146102425780632ff2e9dc146102c7578063313ce567146102f25780633f4ba83a146103235780635c975abb1461033a578063661884631461036957806370a08231146103ce5780637e0c5747146104255780638456cb59146104995780638da5cb5b146104b057806395d89b4114610507578063a9059cbb14610597578063b8ba5c20146105fc578063cf2adac814610627578063d1505c5d14610668578063d73dd623146106ad578063dd62ed3e14610712578063f2fde38b14610789575b600080fd5b34801561012e57600080fd5b506101376107cc565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561017757808201518184015260208101905061015c565b50505050905090810190601f1680156101a45780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101be57600080fd5b506101fd600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061086a565b604051808215151515815260200191505060405180910390f35b34801561022357600080fd5b5061022c610929565b6040518082815260200191505060405180910390f35b34801561024e57600080fd5b506102ad600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610933565b604051808215151515815260200191505060405180910390f35b3480156102d357600080fd5b506102dc6109f4565b6040518082815260200191505060405180910390f35b3480156102fe57600080fd5b506103076109fa565b604051808260ff1660ff16815260200191505060405180910390f35b34801561032f57600080fd5b50610338610a0d565b005b34801561034657600080fd5b5061034f610beb565b604051808215151515815260200191505060405180910390f35b34801561037557600080fd5b506103b4600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610bfe565b604051808215151515815260200191505060405180910390f35b3480156103da57600080fd5b5061040f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610cbd565b6040518082815260200191505060405180910390f35b34801561043157600080fd5b5061045060048036038101908080359060200190929190505050610da1565b604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390f35b3480156104a557600080fd5b506104ae610e74565b005b3480156104bc57600080fd5b506104c5611053565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561051357600080fd5b5061051c611079565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561055c578082015181840152602081019050610541565b50505050905090810190601f1680156105895780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156105a357600080fd5b506105e2600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611117565b604051808215151515815260200191505060405180910390f35b34801561060857600080fd5b506106116111d6565b6040518082815260200191505060405180910390f35b34801561063357600080fd5b5061065260048036038101908080359060200190929190505050611284565b6040518082815260200191505060405180910390f35b34801561067457600080fd5b506106936004803603810190808035906020019092919050505061133c565b604051808215151515815260200191505060405180910390f35b3480156106b957600080fd5b506106f8600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506113f4565b604051808215151515815260200191505060405180910390f35b34801561071e57600080fd5b50610773600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506114b3565b6040518082815260200191505060405180910390f35b34801561079557600080fd5b506107ca600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061153a565b005b60068054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108625780601f1061083757610100808354040283529160200191610862565b820191906000526020600020905b81548152906001019060200180831161084557829003601f168201915b505050505081565b6000600560149054906101000a900460ff16151515610917576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260288152602001807f63616c6c61626c65207768656e2074686520636f6e7472616374206973206e6f81526020017f742070617573656400000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b610921838361178a565b905092915050565b6000600354905090565b6000600560149054906101000a900460ff161515156109e0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260288152602001807f63616c6c61626c65207768656e2074686520636f6e7472616374206973206e6f81526020017f742070617573656400000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b6109eb84848461187c565b90509392505050565b60095481565b600860009054906101000a900460ff1681565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610af8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a8152602001807f63616c6c656420627920616e79206163636f756e74206f74686572207468616e81526020017f20746865206f776e65720000000000000000000000000000000000000000000081525060400191505060405180910390fd5b600560149054906101000a900460ff161515610ba2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260248152602001807f63616c6c61626c65207768656e2074686520636f6e747261637420697320706181526020017f757365640000000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b6000600560146101000a81548160ff0219169083151502179055507f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a1565b600560149054906101000a900460ff1681565b6000600560149054906101000a900460ff16151515610cab576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260288152602001807f63616c6c61626c65207768656e2074686520636f6e7472616374206973206e6f81526020017f742070617573656400000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b610cb58383612088565b905092915050565b600073bab79f5f0d136db78e5df967a48006f1d5360032634c5e1cae6000846040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060206040518083038186803b158015610d5f57600080fd5b505af4158015610d73573d6000803e3d6000fd5b505050506040513d6020811015610d8957600080fd5b81019080805190602001909291905050509050919050565b60008060008073bab79f5f0d136db78e5df967a48006f1d53600326375a3e8e86000876040518363ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018083815260200182815260200192505050604080518083038186803b158015610e1a57600080fd5b505af4158015610e2e573d6000803e3d6000fd5b505050506040513d6040811015610e4457600080fd5b81019080805190602001909291908051906020019092919050505080925081935050508181935093505050915091565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610f5f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a8152602001807f63616c6c656420627920616e79206163636f756e74206f74686572207468616e81526020017f20746865206f776e65720000000000000000000000000000000000000000000081525060400191505060405180910390fd5b600560149054906101000a900460ff1615151561100a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260288152602001807f63616c6c61626c65207768656e2074686520636f6e7472616374206973206e6f81526020017f742070617573656400000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b6001600560146101000a81548160ff0219169083151502179055507f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a1565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60078054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561110f5780601f106110e45761010080835404028352916020019161110f565b820191906000526020600020905b8154815290600101906020018083116110f257829003601f168201915b505050505081565b6000600560149054906101000a900460ff161515156111c4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260288152602001807f63616c6c61626c65207768656e2074686520636f6e7472616374206973206e6f81526020017f742070617573656400000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b6111ce838361231a565b905092915050565b600073bab79f5f0d136db78e5df967a48006f1d536003263a21ab71660006040518263ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018082815260200191505060206040518083038186803b15801561124457600080fd5b505af4158015611258573d6000803e3d6000fd5b505050506040513d602081101561126e57600080fd5b8101908080519060200190929190505050905090565b600073bab79f5f0d136db78e5df967a48006f1d53600326388d044376000846040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808381526020018281526020019250505060206040518083038186803b1580156112fa57600080fd5b505af415801561130e573d6000803e3d6000fd5b505050506040513d602081101561132457600080fd5b81019080805190602001909291905050509050919050565b600073bab79f5f0d136db78e5df967a48006f1d536003263c8fccc696000846040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808381526020018281526020019250505060206040518083038186803b1580156113b257600080fd5b505af41580156113c6573d6000803e3d6000fd5b505050506040513d60208110156113dc57600080fd5b81019080805190602001909291905050509050919050565b6000600560149054906101000a900460ff161515156114a1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260288152602001807f63616c6c61626c65207768656e2074686520636f6e7472616374206973206e6f81526020017f742070617573656400000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b6114ab8383612922565b905092915050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611625576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a8152602001807f63616c6c656420627920616e79206163636f756e74206f74686572207468616e81526020017f20746865206f776e65720000000000000000000000000000000000000000000081525060400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515156116ca576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f6f776e657220616464726573732073686f756c64206e6f74203000000000000081525060200191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600081600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b600073bab79f5f0d136db78e5df967a48006f1d5360032634c5e1cae6000866040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060206040518083038186803b15801561191e57600080fd5b505af4158015611932573d6000803e3d6000fd5b505050506040513d602081101561194857600080fd5b810190808051906020019092919050505082111515156119d0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260128152602001807f62616c616e6365206e6f7420656e6f756768000000000000000000000000000081525060200191505060405180910390fd5b600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515611ac4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260128152602001807f62616c616e6365206e6f7420656e6f756768000000000000000000000000000081525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515611b69576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f302061646472657373206e6f7420616c6c6f770000000000000000000000000081525060200191505060405180910390fd5b73bab79f5f0d136db78e5df967a48006f1d536003263ab517b4f600086611c738673bab79f5f0d136db78e5df967a48006f1d5360032634c5e1cae60008c6040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060206040518083038186803b158015611c2a57600080fd5b505af4158015611c3e573d6000803e3d6000fd5b505050506040513d6020811015611c5457600080fd5b8101908080519060200190929190505050612b1e90919063ffffffff16565b6040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001935050505060206040518083038186803b158015611cfd57600080fd5b505af4158015611d11573d6000803e3d6000fd5b505050506040513d6020811015611d2757600080fd5b81019080805190602001909291905050505073bab79f5f0d136db78e5df967a48006f1d536003263ab517b4f600085611e438673bab79f5f0d136db78e5df967a48006f1d5360032634c5e1cae60008b6040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060206040518083038186803b158015611dfa57600080fd5b505af4158015611e0e573d6000803e3d6000fd5b505050506040513d6020811015611e2457600080fd5b8101908080519060200190929190505050612b3790919063ffffffff16565b6040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001935050505060206040518083038186803b158015611ecd57600080fd5b505af4158015611ee1573d6000803e3d6000fd5b505050506040513d6020811015611ef757600080fd5b810190808051906020019092919050505050611f9882600460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612b1e90919063ffffffff16565b600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600080600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050808310151561219a576000600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061222e565b6121ad8382612b1e90919063ffffffff16565b600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b600073bab79f5f0d136db78e5df967a48006f1d5360032634c5e1cae6000336040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060206040518083038186803b1580156123bc57600080fd5b505af41580156123d0573d6000803e3d6000fd5b505050506040513d60208110156123e657600080fd5b8101908080519060200190929190505050821115151561246e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f6e6f7420656e6f7567682062616c616e6365730000000000000000000000000081525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515612513576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f302061646472657373206e6f7420616c6c6f770000000000000000000000000081525060200191505060405180910390fd5b73bab79f5f0d136db78e5df967a48006f1d536003263ab517b4f60003361261d8673bab79f5f0d136db78e5df967a48006f1d5360032634c5e1cae6000336040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060206040518083038186803b1580156125d457600080fd5b505af41580156125e8573d6000803e3d6000fd5b505050506040513d60208110156125fe57600080fd5b8101908080519060200190929190505050612b1e90919063ffffffff16565b6040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001935050505060206040518083038186803b1580156126a757600080fd5b505af41580156126bb573d6000803e3d6000fd5b505050506040513d60208110156126d157600080fd5b81019080805190602001909291905050505073bab79f5f0d136db78e5df967a48006f1d536003263ab517b4f6000856127ed8673bab79f5f0d136db78e5df967a48006f1d5360032634c5e1cae60008b6040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060206040518083038186803b1580156127a457600080fd5b505af41580156127b8573d6000803e3d6000fd5b505050506040513d60208110156127ce57600080fd5b8101908080519060200190929190505050612b3790919063ffffffff16565b6040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001935050505060206040518083038186803b15801561287757600080fd5b505af415801561288b573d6000803e3d6000fd5b505050506040513d60208110156128a157600080fd5b8101908080519060200190929190505050508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b60006129b382600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612b3790919063ffffffff16565b600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000828211151515612b2c57fe5b818303905092915050565b60008183019050828110151515612b4a57fe5b809050929150505600a165627a7a7230582092e657485de4860937d530e1dd266cbb89b3c5b7f6be05431dee37e7120331cc0029 -a localhost:8026

执行结果如下:

 account: 0x2491daa1d3df8a0b84027eb75db328f1300557f1, transaction nonce: 4
 transaction sent successfully
 {
         "Hash": "0x2102f7fc21038c875bde5a98b32084e232c7249093f33e4a21c49bb7017f4e75",
         "Data": {
                 "Type": 0,
                 "From": "0x2491daa1d3df8a0b84027eb75db328f1300557f1",
                 "To": "0x0000000000000000000000000000000000000000",
                 "Amount": 0,
                 "AccountNonce": 4,
                 "GasPrice": 10,
                 "GasLimit": 200000000,
                 "Timestamp": 0,
                 "Payload": "0x6080604052600060056
                 ...
                 e4860937d530e1dd266cbb89b3c5b7f6be05431dee37e7120331cc0029"
        },
        "Signature": {
                "Sig": "GYWXGK03gZEy32mA4MfiOlnfWoAAGpH2fLbYx84hoeIFsQ9l27Bt9Jb4nUiN7dmfN3Kwq1qm7fTaGRQb4S+BKQE="
        }

查询receipt:

./client getreceipt --hash 0x2102f7fc21038c875bde5a98b32084e232c7249093f33e4a21c49bb7017f4e75 -a localhost:8026

查询结果:

{
        "contract": "0x8e7e21c581652b6522bd855b9e9471e237370012",
        "failed": false,
        "poststate": "0x3525f59a4df7eb0aa992b3e843fdc0a6cad228738c114316df513b1c1679d445",
        "result": "0x60806040526004361061011d576000357c
        ...
        0e1dd266cbb89b3c5b7f6be05431dee37e7120331cc0029",
                "totalFee": 31897240,
                "txhash": "0x2102f7fc21038c875bde5a98b32084e232c7249093f33e4a21c49bb7017f4e75",
                "usedGas": 3189724
        }

可以看到查询结果failed为false,表明合约部署成功,合约地址0x8e7e21c581652b6522bd855b9e9471e237370012。

Last updated