百度区块链引擎BBE

    获取合约详情

    获取合约详情

    接口描述 获取已部署合约详情。

    权限说明 请求发起人需要具有合法的AccessKeyID和SecretAccessKey才能发起请求。

    注意事项 如果请求中没有用户验证信息(即匿名访问),返回403 Forbidden,错误信息:AccessDenied

    请求(Request)

    • 请求语法

      GET /v1/quorum/contract?consortiumUuid={ConsortiumUuid}&orgUuid={OrgUuid}&contractUuid={ContractUuid} HTTP/1.1
      Host: bbe.bj.baidubce.com
      x-bce-date: <x-bce-date>
      x-bce-request-id: <x-bce-request-id>
      Authorization: <Authorization>
    • 请求头域 除公共头域外,无其它特殊头域。
    • 请求参数

      名称 类型 位置 描述 是否必须
      consortiumUuid String Query参数 联盟Uuid 必须
      orgUuid String Query参数 组织Uuid 必须
      contractUuid String Query参数 合约Uuid 必须

    响应(Response)

    • 响应头域 除公共头域外,无其它特殊头域。
    • 响应参数

      名称 类型 描述
      contractUuid String 合约Uuid
      consortiumUuid String 联盟Uuid
      orgUuid String 组织Uuid
      name String 合约名称
      description String 合约描述
      type String 合约类型,platform为平台基础库合约,user为用户自定义合约
      status String 合约状态,包含None Deployed、Deployed、Deploying和Deployment Failed四种,分别为未部署、运行中,部署中,部署失败
      ownerAddress String 合约发布者地址
      isPrivate Bool 是否为私有合约
      privateFor Array 私钥合约交易地址
      createdTime String 创建时间
      updatedTime String 更新时间
      address String 合约地址
      abi String 合约abi
      sourceCode Object 合约源代码

      失败响应参考错误码部分。

    示例

    • 请求示例

      GET /v1/quorum/contract?orgUuid=988ba131-e04b-8111-b44f-fb35b8dc80e6&contractUuid=3f90151d-a416-4ca5-99df-dcecf5bfb09e&consortiumUuid=cb73ac79-62bc-6070-aadc-24a05eaf55ae HTTP/1.1
      Host: bbe.bj.baidubce.com
      x-bce-date: 2019-10-23T06:26:02Z
      x-bce-request-id: b9485394-c7dc-3cfa-d454-57c34773d08c
      Authorization: bce-auth-v1/98cdcde27d8e464d895222fd8023a029/2019-10-23T06:26:02Z/1800/host/1e88313cae40a47550bdf0e3bfa591c06e4443c1ed690d510032e084676b00f8
    • 响应示例

      200
      Content-Length: 2652
      Content-Type: application/json; charset=utf-8
      Date: Wed, 23 Oct 2019 06:26:02 GMT
      	{
      	"success": true,
      	"result": {
      		"contractUuid": "3f90151d-a416-4ca5-99df-dcecf5bfb09e",
      		"consortiumUuid": "cb73ac79-62bc-6070-aadc-24a05eaf55ae",
      		"orgUuid": "988ba131-e04b-8111-b44f-fb35b8dc80e6",
      		"name": ":Simple",
      		"description": ":Simple",
      		"type": "user",
      		"status": "Deployed",
      		"ownerAddress": "0x4345d073d9e947fb148802b25c7b6d996bac11a1",
      		"isPrivate": true,
      		"privateFor": [
      			"1wXBgBiyXxaqw/lhlt2om/IdRPNmmiWJvrVDi38ojw0=",
      			"gQTX2Tam6aM9/7o+b3ttE+YaTkudJpBVR9T8+/PkBC4="
      		],
      		"createdTime": "2019-10-29T16:05:53+08:00",
      		"updatedTime": "2019-10-29T16:05:53+08:00",
      		"address": "0x46331570c943501915c88ced7a33d979bcb36572",
      		"abi": "[{\"constant\":false,\"inputs\":[{\"name\":\"i\",\"type\":\"int64\"},{\"name\":\"s\",\"type\":\"string\"}],\"name\":\"set\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"storedS\",\"outputs\":[{\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"get\",\"outputs\":[{\"name\":\"i\",\"type\":\"int64\"},{\"name\":\"s\",\"type\":\"string\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"storedI\",\"outputs\":[{\"name\":\"\",\"type\":\"int64\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"i\",\"type\":\"int64\"},{\"indexed\":true,\"name\":\"s\",\"type\":\"string\"},{\"indexed\":false,\"name\":\"h\",\"type\":\"bytes32\"},{\"indexed\":false,\"name\":\"m\",\"type\":\"string\"}],\"name\":\"ChangeEvent\",\"type\":\"event\"}]",
      		"sourceCode": {
      			":Simple": "pragma solidity >=0.4.24;\n/**\n  * @title Simple Storage with events\n  * @dev Read and write values to the chain\n  */\ncontract Simple {\n  int64 public storedI;\n  string public storedS;\n\n  event ChangeEvent (\n    address indexed from,\n    int64 indexed i,\n    string indexed s,\n    bytes32 h,\n    string m\n  );\n\n\n  /**\n    * @dev Set the value\n    * @param i The new value integer\n    * @param s The new value string\n    */\n  function set(int64 i, string memory s) public {\n    storedI = i;\n    storedS = s;\n    emit ChangeEvent(msg.sender, i, s, keccak256(bytes(s)), s);\n  }\n\n  /**\n    * @dev Get the value\n    */\n  function get() public view returns (int64 i, string memory s) {\n    return (storedI, storedS);\n  }\n\n}"
      		}
      	},
      	"code": ""
      }
    上一篇
    获取合约列表
    下一篇
    销毁合约