接口说明

1 区块链管理模块

1.1 新增链信息

1.1.1 传输协议规范

  • 网络传输协议:使用HTTP协议
  • 请求地址: /chain/new
  • 请求方式:POST
  • 请求头:Content-type: application/json
  • 返回格式:JSON

1.1.2 请求参数

1)入参表

序号输入参数类型可为空备注
1chainIdint链编号
2chainNamestring链名称
3chainTypeint链类型(0-非国密,1-国密)
4descriptionstring备注

2)入参示例

  1. http://127.0.0.1:5005/WeBASE-Chain-Manager/chain/new
  1. {
  2. "chainId": 100001,
  3. "chainName": "链一",
  4. "chainType": 0,
  5. "description": "test"
  6. }

1.1.3 返回参数

1)出参表

序号输出参数类型备注
1codeInt返回码,0:成功 其它:失败
2messageString描述
3Object节点信息对象
3.1chainIdint链编号
3.2chainNamestring链名称
3.3chainTypeint链类型(0-非国密,1-国密)
3.4descriptionstring备注
3.5createTimeLocalDateTime落库时间
3.6modifyTimeLocalDateTime修改时间

2)出参示例

  • 成功:
  1. {
  2. "code": 0,
  3. "message": "success",
  4. "data": {
  5. "chainId": 100001,
  6. "chainName": "链一",
  7. "chainType": 0,
  8. "description": "test"
  9. "createTime": "2019-02-14 17:47:00",
  10. "modifyTime": "2019-03-15 11:14:29"
  11. }
  12. }
  • 失败:
  1. {
  2. "code": 102000,
  3. "message": "system exception",
  4. "data": {}
  5. }

1.2 获取所有链列表

1.2.1 传输协议规范

  • 网络传输协议:使用HTTP协议
  • 请求地址:/chain/all
  • 请求方式:GET
  • 返回格式:JSON

1.2.2 请求参数

1)入参表

2)入参示例

  1. http://127.0.0.1:5005/WeBASE-Chain-Manager/chain/all

1.2.3 返回参数

1)出参表

序号输出参数类型备注
1codeInt返回码,0:成功 其它:失败
2messageString描述
3totalCountInt总记录数
4dataList组织列表
4.1Object节点信息对象
4.1.1chainIdint链编号
4.1.2chainNamestring链名称
4.1.3chainTypeint链类型(0-非国密,1-国密)
4.1.4descriptionstring备注
4.1.5createTimeLocalDateTime落库时间
4.1.6modifyTimeLocalDateTime修改时间

2)出参示例

  • 成功:
  1. {
  2. "code": 0,
  3. "message": "success",
  4. "data": [
  5. {
  6. "chainId": 100001,
  7. "chainName": "链一",
  8. "chainType": 0,
  9. "description": "test"
  10. "createTime": "2019-02-14 17:47:00",
  11. "modifyTime": "2019-03-15 11:14:29"
  12. }
  13. ],
  14. "totalCount": 1
  15. }
  • 失败:
  1. {
  2. "code": 102000,
  3. "message": "system exception",
  4. "data": {}
  5. }

1.3 删除链信息

1.3.1 传输协议规范

  • 网络传输协议:使用HTTP协议
  • 请求地址:/chain/{chainId}
  • 请求方式:DELETE
  • 请求头:Content-type: application/json
  • 返回格式:JSON

1.3.2 请求参数

1)入参表

序号输入参数类型可为空备注
1chainIdint链编号

2)入参示例

  1. http://127.0.0.1:5005/WeBASE-Chain-Manager/chain/100001

1.3.3 返回参数

1)出参表

序号输出参数类型备注
1codeInt返回码,0:成功 其它:失败
2messageString描述
3dataobject返回信息实体(空)

2)出参示例

  • 成功:
  1. {
  2. "code": 0,
  3. "data": {},
  4. "message": "success"
  5. }
  • 失败:
  1. {
  2. "code": 102000,
  3. "message": "system exception",
  4. "data": {}
  5. }

2 前置管理模块

2.1 新增节点前置信息

2.1.1 传输协议规范

  • 网络传输协议:使用HTTP协议
  • 请求地址: /front/new
  • 请求方式:POST
  • 请求头:Content-type: application/json
  • 返回格式:JSON

2.1.2 请求参数

1)入参表

序号输入参数类型可为空备注
1chainIdint链编号
2frontIpstring前置ip
3frontPortint前置服务端口
4agencystring所属机构
5descriptionstring备注

2)入参示例

  1. http://127.0.0.1:5005/WeBASE-Chain-Manager/front/new
  1. {
  2. "chainId": 100001,
  3. "frontIp": "127.0.0.1",
  4. "frontPort": 5002,
  5. "agency": "abc",
  6. "description": "test"
  7. }

2.1.3 返回参数

1)出参表

序号输出参数类型备注
1codeInt返回码,0:成功 其它:失败
2messageString描述
3Object节点信息对象
3.1frontIdint前置编号
3.2chainIdint链编号
3.3nodeIdstring前置对应的节点编号
3.4frontIpstring前置ip
3.5frontPortint前置端口
3.6agencystring所属机构
3.7descriptionstring备注
3.8createTimeLocalDateTime落库时间
3.9modifyTimeLocalDateTime修改时间

2)出参示例

  • 成功:
  1. {
  2. "code": 0,
  3. "message": "success",
  4. "data": {
  5. "frontId": 200001,
  6. "chainId": 100001,
  7. "nodeId": "78e467957af3d0f77e19b952a740ba8c53ac76913df7dbd48d7a0fe27f4c902b55e8543e1c4f65b4a61695c3b490a5e8584149809f66e9ffc8c05b427e9d3ca2",
  8. "frontIp": "127.0.0.1",
  9. "frontPort": 5002,
  10. "agency": "aa",
  11. "description": "test"
  12. "createTime": "2019-02-14 17:47:00",
  13. "modifyTime": "2019-03-15 11:14:29"
  14. }
  15. }
  • 失败:
  1. {
  2. "code": 102000,
  3. "message": "system exception",
  4. "data": {}
  5. }

2.2 获取所有前置列表

2.2.1 传输协议规范

  • 网络传输协议:使用HTTP协议
  • 请求地址:/front/find?chainId={chainId}?frontId={frontId}&groupId={groupId}
  • 请求方式:GET
  • 返回格式:JSON

2.2.2 请求参数

1)入参表

序号输入参数类型可为空备注
1chainIdInt链编号
2frontIdInt前置编号
3groupIdInt所属群组编号

2)入参示例

  1. http://127.0.0.1:5005/WeBASE-Chain-Manager/front/find

2.2.3 返回参数

1)出参表

序号输出参数类型备注
1codeInt返回码,0:成功 其它:失败
2messageString描述
3totalCountInt总记录数
4dataList组织列表
4.1Object节点信息对象
4.1.1frontIdint前置编号
4.1.2chainIdint链编号
4.1.3nodeIdstring前置对应的节点编号
4.1.4frontIpstring前置ip
4.1.5frontPortint前置端口
4.1.6agencystring所属机构
4.1.7descriptionstring备注
4.1.8createTimeLocalDateTime落库时间
4.1.9modifyTimeLocalDateTime修改时间

2)出参示例

  • 成功:
  1. {
  2. "code": 0,
  3. "message": "success",
  4. "data": [
  5. {
  6. "frontId": 200001,
  7. "chainId": 100001,
  8. "nodeId": "78e467957af3d0f77e19b952a740ba8c53ac76913df7dbd48d7a0fe27f4c902b55e8543e1c4f65b4a61695c3b490a5e8584149809f66e9ffc8c05b427e9d3ca2",
  9. "frontIp": "127.0.0.1",
  10. "frontPort": 5002,
  11. "agency": "aa",
  12. "description": "test"
  13. "createTime": "2019-06-04 20:49:42",
  14. "modifyTime": "2019-06-04 20:49:42"
  15. }
  16. ],
  17. "totalCount": 1
  18. }
  • 失败:
  1. {
  2. "code": 102000,
  3. "message": "system exception",
  4. "data": {}
  5. }

2.3 删除前置信息

2.3.1 传输协议规范

  • 网络传输协议:使用HTTP协议
  • 请求地址:/front/{frontId}
  • 请求方式:DELETE
  • 请求头:Content-type: application/json
  • 返回格式:JSON

2.3.2 请求参数

1)入参表

序号输入参数类型可为空备注
1frontIdint前置编号

2)入参示例

  1. http://127.0.0.1:5005/WeBASE-Chain-Manager/front/200001

2.3.3 返回参数

1)出参表

序号输出参数类型备注
1codeInt返回码,0:成功 其它:失败
2messageString描述
3dataobject返回信息实体(空)

2)出参示例

  • 成功:
  1. {
  2. "code": 0,
  3. "data": {},
  4. "message": "success"
  5. }
  • 失败:
  1. {
  2. "code": 102000,
  3. "message": "system exception",
  4. "data": {}
  5. }

2.4 前置节点监控信息

2.4.1 传输协议规范

  • 网络传输协议:使用HTTP协议

  • 请求地址:

    1. /mointorInfo/{frontId}?beginDate={beginDate}&endDate={endDate}&contrastBeginDate={contrastBeginDate}&contrastEndDate={contrastEndDate}&gap={gap}&groupId={groupId}
  • 请求方式:GET

  • 请求头:Content-type: application/json

  • 返回格式:JSON

2.4.2 请求参数

1)入参表

序号输入参数类型可为空备注
1frontIdint前置编号
2beginDateLocalDateTime显示时间(开始) yyyy-MM-dd’T’HH:mm:ss.SSS 2019-03-13T00:00:00
3endDateLocalDateTime显示时间(结束)
4contrastBeginDateLocalDateTime对比时间(开始)
5contrastEndDateLocalDateTime对比时间(结束)
6gapInt数据粒度,默认1
7groupIdint群组编号,默认1

2)入参示例

  1. http://127.0.0.1:5005/WeBASE-Chain-Manager/front/mointorInfo/200001?beginDate=2019-03-13T00:00:00&endDate=2019-03-13T14:34:22&contrastBeginDate=2019-03-13T00:00:00&contrastEndDate=2019-03-13T14:34:22&gap=60&groupId=1

2.4.3 返回参数

1)出参表

序号输出参数类型备注
1codeInt返回码
2messageString描述信息
3dataArray返回信息列表
3.1Object返回信息实体
3.1.1metricTypeString测量类型:blockHeight(块高)、pbftView(pbft视图)、pendingCount(待处理交易数量)
3.1.2dataObject
3.1.2.1lineDataListObject指定时间的数据
3.1.2.1.1timestampListList\<String>时间戳列表
3.1.2.1.2valueListList\<Integer>值列表
3.1.2.2contrastDataListObject比对时间的数据
3.1.2.2.1timestampListList\<String>时间戳列表
3.1.2.2.2valueListList\<Integer>值列表

2)出参示例

  • 成功:
  1. {
  2. "code": 0,
  3. "message": "success",
  4. "data": [
  5. {
  6. "metricType": "blockHeight",
  7. "data": {
  8. "lineDataList": {
  9. "timestampList": [
  10. 1552406401042,
  11. 1552406701001
  12. ],
  13. "valueList": [
  14. 747309,
  15. 747309
  16. ]
  17. },
  18. "contrastDataList": {
  19. "timestampList": [
  20. 1552320005000,
  21. 1552320301001
  22. ],
  23. "valueList": [
  24. null,
  25. 747309
  26. ]
  27. }
  28. }
  29. },
  30. {
  31. "metricType": "pbftView",
  32. "data": {
  33. "lineDataList": {
  34. "timestampList": null,
  35. "valueList": [
  36. 118457,
  37. 157604
  38. ]
  39. },
  40. "contrastDataList": {
  41. "timestampList": null,
  42. "valueList": [
  43. null,
  44. 33298
  45. ]
  46. }
  47. }
  48. }
  49. ]
  50. }
  • 失败:
  1. {
  2. "code": 102000,
  3. "message": "system exception",
  4. "data": {}
  5. }

2.5 前置节点服务器监控信息

2.5.1 传输协议规范

  • 网络传输协议:使用HTTP协议
  • 请求地址:
  1. /front/ratio/{frontId}?gap={gap}&beginDate={beginDate}&endDate={endDate}&contrastBeginDate={contrastBeginDate}&contrastEndDate={contrastEndDate}
  • 请求方式:GET
  • 返回格式:JSON

2.5.2 请求参数

1)入参表

序号输入参数类型可为空备注
1frontIdint前置编号
2beginDateLocalDateTime显示时间(开始) yyyy-MM-dd’T’HH:mm:ss.SSS 2019-03-13T00:00:00
3endDateLocalDateTime显示时间(结束)
4contrastBeginDateLocalDateTime对比时间(开始)
5contrastEndDateLocalDateTime对比时间(结束)
6gapInt数据粒度,默认1

2)入参示例

  1. http://127.0.0.1:5005/WeBASE-Chain-Manager/front/ratio/200001?gap=1&beginDate=2019-03-15T00:00:00&endDate=2019-03-15T15:26:55&contrastBeginDate=2019-03-15T00:00:00&contrastEndDate=2019-03-15T15:26:55

2.5.3 返回参数

1)出参表

序号输出参数类型备注
1codeInt返回码
2messageString描述信息
3dataArray返回信息列表
3.1Object返回信息实体
3.1.1metricTypeString测量类型: cpu(cpu利用率:%)、memory(内存利用率:%)、disk(硬盘利用率:%)、txbps(上行bandwith:KB/s)、rxbps(下行bandwith:KB/s)
3.1.2dataObject
3.1.2.1lineDataListObject指定时间的数据
3.1.2.1.1timestampListList\<String>时间戳列表
3.1.2.1.2valueListList\<Integer>值列表
3.1.2.2contrastDataListObject比对时间的数据
3.1.2.2.1timestampListList\<String>时间戳列表
3.1.2.2.2valueListList\<Integer>值列表

2)出参示例

  • 成功:
  1. {
  2. "code": 0,
  3. "message": "success",
  4. "data": [
  5. {
  6. "metricType": "txbps",
  7. "data": {
  8. "lineDataList": {
  9. "timestampList": [
  10. 1552406401042,
  11. 1552406701001
  12. ],
  13. "valueList": [
  14. 12.24,
  15. 54.48
  16. ]
  17. },
  18. "contrastDataList": {
  19. "timestampList": [
  20. 1552320005000,
  21. 1552320301001
  22. ],
  23. "valueList": [
  24. 22.24,
  25. 24.48
  26. ]
  27. }
  28. }
  29. },
  30. {
  31. "metricType": "cpu",
  32. "data": {
  33. "lineDataList": {
  34. "timestampList": null,
  35. "valueList": [
  36. 118457,
  37. 157604
  38. ]
  39. },
  40. "contrastDataList": {
  41. "timestampList": null,
  42. "valueList": [
  43. null,
  44. 33298
  45. ]
  46. }
  47. }
  48. }
  49. ]
  50. }
  • 失败:
  1. {
  2. "code": 102000,
  3. "message": "system exception",
  4. "data": {}
  5. }

2.6 前置节点服务器配置信息

2.6.1 传输协议规范

  • 网络传输协议:使用HTTP协议
  • 请求地址:/front/config/{frontId}
  • 请求方式:GET
  • 返回格式:JSON

2.6.2 请求参数

1)入参表

序号输入参数类型可为空备注
1frontIdint前置编号

2)入参示例

  1. http://127.0.0.1:5005/WeBASE-Chain-Manager/front/config/200001

2.6.3 返回参数

1)出参表

序号输出参数类型备注
1codeint返回码
2messageString描述信息
3dataArray返回信息列表
3.1Object返回信息实体
3.1.1ipStringip地址
3.1.2memoryTotalSizeString内存总量(单位:KB)
3.1.3memoryUsedSizeString当前内存使用量(单位:KB)
3.1.4cpuSizeStringCPU的大小(单位:MHz)
3.1.5cpuAmountStringCPU的核数(单位:个)
3.1.6diskTotalSizeString文件系统总量(单位:KB)
3.1.7diskUsedSizeString文件系统已使用量(单位:KB)

2)出参示例

  • 成功:
  1. {
  2. "code": 0,
  3. "message": "success",
  4. "data": {
  5. "memoryTotalSize": "8010916",
  6. "cpuAmount": "4",
  7. "memoryUsedSize": "7674492",
  8. "cpuSize": "2599",
  9. "ip": "127.0.0.1",
  10. "diskUsedSize": "306380076",
  11. "diskTotalSize": "515928320"
  12. }
  13. }
  • 失败:
  1. {
  2. "code": 102000,
  3. "message": "system exception",
  4. "data": {}
  5. }

2.7 检查前置节点进程是否存活

2.7.1 传输协议规范

  • 网络传输协议:使用HTTP协议
  • 请求地址:/front/checkNodeProcess/{frontId}
  • 请求方式:GET
  • 返回格式:JSON

2.7.2 请求参数

1)入参表

序号输入参数类型可为空备注
1frontIdInt前置编号

2)入参示例

  1. http://127.0.0.1:5005/WeBASE-Chain-Manager/front/checkNodeProcess/200001

2.7.3 返回参数

1)出参表

序号输出参数类型备注
1codeInt返回码
2messageString描述信息
3databooleantrue-存活;false-未存活

2)出参示例

  • 成功:
  1. {
  2. "code": 0,
  3. "message": "success",
  4. "data": true
  5. }
  • 失败:
  1. {
  2. "code": 102000,
  3. "message": "system exception",
  4. "data": {}
  5. }

2.8 获取前置节点所在群组物理大小信息

2.8.1 传输协议规范

  • 网络传输协议:使用HTTP协议
  • 请求地址:/front/getGroupSizeInfos/{frontId}
  • 请求方式:GET
  • 返回格式:JSON

2.8.2 请求参数

1)入参表

序号输入参数类型可为空备注
1frontIdInt前置编号

2)入参示例

  1. http://127.0.0.1:5005/WeBASE-Chain-Manager/front/getGroupSizeInfos/200001

2.8.3 返回参数

1)出参表

序号输出参数类型备注
1codeInt返回码
2messageString描述信息
3dataArray返回信息列表
3.1List返回信息实体
3.1.1groupIdInt群组id
3.1.2groupNameString群组名
3.1.3pathString文件路径
3.1.4sizeLong大小(单位:KB)

2)出参示例

  • 成功:
  1. {
  2. "code": 0,
  3. "message": "success",
  4. "data": [
  5. {
  6. "groupId": 31231,
  7. "groupName": "group31231",
  8. "path": "/data/app/nodes/127.0.0.1/node0/data/group31231",
  9. "size": 27085
  10. },
  11. {
  12. "groupId": 2,
  13. "groupName": "group2",
  14. "path": "/data/app/nodes/127.0.0.1/node0/data/group2",
  15. "size": 23542
  16. },
  17. {
  18. "groupId": 1,
  19. "groupName": "group1",
  20. "path": "/data/app/nodes/127.0.0.1/node0/data/group1",
  21. "size": 25077
  22. },
  23. {
  24. "groupId": 111,
  25. "groupName": "group111",
  26. "path": "/data/app/nodes/127.0.0.1/node0/data/group111",
  27. "size": 21552
  28. }
  29. ]
  30. }
  • 失败:
  1. {
  2. "code": 102000,
  3. "message": "system exception",
  4. "data": {}
  5. }

3 群组管理模块

3.1 生成新群组

​ 向单个节点请求生成新群组配置信息,节点和前置一一对应,节点编号可以从前置列表获取。适用于新群组下的节点属于不同链管理服务,每个节点都要请求一遍。群组生成后,需对应调用3.3的启动。

3.1.1 传输协议规范

  • 网络传输协议:使用HTTP协议
  • 请求地址: /group/generate/{nodeId}
  • 请求方式:POST
  • 请求头:Content-type: application/json
  • 返回格式:JSON

3.1.2 请求参数

1)入参表

序号输入参数类型可为空备注
1chainIdint链编号
2generateGroupIdint生成的群组编号
3timestampBigInteger创世块时间(单位:ms)
4nodeListList节点编号列表(新群组的所有节点编号)
5descriptionstring备注

2)入参示例

  1. http://127.0.0.1:5005/WeBASE-Chain-Manager/group/generate/78e467957af3d0f77e19b952a740ba8c53ac76913df7dbd48d7a0fe27f4c902b55e8543e1c4f65b4a61695c3b490a5e8584149809f66e9ffc8c05b427e9d3ca2
  1. {
  2. "chainId": 100001,
  3. "generateGroupId": 2,
  4. "timestamp": 1574853659000,
  5. "nodeList": [
  6. "78e467957af3d0f77e19b952a740ba8c53ac76913df7dbd48d7a0fe27f4c902b55e8543e1c4f65b4a61695c3b490a5e8584149809f66e9ffc8c05b427e9d3ca2"
  7. ],
  8. "description": "description"
  9. }

3.1.3 返回参数

1)出参表

序号输出参数类型备注
1codeInt返回码,0:成功 其它:失败
2messageString描述
3dataObject组织信息对象
3.1groupIdint群组编号
3.2chainIdint链编号
3.3groupNameString群组名称
3.4nodeCountint节点数量
3.5descriptionString描述
3.6createTimeLocalDateTime落库时间
3.7modifyTimeLocalDateTime修改时间

2)出参示例

  • 成功:
  1. {
  2. "code": 0,
  3. "message": "success",
  4. "data": {
  5. "groupId": 2,
  6. "chainId": 100001,
  7. "groupName": "group2",
  8. "nodeCount": 1,
  9. "description": "test",
  10. "createTime": "2019-02-14 17:33:50",
  11. "modifyTime": "2019-03-15 09:36:17"
  12. }
  13. }
  • 失败:
  1. {
  2. "code": 102000,
  3. "message": "system exception",
  4. "data": {}
  5. }

3.2 批量生成新群组

​ 向新群组下所有节点请求生成新群组配置信息,节点和前置一一对应,节点编号可以从前置列表获取。适用于新群组下的节点属于同一个链管理服务(节点对应前置都要添加到链管理服务)。群组生成后,需对应调用3.4的批量启动。

3.2.1 传输协议规范

  • 网络传输协议:使用HTTP协议
  • 请求地址: /group/generate
  • 请求方式:POST
  • 请求头:Content-type: application/json
  • 返回格式:JSON

3.2.2 请求参数

1)入参表

序号输入参数类型可为空备注
1chainIdint链编号
2generateGroupIdint生成的群组编号
3timestampBigInteger创世块时间(单位:ms)
4nodeListList节点编号列表(新群组的所有节点编号)
5descriptionstring备注

2)入参示例

  1. http://127.0.0.1:5005/WeBASE-Chain-Manager/group/generate
  1. {
  2. "chainId": 100001,
  3. "generateGroupId": 2,
  4. "timestamp": 1574853659000,
  5. "nodeList": [
  6. "78e467957af3d0f77e19b952a740ba8c53ac76913df7dbd48d7a0fe27f4c902b55e8543e1c4f65b4a61695c3b490a5e8584149809f66e9ffc8c05b427e9d3ca2"
  7. ],
  8. "description": "description"
  9. }

3.2.3 返回参数

1)出参表

序号输出参数类型备注
1codeInt返回码,0:成功 其它:失败
2messageString描述
3dataObject组织信息对象
3.1groupIdint群组编号
3.2chainIdint链编号
3.3groupNameString群组名称
3.4nodeCountint节点数量
3.5descriptionString描述
3.6createTimeLocalDateTime落库时间
3.7modifyTimeLocalDateTime修改时间

2)出参示例

  • 成功:
  1. {
  2. "code": 0,
  3. "message": "success",
  4. "data": {
  5. "groupId": 2,
  6. "chainId": 100001,
  7. "groupName": "group2",
  8. "nodeCount": 1,
  9. "description": "test",
  10. "createTime": "2019-02-14 17:33:50",
  11. "modifyTime": "2019-03-15 09:36:17"
  12. }
  13. }
  • 失败:
  1. {
  2. "code": 102000,
  3. "message": "system exception",
  4. "data": {}
  5. }

3.3 动态操作群组

​ 可以对已存在的群组或新生成的群组进行动态操作,包括启动、停止、删除、恢复、状态查询。

说明: 生成新群组时,新群组下每一个节点都要启动,节点和前置一一对应。适用于新群组下的节点属于不同链管理服务,每个节点都要请求一遍进行启动。

3.3.1 传输协议规范

  • 网络传输协议:使用HTTP协议
  • 请求地址:/operate/{chainId}/{groupId}/{nodeId}/{type}
  • 请求方式:GET
  • 返回格式:JSON

3.3.2 请求参数

1)入参表

序号输入参数类型可为空备注
1chainIdint链编号
2groupIdint要操作的群组编号
3nodeIdString节点Id
4typeString操作类型:start-启动;stop-停止;remove-删除;recover-恢复;getStatus-查询状态

2)入参示例

  1. http://127.0.0.1:5005/WeBASE-Chain-Manager/group/operate/100001/2/78e467957af3d0f77e19b952a740ba8c53ac76913df7dbd48d7a0fe27f4c902b55e8543e1c4f65b4a61695c3b490a5e8584149809f66e9ffc8c05b427e9d3ca2/start

3.3.3 返回参数

1)出参表

序号输出参数类型备注
1codeInt返回码,0:成功 其它:失败
2messageString描述
3dataobject返回信息实体

2)出参示例

  • 成功:
  1. {
  2. "code": 0,
  3. "message": "success",
  4. "data": {}
  5. }
  • 失败:
  1. {
  2. "code": 205032,
  3. "message": "Group 2 is already running",
  4. "data": null
  5. }

3.4 批量启动群组

​ 节点和前置一一对应,节点编号可以从前置列表获取。适用于新群组下的节点属于同一个链管理服务(节点对应前置都要添加到链管理服务)。

3.4.1 传输协议规范

  • 网络传输协议:使用HTTP协议
  • 请求地址: /group/batchStart
  • 请求方式:POST
  • 请求头:Content-type: application/json
  • 返回格式:JSON

3.4.2 请求参数

1)入参表

序号输入参数类型可为空备注
1chainIdint链编号
2generateGroupIdint生成的群组编号
3nodeListList节点编号列表

2)入参示例

  1. http://127.0.0.1:5005/WeBASE-Chain-Manager/group/generate
  1. {
  2. "chainId": 100001,
  3. "generateGroupId": 2,
  4. "nodeList": [
  5. "78e467957af3d0f77e19b952a740ba8c53ac76913df7dbd48d7a0fe27f4c902b55e8543e1c4f65b4a61695c3b490a5e8584149809f66e9ffc8c05b427e9d3ca2"
  6. ]
  7. }

3.4.3 返回参数

1)出参表

序号输出参数类型备注
1codeInt返回码,0:成功 其它:失败
2messageString描述
3dataObject组织信息对象

2)出参示例

  • 成功:
  1. {
  2. "code": 0,
  3. "message": "success",
  4. "data": {}
  5. }
  • 失败:
  1. {
  2. "code": 102000,
  3. "message": "system exception",
  4. "data": {}
  5. }

3.5 更新群组(废弃,启动或停止后自动更新)

​ 生成新群组并启动新群组的每一个节点后,调用此接口更新群组相关信息。

3.5.1 传输协议规范

  • 网络传输协议:使用HTTP协议
  • 请求地址:/update
  • 请求方式:GET
  • 返回格式:JSON

3.5.2 请求参数

1)入参表

2)入参示例

  1. http://127.0.0.1:5005/WeBASE-Chain-Manager/group/update

3.5.3 返回参数

1)出参表

序号输出参数类型备注
1codeInt返回码,0:成功 其它:失败
2messageString描述
3dataobject返回信息实体

2)出参示例

  • 成功:
  1. {
  2. "code": 0,
  3. "message": "success",
  4. "data": {}
  5. }
  • 失败:
  1. {
  2. "code": 102000,
  3. "message": "system exception",
  4. "data": {}
  5. }

3.6 获取群组概况

3.6.1 传输协议规范

  • 网络传输协议:使用HTTP协议
  • 请求地址:/group/general/{chainId}/{groupId}
  • 请求方式:GET
  • 返回格式:JSON

3.6.2 请求参数

1)入参表

序号输入参数类型可为空备注
1chainIdint链编号
2groupIdint群组id

2)入参示例

  1. http://127.0.0.1:5005/WeBASE-Chain-Manager/group/100001/300001

3.6.3 返回参数

1)出参表

序号输出参数类型备注
1codeInt返回码,0:成功 其它:失败
2messageString描述
3dataobject返回信息实体
3.1groupIdint群组id
3.2nodeCountint节点数量

2)出参示例

  • 成功:
  1. {
  2. "code": 0,
  3. "data": {
  4. "groupId": "300001",
  5. "nodeCount": 2
  6. },
  7. "message": "success"
  8. }
  • 失败:
  1. {
  2. "code": 102000,
  3. "message": "system exception",
  4. "data": {}
  5. }

3.7 获取所有群组列表

3.7.1 传输协议规范

  • 网络传输协议:使用HTTP协议
  • 请求地址:/group/all/{chainId}
  • 请求方式:GET
  • 返回格式:JSON

3.7.2 请求参数

1)入参表

2)入参示例

  1. http://127.0.0.1:5005/WeBASE-Chain-Manager/group/all/100001

3.7.3 返回参数

1)出参表

序号输出参数类型备注
1codeInt返回码,0:成功 其它:失败
2messageString描述
3totalCountInt总记录数
4dataList组织列表
4.1Object组织信息对象
4.1.1chainIdint链编号
4.1.2groupIdint群组编号
4.1.3groupNameString群组名称
4.1.4nodeCountint节点数量
4.1.5descriptionString描述
4.1.6createTimeLocalDateTime落库时间
4.1.7modifyTimeLocalDateTime修改时间

2)出参示例

  • 成功:
  1. {
  2. "code": 0,
  3. "message": "success",
  4. "totalCount": 1,
  5. "data": [
  6. {
  7. "chainId": 100001,
  8. "groupId": 2,
  9. "groupName": "group2",
  10. "nodeCount": 1,
  11. "description": "test",
  12. "createTime": "2019-02-14 17:33:50",
  13. "modifyTime": "2019-03-15 09:36:17"
  14. }
  15. ]
  16. }
  • 失败:
  1. {
  2. "code": 102000,
  3. "message": "system exception",
  4. "data": {}
  5. }

3.8 获取群组下节点共识列表

​ 获取节点的共识列表,包含节点Id,节点共识状态。返回所有的共识/观察节点(无论运行或停止),以及正在运行的游离节点。

3.8.1 传输协议规范

  • 网络传输协议:使用HTTP协议
  • 请求地址: /group/getConsensusList/{chainId}/{groupId}/{nodeId}
  • 请求方式:GET
  • 请求头:Content-type: application/json
  • 返回格式:JSON

3.8.2 请求参数

1)入参表

序号输入参数类型可为空备注
1chainIdInt链编号
2groupIdInt群组编号
3nodeIdString节点Id,指定节点调用
4pageSizeInt条数,默认10
5pageNumberInt页码,默认1

2)入参示例

  1. http://127.0.0.1:5005/WeBASE-Chain-Manager/group/getConsensusList/1001/1/413c788ec4b55e8170815e1c61977bac8c38f2df8670d09868a6099a044c0bff7884b9c30f3fa9c331358fcbded28f8d0211e2ffc48019c9796fa05274ed89b1?pageSize=10&pageNumber=1

3.8.3 返回参数

1)出参表

序号输出参数类型备注
1codeInt返回码,0:成功 其它:失败
2messageString描述
3totalCountInt总记录数
4dataList共识列表
4.1Object共识信息对象
4.1.1nodeIdString节点编号
4.1.2nodeTypeString节点类型

2)出参示例

  • 成功:
  1. {
  2. "code": 0,
  3. "message": "success",
  4. "data": [
  5. {
  6. "nodeId": "626e1f1df03e217a7a25361444b857ec68003482aabfb24645a67111cbd96ceedc998975e158475605e38b899bc97be7283006a0171f4ec4796972ff6ad55b1a",
  7. "nodeType": "sealer"
  8. },
  9. {
  10. "nodeId": "cd3a0d965ca5e5de9edce69245db827a3a253e4868e074020c3f5fb83ca0ae884d5705940c1fc1de550874de0f02374e83eaeb5317b819e420a8ff2e07e4b84c",
  11. "nodeType": "sealer"
  12. }
  13. ],
  14. "totalCount": 2
  15. }
  • 失败:
  1. {
  2. "code": 205002,
  3. "message": "not fount any front",
  4. "data": null
  5. }

3.9 设置群组下节点共识状态

​ 可用于节点三种共识状态的切换。分别是共识节点sealer,观察节点observer,游离节点remove。

3.9.1 传输协议规范

  • 网络传输协议:使用HTTP协议
  • 请求地址: /group/setConsensusStatus
  • 请求方式:POST
  • 请求头:Content-type: application/json
  • 返回格式:JSON

3.9.2 请求参数

1)入参表

序号输入参数类型可为空备注
1chainIdInt链编号
2groupIdInt群组编号
3signUserIdStringWeBASE-Sign签名用户编号
4nodeIdString要切换状态节点Id
5nodeTypeString要设置的节点类型:observer/sealer/remove
6reqNodeIdString调用前置对应的节点Id

2)入参示例

  1. http://127.0.0.1:5005/WeBASE-Chain-Manager/group/setConsensusStatus
  1. {
  2. "signUserId": "user100001",
  3. "chainId": 1001,
  4. "groupId": 1,
  5. "nodeId": "626e1f1df03e217a7a25361444b857ec68003482aabfb24645a67111cbd96ceedc998975e158475605e38b899bc97be7283006a0171f4ec4796972ff6ad55b1a",
  6. "nodeType": "sealer",
  7. "reqNodeId": "413c788ec4b55e8170815e1c61977bac8c38f2df8670d09868a6099a044c0bff7884b9c30f3fa9c331358fcbded28f8d0211e2ffc48019c9796fa05274ed89b1"
  8. }

3.9.3 返回参数

1)出参表

序号输出参数类型备注
1codeInt返回码,0:成功 其它:失败
2messageString描述

2)出参示例

  • 成功:
  1. {
  2. "code": 0,
  3. "msg": "success"
  4. }
  • 失败:
  1. {
  2. "code": -51000,
  3. "message": "nodeId already exist"
  4. }

3.10 获取系统配置列表

​ 获取系统配置列表,目前支持tx_count_limit、tx_gas_limit两个参数。

3.10.1 传输协议规范

  • 网络传输协议:使用HTTP协议
  • 请求地址: /group/getSysConfigList/{chainId}/{groupId}/{nodeId}?pageSize={pageSize}&pageNumber={pageNumber}
  • 请求方式:GET
  • 请求头:Content-type: application/json
  • 返回格式:JSON

3.10.2 请求参数

1)入参表

序号输入参数类型可为空备注
1chainIdInt链编号
2groupIdInt群组编号
3nodeIdString节点Id,指定节点调用
4pageSizeInt条数,默认10
5pageNumberInt页码,默认1

2)入参示例

  1. http://127.0.0.1:5005/WeBASE-Chain-Manager/group/getSysConfigList/1001/1/413c788ec4b55e8170815e1c61977bac8c38f2df8670d09868a6099a044c0bff7884b9c30f3fa9c331358fcbded28f8d0211e2ffc48019c9796fa05274ed89b1?pageSize=10&pageNumber=1

3.10.3 返回参数

1)出参表

序号输出参数类型备注
1codeInt返回码,0:成功 其它:失败
2messageString描述
3totalCountInt总记录数
4dataList配置列表
4.1Object配置信息对象
4.1.1groupIdInt群组编号
4.1.2configKeyString配置项,目前支持tx_count_limit、tx_gas_limit两个参数
4.1.4configValueString配置值

2)出参示例

  • 成功:
  1. {
  2. "code": 0,
  3. "message": "success",
  4. "data": [
  5. {
  6. "groupId": 1,
  7. "configKey": "tx_count_limit",
  8. "configValue": "1000"
  9. },
  10. {
  11. "groupId": 1,
  12. "configKey": "tx_gas_limit",
  13. "configValue": "300000000"
  14. }
  15. ],
  16. "totalCount": 2
  17. }
  • 失败:
  1. {
  2. "code": 205002,
  3. "message": "not fount any front",
  4. "data": null
  5. }

3.11 设置系统配置值

​ 设置系统配置值,目前支持tx_count_limit、tx_gas_limit两个参数。

3.11.1 传输协议规范

  • 网络传输协议:使用HTTP协议
  • 请求地址: /group/setSysConfig
  • 请求方式:POST
  • 请求头:Content-type: application/json
  • 返回格式:JSON

3.11.2 请求参数

1)入参表

序号输入参数类型可为空备注
1chainIdInt链编号
2groupIdInt群组编号
3nodeIdString节点Id,指定节点调用
4signUserIdStringWeBASE-Sign签名用户编号
5configKeyString配置项,目前支持tx_count_limit、tx_gas_limit两个参数
6configValueString配置值

2)入参示例

  1. http://127.0.0.1:5005/WeBASE-Chain-Manager/group/setSysConfig
  1. {
  2. "signUserId": "user100001",
  3. "chainId": 1001,
  4. "configKey": "tx_gas_limit",
  5. "configValue": "300000000",
  6. "groupId": 1,
  7. "nodeId": "413c788ec4b55e8170815e1c61977bac8c38f2df8670d09868a6099a044c0bff7884b9c30f3fa9c331358fcbded28f8d0211e2ffc48019c9796fa05274ed89b1"
  8. }

3.11.3 返回参数

1)出参表

序号输出参数类型备注
1codeInt返回码,0:成功 其它:失败
2messageString描述

2)出参示例

  • 成功:
  1. {
  2. "code": 0,
  3. "msg": "success"
  4. }
  • 失败:
  1. {
  2. "code": 205002,
  3. "message": "not fount any front",
  4. "data": null
  5. }

3.12 获取网络统计日志数据

​ 统计日志数据存储在前置H2数据库,前置默认存储一万条,超过将不会从节点日志文件拉取新的数据。此时,获取完现有数据,可以调用3.14 删除前置统计日志数据进行删除,数据量少于一万条时,前置自动从节点日志文件拉取新的数据。

3.12.1 传输协议规范

  • 网络传输协议:使用HTTP协议
  • 请求地址:
  1. /group/charging/getNetWorkData/{chainId}/{groupId}/{nodeId}?pageSize={pageSize}&pageNumber={pageNumber}&beginDate={beginDate}&endDate={endDate}
  • 请求方式:GET
  • 请求头:Content-type: application/json
  • 返回格式:JSON

3.12.2 请求参数

1)入参表

序号输入参数类型可为空备注
1chainIdInt链编号
2groupIdInt群组编号
3nodeIdString节点Id,指定节点调用
4pageSizeInt条数,默认10
5pageNumberInt页码,默认1
6beginDateLocalDateTime开始时间(yyyy-MM-dd’T’HH:mm:ss.SSS 2019-03-13T00:00:00)
7endDateLocalDateTime结束时间

2)入参示例

  1. http://127.0.0.1:5005/WeBASE-Chain-Manager/group/group/charging/getNetWorkData/1001/1/413c788ec4b55e8170815e1c61977bac8c38f2df8670d09868a6099a044c0bff7884b9c30f3fa9c331358fcbded28f8d0211e2ffc48019c9796fa05274ed89b1?pageSize=2&pageNumber=1&beginDate=2020-03-27T10:30:04&endDate=2020-03-27T17:30:04

3.12.3 返回参数

1)出参表

序号输出参数类型备注
1codeInt返回码,0:成功 其它:失败
2messageString描述
3totalCountInt总记录数
4dataList列表
4.1Object信息对象
4.1.1idLong主键
4.1.2groupIdInt群组编号
4.1.3totalInLong总入流量(P2P_InBytes + SDK_InBytes)
4.1.4totalOutLong总出流量(P2P_OutBytes + SDK_OutBytes)
4.1.5timestampLong统计时间

2)出参示例

  • 成功:
  1. {
  2. "code": 0,
  3. "message": "success",
  4. "data": [
  5. {
  6. "id": 583,
  7. "totalIn": 53837,
  8. "totalOut": 54753,
  9. "groupId": 1,
  10. "timestamp": 1585277486000
  11. },
  12. {
  13. "id": 581,
  14. "totalIn": 55128,
  15. "totalOut": 55092,
  16. "groupId": 1,
  17. "timestamp": 1585277426000
  18. }
  19. ],
  20. "totalCount": 22
  21. }
  • 失败:
  1. {
  2. "code": 205002,
  3. "message": "not fount any front",
  4. "data": null
  5. }

3.13 获取交易Gas统计日志数据

​ 统计日志数据存储在前置H2数据库,前置默认存储一万条,超过将不会从节点日志文件拉取新的数据。此时,获取完现有数据,可以调用3.14 删除前置统计日志数据进行删除,数据量少于一万条时,前置自动从节点日志文件拉取新的数据。

3.13.1 传输协议规范

  • 网络传输协议:使用HTTP协议
  • 请求地址:
  1. /group/charging/getTxGasData/{chainId}/{groupId}/{nodeId}?pageSize={pageSize}&pageNumber={pageNumber}&beginDate={beginDate}&endDate={endDate}&transHash={transHash}
  • 请求方式:GET
  • 请求头:Content-type: application/json
  • 返回格式:JSON

3.13.2 请求参数

1)入参表

序号输入参数类型可为空备注
1chainIdInt链编号
2groupIdInt群组编号
3nodeIdString节点Id,指定节点调用
4pageSizeInt条数,默认10
5pageNumberInt页码,默认1
6beginDateLocalDateTime开始时间(yyyy-MM-dd’T’HH:mm:ss.SSS 2019-03-13T00:00:00)
7endDateLocalDateTime结束时间
8transHashString交易hash,不为空时查询指定hash

2)入参示例

  1. http://127.0.0.1:5005/WeBASE-Chain-Manager/group/group/charging/getTxGasData/1001/1/413c788ec4b55e8170815e1c61977bac8c38f2df8670d09868a6099a044c0bff7884b9c30f3fa9c331358fcbded28f8d0211e2ffc48019c9796fa05274ed89b1?pageSize=2&pageNumber=1&beginDate=2020-03-27T10:30:04&endDate=2020-03-27T17:30:04

3.13.3 返回参数

1)出参表

序号输出参数类型备注
1codeInt返回码,0:成功 其它:失败
2messageString描述
3totalCountInt总记录数
4dataList列表
4.1Object信息对象
4.1.1idLong主键
4.1.2groupIdInt群组编号
4.1.3transHashLong交易hash
4.1.4gasUsedLong交易消耗的gas
4.1.5timestampLong统计时间

2)出参示例

  • 成功:
  1. {
  2. "code": 0,
  3. "message": "success",
  4. "data": [
  5. {
  6. "id": 5,
  7. "transHash": "c5e208ec70b899529e11311f1147b1ee24ab8f02301e6cdbe8252c77a89a0d4c",
  8. "gasUsed": 34949,
  9. "groupId": 1,
  10. "timestamp": 1585277499000
  11. },
  12. {
  13. "id": 4,
  14. "transHash": "d9d7800554b68c84a53e54eef8adceecca891dd0dd7e0069a3474a81d4eac440",
  15. "gasUsed": 44892,
  16. "groupId": 1,
  17. "timestamp": 1585277489000
  18. }
  19. ],
  20. "totalCount": 5
  21. }
  • 失败:
  1. {
  2. "code": 205002,
  3. "message": "not fount any front",
  4. "data": null
  5. }

3.14 删除前置统计日志数据

​ 删除群组下统计日志数据。

3.14.1 传输协议规范

  • 网络传输协议:使用HTTP协议
  • 请求地址:/group/charging/deleteData/{chainId}/{groupId}/{nodeId}
  • 请求方式:DELETE
  • 请求头:Content-type: application/json
  • 返回格式:JSON

3.14.2 请求参数

1)入参表

序号输入参数类型可为空备注
1chainIdInt链编号
2groupIdInt群组编号
3nodeIdString节点Id,指定节点调用
4typeInt删除数据类型(1-网络统计数据;2-交易gas数据)
5keepEndDateLocalDateTime保留截止时间(yyyy-MM-dd’T’HH:mm:ss.SSS 2019-03-13T00:00:00)

2)入参示例

  1. http://127.0.0.1:5005/WeBASE-Chain-Manager/group/charging/deleteData/1001/1/413c788ec4b55e8170815e1c61977bac8c38f2df8670d09868a6099a044c0bff7884b9c30f3fa9c331358fcbded28f8d0211e2ffc48019c9796fa05274ed89b1?type=2&keepEndDate=2020-01-27T17%3A30%3A04

3.14.3 返回参数

1)出参表

序号输出参数类型备注
1codeInt返回码,0:成功 其它:失败
2messageString描述
3dataobject处理条数

2)出参示例

  • 成功:
  1. {
  2. "code": 0,
  3. "message": "success",
  4. "data": 5
  5. }
  • 失败:
  1. {
  2. "code": 102000,
  3. "message": "system exception",
  4. "data": {}
  5. }

4 节点管理模块

4.1 查询节点信息列表

4.1.1 传输协议规范

  • 网络传输协议:使用HTTP协议
  • 请求地址:/node/nodeList/{chainId}/{groupId}/{pageNumber}/{pageSize}?nodeId={nodeId}
  • 请求方式:GET
  • 返回格式:JSON

4.1.2 请求参数

1)入参表

序号输入参数类型可为空备注
1chainIdint链编号
2groupIdint群组编号
3pageSizeInt每页记录数
4pageNumberInt当前页码
5nodeIdString节点Id

2)入参示例

  1. http://127.0.0.1:5005/WeBASE-Chain-Manager/node/nodeList/100001/300001/1/10?nodeId=

4.1.3 返回参数

1)出参表

序号输出参数类型备注
1codeInt返回码,0:成功 其它:失败
2messageString描述
3totalCountInt总记录数
4dataList节点列表
4.1Object节点信息对象
4.1.1chainIdint链编号
4.1.2nodeIdString节点编号
4.1.3nodeNamestring节点名称
4.1.4groupIdint所属群组编号
4.1.5nodeActiveint共识状态(1正常,2不正常)
4.1.6nodeIpstring节点ip
4.1.7P2pPortint节点p2p端口
4.1.8descriptionString备注
4.1.9blockNumberBigInteger节点块高
4.1.10pbftViewBigIntegerPbft view
4.1.11createTimeLocalDateTime落库时间
4.1.12modifyTimeLocalDateTime修改时间

2)出参示例

  • 成功:
  1. {
  2. "code": 0,
  3. "message": "success",
  4. "totalCount": 1,
  5. "data": [
  6. {
  7. "chainId": 100001,
  8. "nodeId": "78e467957af3d0f77e19b952a740ba8c53ac76913df7dbd48d7a0fe27f4c902b55e8543e1c4f65b4a61695c3b490a5e8584149809f66e9ffc8c05b427e9d3ca2,
  9. "nodeName": "1_78e467957af3d0f77e19b952a740ba8c53ac76913df7dbd48d7a0fe27f4c902b55e8543e1c4f65b4a61695c3b490a5e8584149809f66e9ffc8c05b",
  10. "groupId": 1,
  11. "nodeIp": "127.0.0.1",
  12. "p2pPort": 10303,
  13. "description": null,
  14. "blockNumber": 133,
  15. "pbftView": 5852,
  16. "nodeActive": 1,
  17. "createTime": "2019-02-14 17:47:00",
  18. "modifyTime": "2019-03-15 11:14:29"
  19. }
  20. ]
  21. }
  • 失败:
  1. {
  2. "code": 102000,
  3. "message": "system exception",
  4. "data": {}
  5. }

4.2 查询节点信息(废弃,可通过4.1查询)

​ 节点和前置一一对应,节点编号可以从前置列表获取。

4.2.1 传输协议规范

  • 网络传输协议:使用HTTP协议
  • 请求地址:/node/nodeInfo/{chainId}/{groupId}/{nodeId}
  • 请求方式:GET
  • 返回格式:JSON

4.2.2 请求参数

1)入参表

序号输入参数类型可为空备注
1chainIdInt链编号
2groupIdInt群组id
3nodeIdString节点编号

2)入参示例

  1. http://127.0.0.1:5005/WeBASE-Chain-Manager/node/nodeInfo/100001/1/78e467957af3d0f77e19b952a740ba8c53ac76913df7dbd48d7a0fe27f4c902b55e8543e1c4f65b4a61695c3b490a5e8584149809f66e9ffc8c05b427e9d3ca2

4.2.3 返回参数

1)出参表

序号输出参数类型备注
1codeInt返回码,0:成功 其它:失败
2messageString描述
3Object节点信息对象
3.1chainIdInt链编号
3.2nodeIdString节点编号
3.3nodeNameString节点名称
3.4groupIdInt所属群组编号
3.5nodeActiveInt共识状态(1正常,2不正常)
3.6nodeIpString节点ip
3.7P2pPortInt节点p2p端口
3.8descriptionString备注
3.9blockNumberBigInteger节点块高
3.10pbftViewBigIntegerPbft view
3.11createTimeLocalDateTime落库时间
3.12modifyTimeLocalDateTime修改时间

2)出参示例

  • 成功:
  1. {
  2. "code": 0,
  3. "message": "success",
  4. "data": {
  5. "chainId": 100001,
  6. "nodeId": "78e467957af3d0f77e19b952a740ba8c53ac76913df7dbd48d7a0fe27f4c902b55e8543e1c4f65b4a61695c3b490a5e8584149809f66e9ffc8c05b427e9d3ca2",
  7. "nodeName": "1_78e467957af3d0f77e19b952a740ba8c53ac76913df7dbd48d7a0fe27f4c902b55e8543e1c4f65b4a61695c3b490a5e8584149809f66e9ffc8c05b",
  8. "groupId": 1,
  9. "nodeIp": "127.0.0.1",
  10. "p2pPort": 10303,
  11. "description": null,
  12. "blockNumber": 133,
  13. "pbftView": 5852,
  14. "nodeActive": 1,
  15. "createTime": "2019-02-14 17:47:00",
  16. "modifyTime": "2019-03-15 11:14:29"
  17. }
  18. }
  • 失败:
  1. {
  2. "code": 102000,
  3. "message": "system exception",
  4. "data": {}
  5. }

4.3 获取区块高度

​ 指定节点获取区块高度。节点和前置一一对应,节点编号可以从前置列表获取。

4.3.1 传输协议规范

  • 网络传输协议:使用HTTP协议
  • 请求地址:/node/getBlockNumber/{chainId}/{groupId}/{nodeId}
  • 请求方式:GET
  • 返回格式:JSON

4.3.2 请求参数

1)入参表

序号输入参数类型可为空备注
1chainIdInt链编号
2groupIdInt群组编号
3nodeIdString节点编号

2)入参示例

  1. http://127.0.0.1:5005/WeBASE-Chain-Manager/node/getBlockNumber/1001/1/78e467957af3d0f77e19b952a740ba8c53ac76913df7dbd48d7a0fe27f4c902b55e8543e1c4f65b4a61695c3b490a5e8584149809f66e9ffc8c05b427e9d3ca2

4.3.3 返回参数

1)出参表

序号输出参数类型备注
1codeInt返回码,0:成功 其它:失败
2messageString描述
3dataObject块高

2)出参示例

  • 成功:
  1. {
  2. "code": 0,
  3. "message": "success",
  4. "data": 74
  5. }
  • 失败:
  1. {
  2. "code": 102000,
  3. "message": "system exception",
  4. "data": {}
  5. }

4.4 根据区块高度获取区块信息

​ 指定节点根据区块高度获取区块信息。节点和前置一一对应,节点编号可以从前置列表获取。

4.4.1 传输协议规范

  • 网络传输协议:使用HTTP协议
  • 请求地址:/node/getBlockByNumber/{chainId}/{groupId}/{nodeId}/{blockNumber}
  • 请求方式:GET
  • 返回格式:JSON

4.4.2 请求参数

1)入参表

序号输入参数类型可为空备注
1chainIdInt链编号
2groupIdInt群组编号
3nodeIdString节点编号
4blockNumberBigInteger区块高度

2)入参示例

  1. http://127.0.0.1:5005/WeBASE-Chain-Manager/node/getBlockByNumber/1001/1/78e467957af3d0f77e19b952a740ba8c53ac76913df7dbd48d7a0fe27f4c902b55e8543e1c4f65b4a61695c3b490a5e8584149809f66e9ffc8c05b427e9d3ca2/1

4.4.3 返回参数

1)出参表

序号输出参数类型备注
1codeInt返回码,0:成功 其它:失败
2messageString描述
3dataObject区块信息

2)出参示例

  • 成功:
  1. "code": 0,
  2. "message": "success",
  3. "data": {
  4. "number": 1,
  5. "hash": "0x74ce7bf9daea04cfc9f69a2269f5f524dc62fcc19c7c649d56ded98c064321dd",
  6. "parentHash": "0xcd55822ef3c4bf20cd12a110e0d7d14e436385dd68ed133e4bf48183208943dc",
  7. "nonce": 0,
  8. "sha3Uncles": null,
  9. "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
  10. "transactionsRoot": "0x623f3f6b4a0bf166d70001876dd5ce6af6d215aa4282e390580e66f65f652eb5",
  11. "stateRoot": "0x286b6bb8045118b1f4429f4155e71847cf2c021dce78bf1ef780c5d131dfe0f2",
  12. "receiptsRoot": "0x5c15415b928ba2726259094659d3753d752e009fd5c36d4e86138e7260890553",
  13. "author": null,
  14. "sealer": "0x1",
  15. "mixHash": null,
  16. "extraData": [],
  17. "gasLimit": 0,
  18. "gasUsed": 0,
  19. "timestamp": 1577777367654,
  20. "transactions": [
  21. {
  22. "hash": "0x2bf33fff3b81d74548079a669333aef601d4d2acaf8d33a31687fac8d5d9c815",
  23. "nonce": 4.2909445613494797e+74,
  24. "blockHash": "0x74ce7bf9daea04cfc9f69a2269f5f524dc62fcc19c7c649d56ded98c064321dd",
  25. "blockNumber": 1,
  26. "transactionIndex": 0,
  27. "from": "0x42446154be80379b68debfdb06682d29d084fad4",
  28. "to": null,
  29. "value": 0,
  30. "gasPrice": 1,
  31. "gas": 100000000,
  32. "input": "0xxx",
  33. "creates": null,
  34. "publicKey": null,
  35. "raw": null,
  36. "r": null,
  37. "s": null,
  38. "v": 0,
  39. "blockNumberRaw": "1",
  40. "transactionIndexRaw": "0",
  41. "nonceRaw": "429094456134947991292268568258086729239801142894854477452577045806616816236",
  42. "gasRaw": "100000000",
  43. "valueRaw": "0",
  44. "gasPriceRaw": "1"
  45. }
  46. ],
  47. "uncles": null,
  48. "sealerList": [
  49. "626e1f1df03e217a7a25361444b857ec68003482aabfb24645a67111cbd96ceedc998975e158475605e38b899bc97be7283006a0171f4ec4796972ff6ad55b1a",
  50. "cd3a0d965ca5e5de9edce69245db827a3a253e4868e074020c3f5fb83ca0ae884d5705940c1fc1de550874de0f02374e83eaeb5317b819e420a8ff2e07e4b84c"
  51. ],
  52. "timestampRaw": "1577777367654",
  53. "nonceRaw": "0",
  54. "gasUsedRaw": "0",
  55. "gasLimitRaw": "0",
  56. "numberRaw": "1"
  57. }
  58. }
  • 失败:
  1. {
  2. "code": 102000,
  3. "message": "system exception",
  4. "data": {}
  5. }

4.5 获取群组交易总数信息

​ 指定节点获取群组交易总数信息。节点和前置一一对应,节点编号可以从前置列表获取。

4.5.1 传输协议规范

  • 网络传输协议:使用HTTP协议
  • 请求地址:/getTotalTransactionCount/{chainId}/{nodeId}/{groupId}
  • 请求方式:GET
  • 返回格式:JSON

4.5.2 请求参数

1)入参表

序号输入参数类型可为空备注
1chainIdInt链编号
2groupIdInt群组编号
3nodeIdString节点编号

2)入参示例

  1. http://127.0.0.1:5005/WeBASE-Chain-Manager/node/getTotalTransactionCount/1001/1/78e467957af3d0f77e19b952a740ba8c53ac76913df7dbd48d7a0fe27f4c902b55e8543e1c4f65b4a61695c3b490a5e8584149809f66e9ffc8c05b427e9d3ca2

4.5.3 返回参数

1)出参表

序号输出参数类型备注
1codeInt返回码,0:成功 其它:失败
2messageString描述
3dataObject
3.1txSumInt交易总数
3.2blockNumberInt当前块高

2)出参示例

  • 成功:
  1. {
  2. "code": 0,
  3. "message": "success",
  4. "data": {
  5. "txSum": 74,
  6. "blockNumber": 74
  7. }
  8. }
  • 失败:
  1. {
  2. "code": 102000,
  3. "message": "system exception",
  4. "data": {}
  5. }

4.6 根据交易hash获取交易信息

​ 指定节点根据交易hash获取交易信息。节点和前置一一对应,节点编号可以从前置列表获取。

4.6.1 传输协议规范

  • 网络传输协议:使用HTTP协议
  • 请求地址:/node/getTransactionByHash/{chainId}/{groupId}/{nodeId}/{transHash}
  • 请求方式:GET
  • 返回格式:JSON

4.6.2 请求参数

1)入参表

序号输入参数类型可为空备注
1chainIdInt链编号
2groupIdInt群组编号
3nodeIdString节点编号
4transHashString交易hash

2)入参示例

  1. http://127.0.0.1:5005/WeBASE-Chain-Manager/node/getTransactionByHash/1001/1/78e467957af3d0f77e19b952a740ba8c53ac76913df7dbd48d7a0fe27f4c902b55e8543e1c4f65b4a61695c3b490a5e8584149809f66e9ffc8c05b427e9d3ca2/0x2bf33fff3b81d74548079a669333aef601d4d2acaf8d33a31687fac8d5d9c815

4.6.3 返回参数

1)出参表

序号输出参数类型备注
1codeInt返回码,0:成功 其它:失败
2messageString描述
3dataObject交易信息

2)出参示例

  • 成功:
  1. {
  2. "code": 0,
  3. "message": "success",
  4. "data": {
  5. "hash": "0x2bf33fff3b81d74548079a669333aef601d4d2acaf8d33a31687fac8d5d9c815",
  6. "nonce": 4.2909445613494797e+74,
  7. "blockHash": "0x74ce7bf9daea04cfc9f69a2269f5f524dc62fcc19c7c649d56ded98c064321dd",
  8. "blockNumber": 1,
  9. "transactionIndex": 0,
  10. "from": "0x42446154be80379b68debfdb06682d29d084fad4",
  11. "to": "0x0000000000000000000000000000000000000000",
  12. "value": 0,
  13. "gasPrice": 1,
  14. "gas": 100000000,
  15. "input": "0xxxx",
  16. "creates": null,
  17. "publicKey": null,
  18. "raw": null,
  19. "r": null,
  20. "s": null,
  21. "v": 0,
  22. "blockNumberRaw": "1",
  23. "transactionIndexRaw": "0",
  24. "nonceRaw": "429094456134947991292268568258086729239801142894854477452577045806616816236",
  25. "gasRaw": "100000000",
  26. "valueRaw": "0",
  27. "gasPriceRaw": "1"
  28. }
  29. }
  • 失败:
  1. {
  2. "code": 102000,
  3. "message": "system exception",
  4. "data": {}
  5. }

4.7 根据交易hash获取交易回执信息

​ 指定节点根据交易hash获取交易回执信息。节点和前置一一对应,节点编号可以从前置列表获取。

4.7.1 传输协议规范

  • 网络传输协议:使用HTTP协议
  • 请求地址:/node/getTransactionReceipt/{chainId}/{groupId}/{nodeId}/{transHash}
  • 请求方式:GET
  • 返回格式:JSON

4.7.2 请求参数

1)入参表

序号输入参数类型可为空备注
1chainIdInt链编号
2groupIdInt群组编号
3nodeIdString节点编号
4transHashString交易hash

2)入参示例

  1. http://127.0.0.1:5005/WeBASE-Chain-Manager/node/getTransactionReceipt/1001/1/78e467957af3d0f77e19b952a740ba8c53ac76913df7dbd48d7a0fe27f4c902b55e8543e1c4f65b4a61695c3b490a5e8584149809f66e9ffc8c05b427e9d3ca2/0x2bf33fff3b81d74548079a669333aef601d4d2acaf8d33a31687fac8d5d9c815

4.7.3 返回参数

1)出参表

序号输出参数类型备注
1codeInt返回码,0:成功 其它:失败
2messageString描述
3dataObject交易回执信息

2)出参示例

  • 成功:
  1. {
  2. "code": 0,
  3. "message": "success",
  4. "data": {
  5. "transactionHash": "0x2bf33fff3b81d74548079a669333aef601d4d2acaf8d33a31687fac8d5d9c815",
  6. "transactionIndex": 0,
  7. "blockHash": "0x74ce7bf9daea04cfc9f69a2269f5f524dc62fcc19c7c649d56ded98c064321dd",
  8. "blockNumber": 1,
  9. "gasUsed": 371053,
  10. "contractAddress": "0xff15a64b529be2538826acd6bd436ebdedbc0557",
  11. "root": "0x286b6bb8045118b1f4429f4155e71847cf2c021dce78bf1ef780c5d131dfe0f2",
  12. "status": "0x0",
  13. "message": null,
  14. "from": "0x42446154be80379b68debfdb06682d29d084fad4",
  15. "to": "0x0000000000000000000000000000000000000000",
  16. "input": "0xxxxx",
  17. "output": "0x",
  18. "logs": [],
  19. "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
  20. }
  21. }
  • 失败:
  1. {
  2. "code": 102000,
  3. "message": "system exception",
  4. "data": {}
  5. }

5 合约管理模块

5.1 编译合约

​ 接口参数为合约文件压缩成zip并Base64编码后的字符串。合约文件需要放在同级目录压缩,涉及引用请使用”./XXX.sol”。可参考测试类ContractControllerTest的testCompileContract()方法。国密和非国密编译的bytecodeBin不一样,合约管理模块以国密为例。

5.1.1 传输协议规范

  • 网络传输协议:使用HTTP协议
  • 请求地址:/contract/compile
  • 请求方式:POST
  • 请求头:Content-type: application/json
  • 返回格式:JSON

5.1.2 请求参数

1)入参表

序号输入参数类型可为空备注
1chainIdInt链编号
2nodeIdString节点编号
3contractZipBase64String合约源码(合约文件压缩成zip,并Base64编码)

2)入参示例

  1. http://127.0.0.1:5005/WeBASE-Chain-Manager/contract/compile
  1. {
  2. "chainId": 1001,
  3. "contractZipBase64": "UEsDBBQAAAAIAIqMeFAi98KgkQAAAPwAAAAOAAAASGVsbG9Xb3JsZC5zb2xdjjELwjAQhfdC/8ON7VJE3Iq7k4uDmxDSMwSSi1yugkj/u7GJNPjGe/e+9x6sjFcQg7OTlRfcdsNh2I9towMJKy1wQufCNbCb3m0DSVHYkgFSHsd8wSeSwAXlnG5d5ffl4T6TFhsIDErXJ3QUlRKMMjPFkui//Kzi1B3LHykm0q+pTqK32xRaB2StsCNtuOUDUEsBAj8AFAAAAAgAiox4UCL3wqCRAAAA/AAAAA4AJAAAAAAAAAAgAAAAAAAAAEhlbGxvV29ybGQuc29sCgAgAAAAAAABABgA3EMdrL8B1gGPz3r5xAjWAX8gr5/Rr9UBUEsFBgAAAAABAAEAYAAAAL0AAAAAAA==",
  4. "nodeId": "a89e1fcb189ad740636bbef814388f2782a577cfc8ee9d6e0751bfbb4e3ddb4f0eadde82d5108bc6f3734aef4b04eafcb0911a2166bf47f309c16e31740548d2"
  5. }

5.1.3 返回参数

1)出参表

序号输出参数类型可为空备注
1codeInt返回码,0:成功 其它:失败
2messageString描述
3dataList列表
3.1Object信息对象
3.1.1contractNameString合约名称
3.1.2contractAbiString编译合约生成的abi文件内容
3.1.3bytecodeBinString合约bytecode binary,用于部署合约
3.1.4contractSourceString单个合约内容Base64编码

2)出参示例

  • 成功:
  1. {
  2. "code": 0,
  3. "message": "success",
  4. "data": [
  5. {
  6. "contractName": "HelloWorld",
  7. "contractAbi": "[{\"constant\":true,\"inputs\":[],\"name\":\"get\",\"outputs\":[{\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"n\",\"type\":\"string\"}],\"name\":\"set\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"name\",\"type\":\"string\"}],\"name\":\"SetName\",\"type\":\"event\"}]",
  8. "contractSource": "cHJhZ21hIHNvbGlkaXR5IF4wLjQuMjsNCmNvbnRyYWN0IEhlbGxvV29ybGR7DQogICAgc3RyaW5nIG5hbWU7DQogICAgZXZlbnQgU2V0TmFtZShzdHJpbmcgbmFtZSk7DQogICAgZnVuY3Rpb24gZ2V0KCljb25zdGFudCByZXR1cm5zKHN0cmluZyl7DQogICAgICAgIHJldHVybiBuYW1lOw0KICAgIH0NCiAgICBmdW5jdGlvbiBzZXQoc3RyaW5nIG4pew0KICAgICAgICBlbWl0IFNldE5hbWUobik7DQogICAgICAgIG5hbWU9bjsNCiAgICB9DQp9",
  9. "bytecodeBin": "608060405234801561001057600080fd5b50610373806100206000396000f30060806040526004361061004c576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063299f7f9d146100515780633590b49f146100e1575b600080fd5b34801561005d57600080fd5b5061006661014a565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100a657808201518184015260208101905061008b565b50505050905090810190601f1680156100d35780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156100ed57600080fd5b50610148600480360381019080803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091929192905050506101ec565b005b606060008054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156101e25780601f106101b7576101008083540402835291602001916101e2565b820191906000526020600020905b8154815290600101906020018083116101c557829003601f168201915b5050505050905090565b7f05432a43e07f36a8b98100b9cb3631e02f8e796b0a06813610ce8942e972fb81816040518080602001828103825283818151815260200191508051906020019080838360005b8381101561024e578082015181840152602081019050610233565b50505050905090810190601f16801561027b5780820380516001836020036101000a031916815260200191505b509250505060405180910390a1806000908051906020019061029e9291906102a2565b5050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106102e357805160ff1916838001178555610311565b82800160010185558215610311579182015b828111156103105782518255916020019190600101906102f5565b5b50905061031e9190610322565b5090565b61034491905b80821115610340576000816000905550600101610328565b5090565b905600a165627a7a72305820cff924cb0783dc84e2e107aae1fd09e1e04154b80834c9267a4eaa630997b2b90029"
  10. }
  11. ]
  12. }
  • 失败:
  1. {
  2. "code": 102000,
  3. "message": "system exception",
  4. "data": {}
  5. }

5.2 保存合约和更新

5.2.1 传输协议规范

  • 网络传输协议:使用HTTP协议
  • 请求地址:/contract/save
  • 请求方式:POST
  • 请求头:Content-type: application/json
  • 返回格式:JSON

5.2.2 请求参数

1)入参表

序号输入参数类型可为空备注
1chainIdInt链编号
2groupIdInt所属群组编号
3contractNameString合约名称
4contractSourceString合约源码,Base64编码
5contractAbiString编译合约生成的abi文件内容
6contractBinString合约运行时binary,用于合约解析
7bytecodeBinString合约bytecode binary,用于部署合约
8contractIdString合约编号(为空时表示新增,不为空表示更新)
9contractPathString合约所在目录

2)入参示例

  1. http://127.0.0.1:5005/WeBASE-Chain-Manager/contract/save
  1. {
  2. "bytecodeBin": "608060405234801561001057600080fd5b50610373806100206000396000f30060806040526004361061004c576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063299f7f9d146100515780633590b49f146100e1575b600080fd5b34801561005d57600080fd5b5061006661014a565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100a657808201518184015260208101905061008b565b50505050905090810190601f1680156100d35780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156100ed57600080fd5b50610148600480360381019080803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091929192905050506101ec565b005b606060008054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156101e25780601f106101b7576101008083540402835291602001916101e2565b820191906000526020600020905b8154815290600101906020018083116101c557829003601f168201915b5050505050905090565b7f05432a43e07f36a8b98100b9cb3631e02f8e796b0a06813610ce8942e972fb81816040518080602001828103825283818151815260200191508051906020019080838360005b8381101561024e578082015181840152602081019050610233565b50505050905090810190601f16801561027b5780820380516001836020036101000a031916815260200191505b509250505060405180910390a1806000908051906020019061029e9291906102a2565b5050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106102e357805160ff1916838001178555610311565b82800160010185558215610311579182015b828111156103105782518255916020019190600101906102f5565b5b50905061031e9190610322565b5090565b61034491905b80821115610340576000816000905550600101610328565b5090565b905600a165627a7a72305820cff924cb0783dc84e2e107aae1fd09e1e04154b80834c9267a4eaa630997b2b90029",
  3. "chainId": 1001,
  4. "contractAbi": "[{\"constant\":true,\"inputs\":[],\"name\":\"get\",\"outputs\":[{\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"n\",\"type\":\"string\"}],\"name\":\"set\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"name\",\"type\":\"string\"}],\"name\":\"SetName\",\"type\":\"event\"}]",
  5. "contractBin": "xxx",
  6. "contractName": "HelloWorld",
  7. "contractPath": "/",
  8. "contractSource": "cHJhZ21hIHNvbGlkaXR5IF4wLjQuMjsNCmNvbnRyYWN0IEhlbGxvV29ybGR7DQogICAgc3RyaW5nIG5hbWU7DQogICAgZXZlbnQgU2V0TmFtZShzdHJpbmcgbmFtZSk7DQogICAgZnVuY3Rpb24gZ2V0KCljb25zdGFudCByZXR1cm5zKHN0cmluZyl7DQogICAgICAgIHJldHVybiBuYW1lOw0KICAgIH0NCiAgICBmdW5jdGlvbiBzZXQoc3RyaW5nIG4pew0KICAgICAgICBlbWl0IFNldE5hbWUobik7DQogICAgICAgIG5hbWU9bjsNCiAgICB9DQp9",
  9. "groupId": 1
  10. }

5.2.3 返回参数

1)出参表

序号输出参数类型备注
1codeInt返回码,0:成功 其它:失败
2messageString描述
3Object返回信息实体
3.1contractIdInt合约编号
3.2contractPathString合约所在目录
3.3contractNameString合约名称
3.4chainIdInt链编号
3.5groupIdInt所属群组编号
3.6contractStatusInt1未部署,2已部署
3.7contractTypeInt合约类型(0-普通合约,1-系统合约,默认0)
3.8contractSourceString合约源码
3.9contractAbiString编译合约生成的abi文件内容
3.10contractBinString合约运行时binary,用于合约解析
3.11bytecodeBinString合约bytecode binary,用于部署合约
3.12contractAddressString合约地址
3.13deployTimeLocalDateTime部署时间
3.14descriptionString备注
3.15createTimeLocalDateTime创建时间
3.16modifyTimeLocalDateTime修改时间

2)出参示例

  • 成功:
  1. {
  2. "code": 0,
  3. "message": "success",
  4. "data": {
  5. "contractId": 400003,
  6. "contractPath": "/",
  7. "contractName": "HelloWorld",
  8. "contractStatus": 1,
  9. "chainId": 1001,
  10. "groupId": 1,
  11. "contractType": 0,
  12. "contractSource": "cHJhZ21hIHNvbGlkaXR5IF4wLjQuMjsNCmNvbnRyYWN0IEhlbGxvV29ybGR7DQogICAgc3RyaW5nIG5hbWU7DQogICAgZXZlbnQgU2V0TmFtZShzdHJpbmcgbmFtZSk7DQogICAgZnVuY3Rpb24gZ2V0KCljb25zdGFudCByZXR1cm5zKHN0cmluZyl7DQogICAgICAgIHJldHVybiBuYW1lOw0KICAgIH0NCiAgICBmdW5jdGlvbiBzZXQoc3RyaW5nIG4pew0KICAgICAgICBlbWl0IFNldE5hbWUobik7DQogICAgICAgIG5hbWU9bjsNCiAgICB9DQp9",
  13. "contractAbi": "[{\"constant\":true,\"inputs\":[],\"name\":\"get\",\"outputs\":[{\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"n\",\"type\":\"string\"}],\"name\":\"set\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"name\",\"type\":\"string\"}],\"name\":\"SetName\",\"type\":\"event\"}]",
  14. "contractBin": "xxx",
  15. "bytecodeBin": "608060405234801561001057600080fd5b50610373806100206000396000f30060806040526004361061004c576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063299f7f9d146100515780633590b49f146100e1575b600080fd5b34801561005d57600080fd5b5061006661014a565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100a657808201518184015260208101905061008b565b50505050905090810190601f1680156100d35780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156100ed57600080fd5b50610148600480360381019080803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091929192905050506101ec565b005b606060008054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156101e25780601f106101b7576101008083540402835291602001916101e2565b820191906000526020600020905b8154815290600101906020018083116101c557829003601f168201915b5050505050905090565b7f05432a43e07f36a8b98100b9cb3631e02f8e796b0a06813610ce8942e972fb81816040518080602001828103825283818151815260200191508051906020019080838360005b8381101561024e578082015181840152602081019050610233565b50505050905090810190601f16801561027b5780820380516001836020036101000a031916815260200191505b509250505060405180910390a1806000908051906020019061029e9291906102a2565b5050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106102e357805160ff1916838001178555610311565b82800160010185558215610311579182015b828111156103105782518255916020019190600101906102f5565b5b50905061031e9190610322565b5090565b61034491905b80821115610340576000816000905550600101610328565b5090565b905600a165627a7a72305820cff924cb0783dc84e2e107aae1fd09e1e04154b80834c9267a4eaa630997b2b90029",
  16. "contractAddress": null,
  17. "deployTime": null,
  18. "description": null,
  19. "createTime": "2020-04-02 16:17:20",
  20. "modifyTime": "2020-04-02 16:17:20"
  21. }
  22. }
  • 失败:
  1. {
  2. "code": 102000,
  3. "message": "system exception",
  4. "data": {}
  5. }

5.3 查询合约列表

5.3.1 传输协议规范

  • 网络传输协议:使用HTTP协议
  • 请求地址:/contract/contractList
  • 请求方式:POST
  • 返回格式:JSON

5.3.2 请求参数

1)入参表

序号输入参数类型可为空备注
1chainIdInt链编号
2groupIdInt群组id
3contractNameString合约名
4contractAddressString合约地址
5pageSizeInt每页记录数
6pageNumberInt当前页码
7contractStatusInt1未部署,2已部署

2)入参示例

  1. http://127.0.0.1:5005/WeBASE-Chain-Manager/contract/contractList
  1. {
  2. "chainId": 1001,
  3. "groupId": 1
  4. }

5.3.3 返回参数

1)出参表

序号输出参数类型备注
1codeInt返回码,0:成功 其它:失败
2messageString描述
3totalCountInt总记录数
4dataList列表
4Object返回信息实体
4.1.1contractIdint合约编号
4.1.2contractPathString合约所在目录
4.1.3contractNameString合约名称
4.1.4chainIdint链编号
4.1.5groupIdInt所属群组编号
4.1.6contractStatusint1未部署,2已部署
4.1.7contractTypeInt合约类型(0-普通合约,1-系统合约)
4.1.8contractSourceString合约源码
4.1.9contractAbiString编译合约生成的abi文件内容
4.1.10contractBinString合约运行时binary,用于合约解析
4.1.11bytecodeBinString合约bytecode binary,用于部署合约
4.1.12contractAddressString合约地址
4.1.13deployTimeLocalDateTime部署时间
4.1.14descriptionString备注
4.1.15createTimeLocalDateTime创建时间
4.1.16modifyTimeLocalDateTime修改时间
2)出参示例
  • 成功:
  1. {
  2. "code": 0,
  3. "message": "success",
  4. "data": [
  5. {
  6. "contractId": 400003,
  7. "contractPath": "/",
  8. "contractName": "HelloWorld",
  9. "contractStatus": 1,
  10. "chainId": 1001,
  11. "groupId": 1,
  12. "contractType": 0,
  13. "contractSource": "cHJhZ21hIHNvbGlkaXR5IF4wLjQuMjsNCmNvbnRyYWN0IEhlbGxvV29ybGR7DQogICAgc3RyaW5nIG5hbWU7DQogICAgZXZlbnQgU2V0TmFtZShzdHJpbmcgbmFtZSk7DQogICAgZnVuY3Rpb24gZ2V0KCljb25zdGFudCByZXR1cm5zKHN0cmluZyl7DQogICAgICAgIHJldHVybiBuYW1lOw0KICAgIH0NCiAgICBmdW5jdGlvbiBzZXQoc3RyaW5nIG4pew0KICAgICAgICBlbWl0IFNldE5hbWUobik7DQogICAgICAgIG5hbWU9bjsNCiAgICB9DQp9",
  14. "contractAbi": "[{\"constant\":true,\"inputs\":[],\"name\":\"get\",\"outputs\":[{\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"n\",\"type\":\"string\"}],\"name\":\"set\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"name\",\"type\":\"string\"}],\"name\":\"SetName\",\"type\":\"event\"}]",
  15. "contractBin": "xxx",
  16. "bytecodeBin": "608060405234801561001057600080fd5b50610373806100206000396000f30060806040526004361061004c576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063299f7f9d146100515780633590b49f146100e1575b600080fd5b34801561005d57600080fd5b5061006661014a565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100a657808201518184015260208101905061008b565b50505050905090810190601f1680156100d35780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156100ed57600080fd5b50610148600480360381019080803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091929192905050506101ec565b005b606060008054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156101e25780601f106101b7576101008083540402835291602001916101e2565b820191906000526020600020905b8154815290600101906020018083116101c557829003601f168201915b5050505050905090565b7f05432a43e07f36a8b98100b9cb3631e02f8e796b0a06813610ce8942e972fb81816040518080602001828103825283818151815260200191508051906020019080838360005b8381101561024e578082015181840152602081019050610233565b50505050905090810190601f16801561027b5780820380516001836020036101000a031916815260200191505b509250505060405180910390a1806000908051906020019061029e9291906102a2565b5050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106102e357805160ff1916838001178555610311565b82800160010185558215610311579182015b828111156103105782518255916020019190600101906102f5565b5b50905061031e9190610322565b5090565b61034491905b80821115610340576000816000905550600101610328565b5090565b905600a165627a7a72305820cff924cb0783dc84e2e107aae1fd09e1e04154b80834c9267a4eaa630997b2b90029",
  17. "contractAddress": null,
  18. "deployTime": null,
  19. "description": null,
  20. "createTime": "2020-04-02 16:17:20",
  21. "modifyTime": "2020-04-02 16:17:20"
  22. }
  23. ],
  24. "totalCount": 1
  25. }
  • 失败:
  1. {
  2. "code": 102000,
  3. "message": "system exception",
  4. "data": {}
  5. }

5.4 查询合约信息

5.4.1 传输协议规范

  • 网络传输协议:使用HTTP协议
  • 请求地址:/contract/{contractId}
  • 请求方式:GET
  • 返回格式:JSON

5.4.2 请求参数

1)入参表

序号输入参数类型可为空备注
1contractIdint合约编号

2)入参示例

  1. http://127.0.0.1:5005/WeBASE-Chain-Manager/contract/400003

5.4.3 返回参数

1)出参表

序号输出参数类型备注
1codeInt返回码,0:成功 其它:失败
2messageString描述
3Object返回信息实体
3.1contractIdint合约编号
3.2contractPathString合约所在目录
3.3contractNameString合约名称
3.4chainIdint链编号
3.5groupIdInt所属群组编号
3.6contractStatusint1未部署,2已部署
3.7contractTypeInt合约类型(0-普通合约,1-系统合约)
3.8contractSourceString合约源码
3.9contractAbiString编译合约生成的abi文件内容
3.10contractBinString合约运行时binary,用于合约解析
3.11bytecodeBinString合约bytecode binary,用于部署合约
3.12contractAddressString合约地址
3.13deployTimeLocalDateTime部署时间
3.14descriptionString备注
3.15createTimeLocalDateTime创建时间
3.16modifyTimeLocalDateTime修改时间

2)出参示例

  • 成功:
  1. {
  2. "code": 0,
  3. "message": "success",
  4. "data": {
  5. "contractId": 400003,
  6. "contractPath": "/",
  7. "contractName": "HelloWorld",
  8. "contractStatus": 1,
  9. "chainId": 1001,
  10. "groupId": 1,
  11. "contractType": 0,
  12. "contractSource": "cHJhZ21hIHNvbGlkaXR5IF4wLjQuMjsNCmNvbnRyYWN0IEhlbGxvV29ybGR7DQogICAgc3RyaW5nIG5hbWU7DQogICAgZXZlbnQgU2V0TmFtZShzdHJpbmcgbmFtZSk7DQogICAgZnVuY3Rpb24gZ2V0KCljb25zdGFudCByZXR1cm5zKHN0cmluZyl7DQogICAgICAgIHJldHVybiBuYW1lOw0KICAgIH0NCiAgICBmdW5jdGlvbiBzZXQoc3RyaW5nIG4pew0KICAgICAgICBlbWl0IFNldE5hbWUobik7DQogICAgICAgIG5hbWU9bjsNCiAgICB9DQp9",
  13. "contractAbi": "[{\"constant\":true,\"inputs\":[],\"name\":\"get\",\"outputs\":[{\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"n\",\"type\":\"string\"}],\"name\":\"set\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"name\",\"type\":\"string\"}],\"name\":\"SetName\",\"type\":\"event\"}]",
  14. "contractBin": "xxx",
  15. "bytecodeBin": "608060405234801561001057600080fd5b50610373806100206000396000f30060806040526004361061004c576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063299f7f9d146100515780633590b49f146100e1575b600080fd5b34801561005d57600080fd5b5061006661014a565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100a657808201518184015260208101905061008b565b50505050905090810190601f1680156100d35780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156100ed57600080fd5b50610148600480360381019080803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091929192905050506101ec565b005b606060008054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156101e25780601f106101b7576101008083540402835291602001916101e2565b820191906000526020600020905b8154815290600101906020018083116101c557829003601f168201915b5050505050905090565b7f05432a43e07f36a8b98100b9cb3631e02f8e796b0a06813610ce8942e972fb81816040518080602001828103825283818151815260200191508051906020019080838360005b8381101561024e578082015181840152602081019050610233565b50505050905090810190601f16801561027b5780820380516001836020036101000a031916815260200191505b509250505060405180910390a1806000908051906020019061029e9291906102a2565b5050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106102e357805160ff1916838001178555610311565b82800160010185558215610311579182015b828111156103105782518255916020019190600101906102f5565b5b50905061031e9190610322565b5090565b61034491905b80821115610340576000816000905550600101610328565b5090565b905600a165627a7a72305820cff924cb0783dc84e2e107aae1fd09e1e04154b80834c9267a4eaa630997b2b90029",
  16. "contractAddress": null,
  17. "deployTime": null,
  18. "description": null,
  19. "createTime": "2020-04-02 16:17:20",
  20. "modifyTime": "2020-04-02 16:17:20"
  21. }
  22. }
  • 失败:
  1. {
  2. "code": 102000,
  3. "message": "system exception",
  4. "data": {}
  5. }

5.5 部署合约

调用此接口进行合约部署。

构造方法参数(funcParam)为JSON数组,多个参数以逗号分隔(参数为数组时同理),示例:

  1. constructor(string s) -> ["aa,bb\"cc"] // 双引号要转义
  2. constructor(uint n,bool b) -> [1,true]
  3. constructor(bytes b,address[] a) -> ["0x1a",["0x7939E26070BE44E6c4Fc759Ce55C6C8b166d94BE","0xce867fD9afa64175bb50A4Aa0c17fC7C4A3C67D9"]]

5.5.1 传输协议规范

  • 网络传输协议:使用HTTP协议
  • 请求地址:/contract/deploy
  • 请求方式:POST
  • 请求头:Content-type: application/json
  • 返回格式:JSON

5.4.2 请求参数

1)入参表

序号输入参数类型可为空备注
1chainIdInt链编号
2groupIdInt所属群组编号
3contractNameString合约名称
4contractSourceString合约源码
5contractAbiString编译合约生成的abi文件内容
6contractBinString合约运行时binary,用于合约解析
7bytecodeBinString合约bytecode binary,用于部署合约
8contractIdString合约编号
9contractPathString合约所在目录
10signUserIdStringWeBASE-Sign签名用户编号
11constructorParamsList构造函数入参,JSON数组,多个参数以逗号分隔(参数为数组时同理),如:[“str1”,[“arr1”,”arr2”]]
12nodeIdString节点编号,指定节点调用

2)入参示例

  1. http://127.0.0.1:5005/WeBASE-Chain-Manager/contract/deploy
  1. {
  2. "bytecodeBin": "608060405234801561001057600080fd5b50610373806100206000396000f30060806040526004361061004c576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063299f7f9d146100515780633590b49f146100e1575b600080fd5b34801561005d57600080fd5b5061006661014a565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100a657808201518184015260208101905061008b565b50505050905090810190601f1680156100d35780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156100ed57600080fd5b50610148600480360381019080803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091929192905050506101ec565b005b606060008054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156101e25780601f106101b7576101008083540402835291602001916101e2565b820191906000526020600020905b8154815290600101906020018083116101c557829003601f168201915b5050505050905090565b7f05432a43e07f36a8b98100b9cb3631e02f8e796b0a06813610ce8942e972fb81816040518080602001828103825283818151815260200191508051906020019080838360005b8381101561024e578082015181840152602081019050610233565b50505050905090810190601f16801561027b5780820380516001836020036101000a031916815260200191505b509250505060405180910390a1806000908051906020019061029e9291906102a2565b5050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106102e357805160ff1916838001178555610311565b82800160010185558215610311579182015b828111156103105782518255916020019190600101906102f5565b5b50905061031e9190610322565b5090565b61034491905b80821115610340576000816000905550600101610328565b5090565b905600a165627a7a72305820cff924cb0783dc84e2e107aae1fd09e1e04154b80834c9267a4eaa630997b2b90029",
  3. "chainId": 1001,
  4. "constructorParams": [
  5. ],
  6. "contractAbi": "[{\"constant\":true,\"inputs\":[],\"name\":\"get\",\"outputs\":[{\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"n\",\"type\":\"string\"}],\"name\":\"set\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"name\",\"type\":\"string\"}],\"name\":\"SetName\",\"type\":\"event\"}]",
  7. "contractBin": "xxx",
  8. "contractId": 400003,
  9. "contractName": "HelloWorld",
  10. "contractPath": "/",
  11. "contractSource": "cHJhZ21hIHNvbGlkaXR5IF4wLjQuMjsNCmNvbnRyYWN0IEhlbGxvV29ybGR7DQogICAgc3RyaW5nIG5hbWU7DQogICAgZXZlbnQgU2V0TmFtZShzdHJpbmcgbmFtZSk7DQogICAgZnVuY3Rpb24gZ2V0KCljb25zdGFudCByZXR1cm5zKHN0cmluZyl7DQogICAgICAgIHJldHVybiBuYW1lOw0KICAgIH0NCiAgICBmdW5jdGlvbiBzZXQoc3RyaW5nIG4pew0KICAgICAgICBlbWl0IFNldE5hbWUobik7DQogICAgICAgIG5hbWU9bjsNCiAgICB9DQp9",
  12. "groupId": 1,
  13. "nodeId": "a89e1fcb189ad740636bbef814388f2782a577cfc8ee9d6e0751bfbb4e3ddb4f0eadde82d5108bc6f3734aef4b04eafcb0911a2166bf47f309c16e31740548d2",
  14. "signUserId": "user1001"
  15. }

5.5.3 返回参数

1)出参表

序号输出参数类型备注
1codeInt返回码,0:成功 其它:失败
2messageString描述
3Object返回信息实体
3.1contractIdint合约编号
3.2contractPathString合约所在目录
3.3contractNameString合约名称
3.4chainIdint链编号
3.5groupIdInt所属群组编号
3.6contractStatusint1未部署,2已部署
3.7contractTypeInt合约类型(0-普通合约,1-系统合约)
3.8contractSourceString合约源码
3.9contractAbiString编译合约生成的abi文件内容
3.10contractBinString合约binary
3.11bytecodeBinString合约bin
3.12contractAddressString合约地址
3.13deployTimeLocalDateTime部署时间
3.14descriptionString备注
3.15createTimeLocalDateTime创建时间
3.16modifyTimeLocalDateTime修改时间

2)出参示例

  • 成功:
  1. {
  2. "code": 0,
  3. "message": "success",
  4. "data": {
  5. "contractId": 400003,
  6. "contractPath": "/",
  7. "contractName": "HelloWorld",
  8. "contractStatus": 2,
  9. "chainId": 1001,
  10. "groupId": 1,
  11. "contractType": 0,
  12. "contractSource": "cHJhZ21hIHNvbGlkaXR5IF4wLjQuMjsNCmNvbnRyYWN0IEhlbGxvV29ybGR7DQogICAgc3RyaW5nIG5hbWU7DQogICAgZXZlbnQgU2V0TmFtZShzdHJpbmcgbmFtZSk7DQogICAgZnVuY3Rpb24gZ2V0KCljb25zdGFudCByZXR1cm5zKHN0cmluZyl7DQogICAgICAgIHJldHVybiBuYW1lOw0KICAgIH0NCiAgICBmdW5jdGlvbiBzZXQoc3RyaW5nIG4pew0KICAgICAgICBlbWl0IFNldE5hbWUobik7DQogICAgICAgIG5hbWU9bjsNCiAgICB9DQp9",
  13. "contractAbi": "[{\"constant\":true,\"inputs\":[],\"name\":\"get\",\"outputs\":[{\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"n\",\"type\":\"string\"}],\"name\":\"set\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"name\",\"type\":\"string\"}],\"name\":\"SetName\",\"type\":\"event\"}]",
  14. "contractBin": "xxx",
  15. "bytecodeBin": "608060405234801561001057600080fd5b50610373806100206000396000f30060806040526004361061004c576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063299f7f9d146100515780633590b49f146100e1575b600080fd5b34801561005d57600080fd5b5061006661014a565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100a657808201518184015260208101905061008b565b50505050905090810190601f1680156100d35780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156100ed57600080fd5b50610148600480360381019080803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091929192905050506101ec565b005b606060008054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156101e25780601f106101b7576101008083540402835291602001916101e2565b820191906000526020600020905b8154815290600101906020018083116101c557829003601f168201915b5050505050905090565b7f05432a43e07f36a8b98100b9cb3631e02f8e796b0a06813610ce8942e972fb81816040518080602001828103825283818151815260200191508051906020019080838360005b8381101561024e578082015181840152602081019050610233565b50505050905090810190601f16801561027b5780820380516001836020036101000a031916815260200191505b509250505060405180910390a1806000908051906020019061029e9291906102a2565b5050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106102e357805160ff1916838001178555610311565b82800160010185558215610311579182015b828111156103105782518255916020019190600101906102f5565b5b50905061031e9190610322565b5090565b61034491905b80821115610340576000816000905550600101610328565b5090565b905600a165627a7a72305820cff924cb0783dc84e2e107aae1fd09e1e04154b80834c9267a4eaa630997b2b90029",
  16. "contractAddress": "0x377127dbe8c03cf0decf353ac5119f5e7cbcfe97",
  17. "deployTime": "2020-04-02 16:22:44",
  18. "description": null,
  19. "createTime": "2020-04-02 16:17:20",
  20. "modifyTime": "2020-04-02 16:22:44"
  21. }
  22. }
  • 失败:
  1. {
  2. "code": 102000,
  3. "message": "system exception",
  4. "data": {}
  5. }

5.6 发送交易

调用此接口发送交易请求,数据上链或查询结果。

方法入参(funcParam)为JSON数组,多个参数以逗号分隔(参数为数组时同理),示例:

  1. function set(string s) -> ["aa,bb\"cc"] // 双引号要转义
  2. function set(uint n,bool b) -> [1,true]
  3. function set(bytes b,address[] a) -> ["0x1a",["0x7939E26070BE44E6c4Fc759Ce55C6C8b166d94BE","0xce867fD9afa64175bb50A4Aa0c17fC7C4A3C67D9"]]

5.6.1 传输协议规范

  • 网络传输协议:使用HTTP协议
  • 请求地址:/contract/transaction
  • 请求方式:POST
  • 请求头:Content-type: application/json
  • 返回格式:JSON

5.6.2 请求参数

1)入参表

序号输入参数类型可为空备注
1chainIdint链编号
2groupIdInt所属群组编号
3signUserIdStringWeBASE-Sign签名用户编号
4contractNameString合约名称
5contractIdInt合约编号
6funcNameString合约方法名
7contractAddressString合约地址
8funcParamList合约方法入参,JSON数组,多个参数以逗号分隔(参数为数组时同理),如:[“str1”,[“arr1”,”arr2”]]
9contractAbiString所调用合约方法的abi,注意格式(传入所有abi可能导致合约重载方法出问题)
10nodeIdString节点编号,指定节点调用

2)入参示例

  1. http://127.0.0.1:5005/WeBASE-Chain-Manager/contract/transaction
  1. {
  2. "chainId": 1001,
  3. "contractAbi": "[{\"constant\":true,\"inputs\":[],\"name\":\"get\",\"outputs\":[{\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"}]",
  4. "contractId": 400003,
  5. "contractName": "HelloWorld",
  6. "funcName": "get",
  7. "funcParam": [],
  8. "groupId": 1,
  9. "nodeId": "a89e1fcb189ad740636bbef814388f2782a577cfc8ee9d6e0751bfbb4e3ddb4f0eadde82d5108bc6f3734aef4b04eafcb0911a2166bf47f309c16e31740548d2",
  10. "signUserId": "user1001"
  11. }

5.6.3 返回参数

1)出参表

序号输出参数类型备注
1codeInt返回码,0:成功 其它:失败
2messageString描述
3dataobject返回信息实体(空)

2)出参示例

  • 上链成功:
  1. {
  2. "code": 0,
  3. "message": "success",
  4. "data": {
  5. "transactionHash": "0x150b562cfe3f8432853925bbed13f3ae549dc5083da9f42a5226f5df18094974",
  6. "transactionIndex": 0,
  7. "blockHash": "0x70ae837060441a087a12e4b6d70a5d76b7c9af3d97ec97035ffefdbe1836e567",
  8. "blockNumber": 177303,
  9. "gasUsed": 44956,
  10. "contractAddress": "0x0000000000000000000000000000000000000000",
  11. "root": "0x98372c72262170a0325f7c162feb2c310f7f43f13aeac42349e62784a98efebe",
  12. "status": "0x0",
  13. "message": null,
  14. "from": "0xdb4ed7a548623c219235aa68156f117dff959a17",
  15. "to": "0x377127dbe8c03cf0decf353ac5119f5e7cbcfe97",
  16. "input": "0x3590b49f0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000548656c6c6f000000000000000000000000000000000000000000000000000000",
  17. "output": "0x",
  18. "logs": [
  19. {
  20. "removed": false,
  21. "logIndex": null,
  22. "transactionIndex": null,
  23. "transactionHash": null,
  24. "blockHash": null,
  25. "blockNumber": null,
  26. "address": "0x377127dbe8c03cf0decf353ac5119f5e7cbcfe97",
  27. "data": "0x0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000548656c6c6f000000000000000000000000000000000000000000000000000000",
  28. "type": null,
  29. "topics": [
  30. "0x05432a43e07f36a8b98100b9cb3631e02f8e796b0a06813610ce8942e972fb81"
  31. ],
  32. "transactionIndexRaw": null,
  33. "logIndexRaw": null,
  34. "blockNumberRaw": null
  35. }
  36. ],
  37. "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000"
  38. }
  39. }
  • 查询成功:
  1. {
  2. "code": 0,
  3. "message": "success",
  4. "data": [
  5. "Hello"
  6. ]
  7. }
  • 失败:
  1. {
  2. "code": 102000,
  3. "message": "system exception",
  4. "data": {}
  5. }

5.7 合约状态管理

​ 通过预编译合约管理合约状态,根据入参的操作类型进行调用,可以冻结、解冻合约和授权用户操作权限,还可以查询合约状态和合约用户权限列表。

5.7.1 传输协议规范

  • 网络传输协议:使用HTTP协议
  • 请求地址: /contract/statusManage
  • 请求方式:POST
  • 请求头:Content-type: application/json
  • 返回格式:JSON

5.7.2 请求参数

1)入参表

序号输入参数类型可为空备注
1chainIdInt链编号
2groupIdInt群组编号
3nodeIdString节点Id
4signUserIdStringWeBASE-Sign签名用户编号
5contractAddressString已部署的合约地址
6handleTypeString操作类型:freeze-冻结;unfreeze-解冻;grantManager-授权;getStatus-查询合约状态;listManager-查询合约权限列表
7grantAddressString授权用户地址,操作类型为grantManager时需传入

2)入参示例

  1. http://127.0.0.1:5005/WeBASE-Chain-Manager/contract/statusManage
  1. {
  2. "chainId": 1001,
  3. "contractAddress": "0x1d518bf3fb0edceb18519808edf7ad8adeeed792",
  4. "grantAddress": "",
  5. "groupId": 1,
  6. "handleType": "freeze",
  7. "nodeId": "413c788ec4b55e8170815e1c61977bac8c38f2df8670d09868a6099a044c0bff7884b9c30f3fa9c331358fcbded28f8d0211e2ffc48019c9796fa05274ed89b1",
  8. "signUserId": "user1001"
  9. }

5.7.3 返回参数

1)出参表

序号输出参数类型备注
1codeInt返回码,0:成功 其它:失败
2messageString描述
3dataString数据

2)出参示例

  • 成功:
  1. {
  2. "code": 0,
  3. "message": "success",
  4. "data": null
  5. }
  • 失败:
  1. {
  2. "code": 205002,
  3. "message": "not fount any front",
  4. "data": null
  5. }

附录

1. 返回码信息列表

Codemessage描述
0success正常
105000system error系统异常
205000invalid front id无效的前置编号
205001database exception数据库异常
205002not fount any front找不到前置
205003front already exists前置已存在
205004group id cannot be empty群组编号不能为空
205005invalid group id无效的群组编号
205006save front fail保存前置失败
205007request front fail, please check front请求前置失败
205008abiInfo cannot be emptyabi信息不能为空
205009contract already exists合约已存在
205010invalid contract id无效的合约编号
205011invalid param info无效的参数
205012contract name cannot be repeated合约名称不能重复
205013contract has not deploy合约未部署
205014invalid contract address无效的合约地址
205015contract has been deployed合约已部署
205016contract deploy not success合约部署不成功
205017wrong host or port地址或端口错误
205018group id already exists群组编号已存在
205019node not exists节点不存在
205020front’s encrypt type not match前置加密类型不匹配
205021chain name already exists链名称已经存在
205022save chain fail保存链失败
205023invalid chain id无效的链编号
205024user already exists用户已存在
205025publicKey cannot be empty公钥不能为空
205026publicKey’s length is 130,address’s length is 42公钥或地址长度不对
205027user id cannot be empty用户编号不能为空
205028invalid user无效用户
205029chain id already exists链编号已存在
205030contract compile error合约编译错误
205031group generate fail群组创建失败
205032group operate fail群组操作失败
205033request node exception请求节点异常
305000param exception参数异常