区块链服务 BCS-合约示例

时间:2024-07-01 09:12:16

合约示例

  1. 进入在线编译器 https://remix.ethereum.org
  2. 创建solidity合约文件,并粘贴示例合约。

    pragma solidity ^0.4.26;
    contract SimpleStorage {
        uint storedData;
        function set(uint x) public {
            storedData = x;
        }
        function get() public view returns (uint) {
            return storedData;
        }
    }

  3. 编译solidity合约,并复制bytecode结构体中的object值为合约字节码。

    {
    "linkReferences": {},
    "object":"***",
    "opcodes": "****",
    "sourceMap": "****"
    }

support.huaweicloud.com/devg-bcs/bcs_devg_01_058.html