智能合约

在部署智能合约前,您需要先编译智能合约,编译地址

如何部署智能合约实例

  1. 选择需要部署合约实例的区块链并点击管理 链列表
  2. 选择合约页面 部署按钮
  3. 点击"部署合约实例"
  4. 填写所有内容
  5. 实例名称,实例名称可谓中英文字符或数字
  6. 管理员密码,您创建此区块链时设置的管理员密码
  7. 合约接口,你部署合约的接口 此处提供一个示例合约

[{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"balanceOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"receiver","type":"address"},{"name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"name":"sufficient","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"baseUnit","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"inputs":[{"name":"_symbol","type":"string"},{"name":"_name","type":"string"},{"name":"_baseUnit","type":"uint256"},{"name":"supply","type":"uint256"}],"payable":false,"type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_from","type":"address"},{"indexed":true,"name":"_to","type":"address"},{"indexed":false,"name":"_value","type":"uint256"}],"name":"Transfer","type":"event"}]

  • 初始化参数

示例

"欧元", "欧盟货币",1,2333333

  • 合约代码

示例 6060604052341561000c57fe5b6040516107c83803806107c8833981016040528080518201919060200180518201919060200180519060200190919080519060200190919050505b80600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555083600090805190602001906100a1929190610112565b5082600190805190602001906100b8929190610112565b50816002819055508060048190555033600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b505050506101b7565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061015357805160ff1916838001178555610181565b82800160010185558215610181579182015b82811115610180578251825591602001919060010190610165565b5b50905061018e9190610192565b5090565b6101b491905b808211156101b0576000816000905550600101610198565b5090565b90565b610602806101c66000396000f30060606040523615610081576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde031461008357806318160ddd1461011c57806370a08231146101425780638da5cb5b1461018c57806395d89b41146101de578063a9059cbb14610277578063c2930f91146102ce575bfe5b341561008b57fe5b6100936102f4565b60405180806020018281038252838181518152602001915080519060200190808383600083146100e2575b8051825260208311156100e2576020820191506020810190506020830392506100be565b505050905090810190601f16801561010e5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561012457fe5b61012c610392565b6040518082815260200191505060405180910390f35b341561014a57fe5b610176600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610398565b6040518082815260200191505060405180910390f35b341561019457fe5b61019c6103b0565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156101e657fe5b6101ee6103d6565b604051808060200182810382528381815181526020019150805190602001908083836000831461023d575b80518252602083111561023d57602082019150602081019050602083039250610219565b505050905090810190601f1680156102695780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561027f57fe5b6102b4600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610474565b604051808215151515815260200191505060405180910390f35b34156102d657fe5b6102de6105d0565b6040518082815260200191505060405180910390f35b60018054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561038a5780601f1061035f5761010080835404028352916020019161038a565b820191906000526020600020905b81548152906001019060200180831161036d57829003601f168201915b505050505081565b60045481565b60056020528060005260406000206000915090505481565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561046c5780601f106104415761010080835404028352916020019161046c565b820191906000526020600020905b81548152906001019060200180831161044f57829003601f168201915b505050505081565b600081600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410156104c657600090506105ca565b81600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190505b92915050565b600254815600a165627a7a723058202e2924566c383e7379814ceca339772dd4508aca4e9a910d5385f21fda9e55d0002

  1. 点击部署合约
  2. 合约实例部署成功

部署成功界面

如何调用智能合约

  1. 选择合约实例并点击调用
  2. 填写所有内容
  3. 管理员密码,创建链时输入的管理员密码
  4. 合约接口,参考部署合约实例时的示例合约接口
  5. 合约方法, 示例合约中提供以下调用方法

read:

查询资产符号: `symbol()`

查询资产名称:`name()`

查询基本单位:`baseUint()`

查询发行人:`owner()`

查询自查总量:`totalSupply()`

查询某地址余额:`balanceOf("0xaf48a3036640529c2b5202c0680657c9542913b5")`

call:

将发行人资产的部分数目转到另一个账户地址:
`transfer("0xaf48a3036640529c2b5202c0680657c9542913b5", 666)`
  1. 点击调用合约
  2. 返回调用结果 调用结果界面

    如何查询智能合约

    1. 选择合约实例并点击查询
    2. 填写所有内容
    3. 管理员密码,创建链时输入的管理员密码
    4. 创建链时返回的管理员私钥
    5. 合约接口参考部署合约实例时的示例合约接口
    6. 合约方法,参考调用合约的调用方法
    7. 调用参数,参考调用合约的参数
  3. 点击查询合约

  4. 获取查询结果