接口说明

1 区块链管理模块

1.1 新增链信息

注意:使用接口搭链后,需要妥善保存项目目录(如/dist)中的NODES_ROOT目录,其中保存了链的相关证书与证书私钥。

传输协议规范

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

请求参数

1)入参表

序号输入参数类型可为空备注
1chainIdint链编号
2chainNamestring链名称
3consensusTypeString共识机制,如:pbft
4storageTypeString存储方式,如:rocksdb
5descriptionstring备注
6frontListListfront信息(要添加所有节点的front
6.1frontIpstringfront的ip地址
6.2frontPortIntegerfront的端口号
6.3extAgencyIdInteger节点所属组织 ID
6.4agencystring节点所属组织名称
6.5frontPeerNamestringk8s节点peerName
6.6extCompanyIdInteger主机所属公司 ID
6.7extHostIdInteger主机ID
6.8sshUserstring主机 SSH 免密账号,如:root
6.9sshPortInteger主机 SSH 端口,如:22
6.10jsonrpcPortIntegerJSON-RPC 端口,如:8545
6.11p2pPortIntegerP2P 端口,如:30300
6.11channelPortIntegerchannel 端口,如:20200

2)入参示例

  1. http://127.0.0.1:5005/WeBASE-Chain-Manager/chain/new
  • 只输入必填参数:
  1. {
  2. "chainId": 1,
  3. "chainName": "chain1",
  4. "frontList": [
  5. {
  6. "agency": "org1",
  7. "extAgencyId": 10,
  8. "frontPeerName": "abc.abc.abc",
  9. "frontIp": "127.0.0.3",
  10. "frontPort": 5002
  11. }
  12. ]
  13. }
  • 输入所有参数:
  1. {
  2. "chainId": 0,
  3. "chainName": "ccc1",
  4. "consensusType": "pbft",
  5. "description": "dddddesc",
  6. "frontList": [
  7. {
  8. "agency": "aaaorg",
  9. "channelPort": 20200,
  10. "extAgencyId": 10,
  11. "extCompanyId": 10,
  12. "extHostId": 10,
  13. "frontIp": "127.0.0.3",
  14. "frontPort": 5002,
  15. "frontPeerName": "abc.abc.abc",
  16. "jsonrpcPort": 8545,
  17. "p2pPort": 30300,
  18. "sshPort": 22,
  19. "sshUser": "root"
  20. }
  21. ],
  22. "storageType": "rocksdb"
  23. }

返回参数

1)出参表

序号输出参数类型可空备注
1codeInt返回码,0:成功 其它:失败
2messageString描述
3dataObject信息对象
3.1chainIdint链编号
3.2chainNamestring链名称
3.3chainTypeint链类型(0-非国密,1-国密)
3.4descriptionstring备注
3.5createTimeLocalDateTime落库时间
3.6modifyTimeLocalDateTime修改时间
3.7versionstring节点客户端版本
3.8consensusTypeString共识机制,如:pbft
3.9storageTypeString存储方式,如:rocksdb
3.10chainStatusint链状态,0-初始化,1-部署中,2-部署失败,3-运行,4-重启中,5-升级中,6-升级失败
3.11deployTypeint部署方式,0-手动部署,1-接口部署

2)出参示例

  • 成功:
  1. {
  2. "code": 0,
  3. "message": "success",
  4. "data": {
  5. "progress": 0,
  6. "chainId": 1,
  7. "chainName": "chain1",
  8. "chainType": 0,
  9. "description": null,
  10. "createTime": 1611568826000,
  11. "modifyTime": 1611568826000,
  12. "version": "2.7.1",
  13. "consensusType": null,
  14. "storageType": null,
  15. "chainStatus": 3,
  16. "webaseSignAddr": "127.0.0.1:5004",
  17. "deployType": 0,
  18. "remark": ""
  19. },
  20. "attachment": null,
  21. "success": true
  22. }
  • 失败:
  1. {
  2. "code": 102000,
  3. "message": "system exception",
  4. "data": {}
  5. }

1.2 获取所有链列表

传输协议规范

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

请求参数

1)入参表

2)入参示例

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

返回参数

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 删除链信息

传输协议规范

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

请求参数

1)入参表

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

2)入参示例

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

返回参数

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. }

1.4 删除链信息(post请求)

传输协议规范

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

请求参数

1)入参表

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

2)入参示例

  1. http://127.0.0.1:5005/WeBASE-Chain-Manager/chain/removeChain
  1. {
  2. "chainId": 493
  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 新增节点前置信息

传输协议规范

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

请求参数

1)入参表

序号输入参数类型可为空备注
1chainIdint链编号
2frontIpstringfront的ip地址
3frontPortIntegerfront的端口号
4extAgencyIdInteger节点所属组织 ID
5agencystring节点所属组织名称
6frontPeerNamestringk8s节点peerName
7extCompanyIdInteger主机所属公司 ID
8extHostIdInteger主机ID
9sshUserstring主机 SSH 免密账号,如:root
10sshPortInteger主机 SSH 端口,如:22
11jsonrpcPortIntegerJSON-RPC 端口,如:8545
12p2pPortIntegerP2P 端口,如:30300
13channelPortIntegerchannel 端口,如:20200
14nodeIdStringfront关联的节点id,可空。优先调front接口获取nodeId,如果失败才取这个值

2)入参示例

  1. http://127.0.0.1:5005/WeBASE-Chain-Manager/front/new
  1. {
  2. "chainId": 100001,
  3. "agency": "org1",
  4. "extAgencyId": 10,
  5. "frontPeerName": "abc.abc.abc",
  6. "frontIp": "127.0.0.2",
  7. "frontPort": 5002
  8. }

返回参数

1)出参表

序号输出参数类型备注
1codeInt返回码,0:成功 其它:失败
2messageString描述
3Object信息对象
3.1frontIdint前置编号
3.2chainIdint链编号
3.3frontPeerNamestringk8s节点peerName
3.4nodeIdstring前置对应的节点编号
3.5frontIpstringfront的ip地址
3.6frontPortIntegerfront的端口号
3.7agencystring所属机构
3.8extAgencyIdInteger节点所属组织 ID
3.9extCompanyIdInteger主机所属公司 ID
3.10extHostIdInteger主机ID
3.11sshUserstring主机 SSH 免密账号,如:root
3.12sshPortInteger主机 SSH 端口,如:22
3.13jsonrpcPortIntegerJSON-RPC 端口,如:8545
3.14p2pPortIntegerP2P 端口,如:30300
3.15channelPortIntegerchannel 端口,如:20200
3.16descriptionstring备注
3.17createTimeLocalDateTime落库时间
3.18modifyTimeLocalDateTime修改时间

2)出参示例

  • 成功:
  1. {
  2. "code": 0,
  3. "message": "success",
  4. "data": {
  5. "frontId": 200029,
  6. "chainId": 1,
  7. "frontPeerName": "abc.abc.abcc",
  8. "nodeId": "53060c93c5c7bfdc2b35ffae766e5e9f0ca16340f8e4ed09421cbbdb86cc974d57eb6460d41c33a71634f033a898d92486dd5081e2db1672bd426fff6e4af5f8",
  9. "frontIp": "127.0.02",
  10. "frontPort": 5002,
  11. "agency": "org1",
  12. "description": null,
  13. "createTime": 1611716211476,
  14. "modifyTime": 1611716211476,
  15. "frontStatus": 1,
  16. "version": null,
  17. "containerName": null,
  18. "jsonrpcPort": null,
  19. "p2pPort": null,
  20. "channelPort": null,
  21. "chainName": "chain1",
  22. "extCompanyId": 0,
  23. "extAgencyId": 10,
  24. "extHostId": 0,
  25. "hostIndex": null,
  26. "sshUser": null,
  27. "sshPort": null,
  28. "dockerPort": null,
  29. "rootOnHost": null,
  30. "nodeRootOnHost": null
  31. },
  32. "attachment": null,
  33. "success": true
  34. }
  • 失败:
  1. {
  2. "code": 105000,
  3. "message": "system exception",
  4. "data": {}
  5. }

2.2 获取所有前置列表

传输协议规范

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

请求参数

1)入参表

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

2)入参示例

  1. http://localhost:5005/WeBASE-Chain-Manager/front/find?chainId=12&agencyId=10

返回参数

1)出参表

序号输出参数类型备注
1codeInt返回码,0:成功 其它:失败
2messageString描述
3totalCountInt总记录数
4dataList组织列表
4.1Object节点信息对象
4.1.1frontIdint前置编号
4.1.2chainIdint链编号
4.1.3frontPeerNamestringk8s节点peerName
4.1.4nodeIdstring前置对应的节点编号
4.1.5frontIpstringfront的ip地址
4.1.6frontPortIntegerfront的端口号
4.1.7agencystring所属机构
4.1.8extAgencyIdInteger节点所属组织 ID
4.1.9extCompanyIdInteger主机所属公司 ID
4.1.10extHostIdInteger主机ID
4.1.11sshUserstring主机 SSH 免密账号,如:root
4.1.12sshPortInteger主机 SSH 端口,如:22
4.1.13jsonrpcPortIntegerJSON-RPC 端口,如:8545
4.1.14p2pPortIntegerP2P 端口,如:30300
4.1.15channelPortIntegerchannel 端口,如:20200
4.1.16descriptionstring备注
4.1.17createTimeLocalDateTime落库时间
4.1.18modifyTimeLocalDateTime修改时间

2)出参示例

  • 成功:
  1. {
  2. "code": 0,
  3. "message": "success",
  4. "data": [
  5. {
  6. "frontId": 200029,
  7. "chainId": 1,
  8. "frontPeerName": "abc.abc.abcc",
  9. "nodeId": "53060c93c5c7bfdc2b35ffae766e5e9f0ca16340f8e4ed09421cbbdb86cc974d57eb6460d41c33a71634f033a898d92486dd5081e2db1672bd426fff6e4af5f8",
  10. "frontIp": "106.53.99.131",
  11. "frontPort": 5002,
  12. "agency": "org1",
  13. "description": null,
  14. "createTime": 1611716211000,
  15. "modifyTime": 1611716211000,
  16. "frontStatus": 1,
  17. "version": "",
  18. "containerName": "",
  19. "jsonrpcPort": null,
  20. "p2pPort": null,
  21. "channelPort": null,
  22. "chainName": "chain1",
  23. "extCompanyId": 0,
  24. "extAgencyId": 10,
  25. "extHostId": 0,
  26. "hostIndex": 0,
  27. "sshUser": null,
  28. "sshPort": null,
  29. "dockerPort": null,
  30. "rootOnHost": null,
  31. "nodeRootOnHost": ""
  32. }
  33. ],
  34. "totalCount": 1
  35. }
  • 失败:
  1. {
  2. "code": 105000,
  3. "message": "system exception",
  4. "data": {}
  5. }

2.3 删除前置信息

传输协议规范

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

请求参数

1)入参表

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

2)入参示例

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

返回参数

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 前置节点监控信息

传输协议规范

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

  • 请求地址:

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

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

  • 返回格式:JSON

请求参数

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

返回参数

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 前置节点服务器监控信息

传输协议规范

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

请求参数

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

返回参数

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 前置节点服务器配置信息

传输协议规范

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

请求参数

1)入参表

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

2)入参示例

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

返回参数

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 检查前置节点进程是否存活

传输协议规范

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

请求参数

1)入参表

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

2)入参示例

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

返回参数

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 获取前置节点所在群组物理大小信息

传输协议规范

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

请求参数

1)入参表

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

2)入参示例

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

返回参数

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. }

2.9 废弃机构下面的前置

该接口不会删除前置信息,只将前置状态变更为“废弃”

传输协议规范

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

请求参数

1)入参表 | 序号 | 输出参数 | 类型 | 可空 | 备注 | | —– | ———– | ———- | —- | ————- | | 1 | agencyId | Int | 否 |废弃该机构下面的所有前置 |

2)入参示例

  1. http://localhost:5005/WeBASE-Chain-Manager/front/abandonedByAgencyId
  1. {
  2. "agencyId": 10
  3. }

返回参数

1)出参表

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

2)出参示例

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

3 群组管理模块

3.1 生成新群组

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

传输协议规范

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

请求参数

1)入参表

序号输入参数类型可为空备注
1chainIdint链编号
2generateGroupIdint生成的群组编号
3timestampBigInteger创世块时间(单位:ms)
4nodeListList节点编号列表(新群组的所有节点编号)
5descriptionstring备注
6groupNamestring群组名称(如果为空,则自动生成。不能重复)

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. }

返回参数

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的批量启动。

传输协议规范

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

请求参数

1)入参表

序号输入参数类型可为空备注
1chainIdint链编号
2generateGroupIdint生成的群组编号
3timestampBigInteger创世块时间(单位:ms)
4nodeListList节点编号列表(新群组的所有节点编号;另外,nodeList与orgIdList不能同时为空)
5orgIdListList节点所属机构编号列表(nodeList与orgIdList不能同时为空)
6descriptionstring
7groupNamestring群组名称(如果为空,则自动生成。不能重复)

2)入参示例

  1. http://127.0.0.1:5005/WeBASE-Chain-Manager/group/generate
  • 只输入必填参数
  1. {
  2. "chainId": 1,
  3. "description": "test",
  4. "nodeList": [],
  5. "orgIdList": [10]
  6. }
  • 输入所有参数
  1. {
  2. "chainId": 1,
  3. "generateGroupId": 12,
  4. "timestamp": 1611624853047,
  5. "description": "test",
  6. "nodeList": [],
  7. "orgIdList": [10]
  8. }

返回参数

1)出参表

序号输出参数类型可空备注
1codeInt返回码,0:成功 其它:失败
2messageString描述
3dataObject组织信息对象
3.1groupIdint群组编号
3.2chainIdint链编号
3.3groupNameString群组名称
3.4nodeCountint节点数量
3.5descriptionString描述
3.6groupTypeint群组类型(1-同步的,2-手动创建的)
3.7groupTimestampString创世块时间(单位:ms)
3.8createTimeLocalDateTime落库时间
3.9modifyTimeLocalDateTime修改时间
4attachmentString接口请求失败时的错误信息

2)出参示例

  • 成功:
  1. {
  2. "code": 0,
  3. "message": "success",
  4. "data": {
  5. "groupId": 12,
  6. "chainId": 1,
  7. "groupName": "chain_1_group_12",
  8. "groupStatus": null,
  9. "nodeCount": 1,
  10. "description": "test",
  11. "groupType": 2,
  12. "createTime": 1611624961357,
  13. "modifyTime": 1611624961357,
  14. "groupTimestamp": "1611624853047",
  15. "epochSealerNum": null,
  16. "nodeIdList": null
  17. },
  18. "attachment": null,
  19. "success": true
  20. }
  • 失败:
  1. {
  2. "code": 102000,
  3. "message": "system exception",
  4. "data": {}
  5. }

3.3 动态操作群组

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

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

传输协议规范

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

请求参数

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

返回参数

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 批量启动群组

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

传输协议规范

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

请求参数

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. }

返回参数

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 更新群组(废弃,启动或停止后自动更新)

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

传输协议规范

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

请求参数

1)入参表

2)入参示例

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

返回参数

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 获取群组概况

传输协议规范

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

请求参数

1)入参表

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

2)入参示例

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

返回参数

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 获取所有群组列表

传输协议规范

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

请求参数

1)入参表

2)入参示例

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

返回参数

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,节点共识状态。返回所有的共识/观察节点(无论运行或停止),以及正在运行的游离节点。

传输协议规范

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

请求参数

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

返回参数

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。

传输协议规范

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

请求参数

1)入参表

序号输入参数类型可为空备注
1chainIdInt链编号
2groupIdInt群组编号
3signUserIdStringWeBASE-Sign签名用户编号
4nodeIdString要切换状态节点Id
5nodeTypeString要设置的节点类型:observer/sealer/remove
6reqNodeIdString调用前置对应的节点Id
7nodeIdListList需要更改状态的节点列表(此字段为追加字段,与nodeId不能同时为空)

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. }

返回参数

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两个参数。

传输协议规范

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

请求参数

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

返回参数

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两个参数。

传输协议规范

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

请求参数

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. }

返回参数

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 删除前置统计日志数据进行删除,数据量少于一万条时,前置自动从节点日志文件拉取新的数据。

传输协议规范

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

请求参数

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

返回参数

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 删除前置统计日志数据进行删除,数据量少于一万条时,前置自动从节点日志文件拉取新的数据。

传输协议规范

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

请求参数

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

返回参数

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. }

3.15 分页查询群组列表

3.15.1 传输协议规范

  • 网络传输协议:使用HTTP协议
  • 请求地址:/group/page/{chainId}?pageNumber=1&pageSize=10&agency=10
  • 请求方式:GET
  • 返回格式:JSON

3.15.2 请求参数

1)入参表 | 序号 | 输入参数 | 类型 | 可为空 | 备注 | | —- | ———- | —— | —— | ——– | | 1 | chainId | Int | 否 | 链编号 | | 2 | agency | Int | 是 | 机构id | | 3 | pageSize | Int | 否 | 每页记录数,默认10 | | 4 | pageNumber | Int | 否 | 当前页码,默认1 | | 5 | status | Byte | 是 | 状态(1-正常 2-异常) | | 6 | sortType | String | 是 | 排序规则(ASC-升序、DESC-倒叙),默认ASC |

2)入参示例

  1. http://localhost:5005/WeBASE-Chain-Manager/group/page/1?pageNumber=2&pageSize=3

3.15.3 返回参数

1)出参表

序号输出参数类型备注
1codeInt返回码,0:成功 其它:失败
2messageString描述
3dataObject返回信息列表
3.1Object返回信息实体
3.1.1groupIdint群组编号
3.1.2chainIdint链编号
3.1.3groupNameString群组名称
3.1.4nodeCountint节点数量
3.1.5descriptionString描述
3.1.6groupTypeint群组类型(1-同步的,2-手动创建的)
3.1.7groupTimestampString创世块时间(单位:ms)
3.1.8createTimeLocalDateTime落库时间
3.1.9modifyTimeLocalDateTime修改时间
3.1.10nodeCountOfAgencyint查询入参agency不为空时,此字段有返回值
4attachmentString接口请求失败时的错误信息

2)出参示例

  • 成功:
  1. {
  2. "code": 0,
  3. "message": "success",
  4. "data": [
  5. {
  6. "groupId": 4,
  7. "chainId": 1,
  8. "groupName": "chain_1_group_4",
  9. "groupStatus": 1,
  10. "nodeCount": 1,
  11. "description": "synchronous",
  12. "groupType": 1,
  13. "createTime": 1611568827000,
  14. "modifyTime": 1611642306000,
  15. "groupTimestamp": "null",
  16. "epochSealerNum": 0,
  17. "nodeIdList": null,
  18. "nodeCountOfAgency":1
  19. },
  20. {
  21. "groupId": 5,
  22. "chainId": 1,
  23. "groupName": "chain_1_group_5",
  24. "groupStatus": 1,
  25. "nodeCount": 1,
  26. "description": "synchronous",
  27. "groupType": 1,
  28. "createTime": 1611568827000,
  29. "modifyTime": 1611642306000,
  30. "groupTimestamp": "null",
  31. "epochSealerNum": 0,
  32. "nodeIdList": null,
  33. "nodeCountOfAgency":2
  34. },
  35. {
  36. "groupId": 6,
  37. "chainId": 1,
  38. "groupName": "chain_1_group_6",
  39. "groupStatus": 1,
  40. "nodeCount": 1,
  41. "description": "synchronous",
  42. "groupType": 1,
  43. "createTime": 1611568827000,
  44. "modifyTime": 1611642306000,
  45. "groupTimestamp": "null",
  46. "epochSealerNum": 0,
  47. "nodeIdList": null,
  48. "nodeCountOfAgency":1
  49. }
  50. ],
  51. "totalCount": 11
  52. }
  • 失败:
  1. {
  2. "code": 102000,
  3. "message": "system exception",
  4. "data": {}
  5. }

3.16 异步方式添加群组的共识节点

先将要变更类型的节点类型更改为观察者节点,并写入到db,然后定期检查块高,等该节点区块同步跟上群组的块高时,才将该节点的类型更改为共识节点

3.16.1 传输协议规范

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

3.16.2 请求参数

1)入参表

序号输入参数类型可为空备注
1chainIdInt链编号
2groupIdInt群组编号
3nodeIdListList需要更改状态的节点列表

2)入参示例

  1. http://127.0.0.1:5005/WeBASE-Chain-Manager/group/addSealerAsync
  1. {
  2. "chainId": 1001,
  3. "groupId": 1,
  4. "nodeIdList":["626e1f1df03e217a7a25361444b857ec68003482aabfb24645a67111cbd96ceedc998975e158475605e38b899bc97be7283006a0171f4ec4796972ff6ad55b1a"
  5. ]
  6. }

3.16.3 返回参数

1)出参表

序号输出参数类型备注
1codeInt返回码,0:成功 其它:失败
2messageString描述
3dataObject描述
3.1allSuccessFlagboolean是否所有节点操作成功
3.2sealerNodesStrint入参中类型已是sealer的节点
3.3successNodesStrint处理成功的节点
3.4errorMessagesStrint处理失败的节点
4attachmentStrint失败消息

2)出参示例

  • 成功:
  1. {
  2. "code": 0,
  3. "message": "success",
  4. "data": {
  5. "allSuccessFlag": true,
  6. "sealerNodes": [
  7. "85432afdc4d5ee38497c16719f84c1ada3f145e08f01d19cbc5558d6d4da3ee6dd329fdfffbd65e932668130eece0ac0abaf7f70b5a7d0dbe95a3e0780ac968e"
  8. ],
  9. "successNodes": [],
  10. "errorMessages": []
  11. },
  12. "attachment": null,
  13. "success": true
  14. }
  • 失败:
  1. {
  2. "code": 205282,
  3. "message": "add sealer async not success",
  4. "data": {
  5. "allSuccessFlag": false,
  6. "sealerNodes": [],
  7. "successNodes": [],
  8. "errorMessages": [
  9. "node:85432afdc4d5ee38497c16719f84c1ada3f145e08f01d19cbc5558d6d4da3ee6dd329fdfffbd65e932668130eece0ac0abaf7f70b5a7d0dbe95a3e0780ac968e1 fail:invalid node type: sealer, observer, remove "
  10. ]
  11. },
  12. "attachment": "[\"node:85432afdc4d5ee38497c16719f84c1ada3f145e08f01d19cbc5558d6d4da3ee6dd329fdfffbd65e932668130eece0ac0abaf7f70b5a7d0dbe95a3e0780ac968e1 fail:invalid node type: sealer, observer, remove \"]",
  13. "success": false
  14. }

3.17 查询群组详情

3.17.1 传输协议规范

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

3.17.2 请求参数

1)入参表 | 序号 | 输出参数 | 类型 | 可空 | 备注 | | —– | ———– | ———- | —- | ————- | | 1 | chainId | Int | 否 | 网络Id | | 2 | groupId | Int | 否 |群组Id |

2)入参示例

  1. curl --location --request GET 'http://localhost:5005/WeBASE-Chain-Manager/group/495/26/detail'

3.17.3 返回参数

1)出参表

序号输出参数类型备注
1codeInt返回码,0:成功 其它:失败
2messageString描述
3dataList列表
3.1Object信息对象
3.1.1chainIdint链编号
3.1.2groupIdint群组编号
3.1.3groupNameString群组名称
3.1.4nodeCountint节点数量
3.1.5descriptionString描述
3.1.6createTimeLocalDateTime落库时间
3.1.7modifyTimeLocalDateTime修改时间
3.1.8groupTimestampLong群组创建的时间戳
3.1.9nodeIdListString最开始创建群组的节点列表Json
3.1.10agencyListList机构列表
3.1.10.1Object机构实体
3.1.10.1.1agencyIdInteger机构编号
3.1.10.1.2agencyNameString机构名称
3.1.11nodeInfoListList节点列表
3.1.11.1Object节点实体
3.1.11.1.1nodeIdInteger节点编号
3.1.11.1.2chainIdInteger链编号
3.1.11.1.3groupIdInteger群组编号
3.1.11.1.4nodeNameString节点名称
3.1.11.1.5frontPeerNameString节点前置名称
3.1.11.1.6agencyInteger所属机构
3.1.11.1.7agencyNameString所属机构名称

2)出参示例

  • 成功:
  1. {
  2. "code": 0,
  3. "message": "success",
  4. "data": {
  5. "groupId": 26,
  6. "chainId": 495,
  7. "groupName": "chain_495_group_26",
  8. "groupStatus": 1,
  9. "nodeCount": 1,
  10. "description": "86979",
  11. "groupType": 2,
  12. "createTime": 1614242451000,
  13. "modifyTime": 1614414645000,
  14. "groupTimestamp": "1614242450540",
  15. "epochSealerNum": 0,
  16. "nodeIdList": "[\"0731d71597f15d04d55a047f78d4eb34a10ff8d7abc793fe1176959586cd6086f50da76cc27de8341321718a8ce94dd76fcb00479b2f49d3beaae8d30e611baa\"]",
  17. "agencyList": [{
  18. "agencyId": 145,
  19. "agencyName": "org11"
  20. }],
  21. "nodeInfoList": [{
  22. "nodeId": "0731d71597f15d04d55a047f78d4eb34a10ff8d7abc793fe1176959586cd6086f50da76cc27de8341321718a8ce94dd76fcb00479b2f49d3beaae8d30e611baa",
  23. "chainId": 495,
  24. "groupId": 26,
  25. "nodeName": "26_0731d71597f15d04d55a047f78d4eb34a10ff8d7abc793fe1176959586cd6086f50da76cc27de8341321718a8ce94dd76fcb00479b2f49d3beaae8d30e611baa",
  26. "nodeType": "sealer",
  27. "nodeIp": null,
  28. "p2pPort": null,
  29. "blockNumber": 2,
  30. "pbftView": 89918,
  31. "nodeActive": 1,
  32. "description": null,
  33. "createTime": 1614242473000,
  34. "modifyTime": 1614332853000,
  35. "frontPeerName": "peer0.org11.d292gp0toy",
  36. "agency": 145,
  37. "agencyName": "org11"
  38. }]
  39. },
  40. "attachment": null,
  41. "success": true
  42. }
  • 失败:
  1. {
  2. "code": 102000,
  3. "message": "system exception",
  4. "data": {}
  5. }

3.18 修改群组描述

3.18.1 传输协议规范

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

3.18.2 请求参数

1)入参表 | 序号 | 输出参数 | 类型 | 可空 | 备注 | | —– | ———– | ———- | —- | ————- | | 1 | chainId | Int | 否 | 网络Id | | 2 | groupId | Int | 否 |群组Id || 2 | description | String | 否 |描述 |

2)入参示例

  1. http://localhost:5005/WeBASE-Chain-Manager/group/changeDescription'
  1. {
  2. "chainId":12,
  3. "groupId":1,
  4. "description":"test"
  5. }

3.18.3 返回参数

1)出参表

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

2)出参示例

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

3.19 移除群组下的机构

移除指定机构群组下的所有节点。如果这个机构本来已经是群组内的唯一机构,则会停止该群组。

3.19.1 传输协议规范

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

3.19.2 请求参数

1)入参表 | 序号 | 输出参数 | 类型 | 可空 | 备注 | | —– | ———– | ———- | —- | ————- | | 1 | chainId | Int | 否 | 网络Id | | 2 | groupId | Int | 否 |群组Id | | 3 | agencyId | Int | 否 |需要被移除的机构 |

2)入参示例

  1. http://localhost:5005/WeBASE-Chain-Manager/group/removeAgency'
  1. {
  2. "agencyId": 10,
  3. "chainId": 1,
  4. "groupId": 15
  5. }

3.19.3 返回参数

1)出参表

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

2)出参示例

  • 成功:
  1. {
  2. "code": 0,
  3. "message": "success",
  4. "attachment": null,
  5. "success": true
  6. }
  • 失败:
  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}&agencyId={agencyId}&frontPeerName={frontPeerName}
  • 请求方式:GET
  • 返回格式:JSON

4.1.2 请求参数

1)入参表

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

2)入参示例

  1. http://127.0.0.1:5005/WeBASE-Chain-Manager/node/nodeList/100001/300001/1/10?agencyId=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.11nodeTypeString节点类型(sealer、observer、remove)
4.1.12frontPeerNameString节点名称
4.1.13createTimeLocalDateTime落库时间
4.1.14modifyTimeLocalDateTime修改时间
4.1.15intagency所属机构
4.1.16StringagencyName所属机构名称

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. "agency":145,
  20. "agencyName":"org11"
  21. }
  22. ]
  23. }
  • 失败:
  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. }

4.8 查询节点Id列表

4.8.1 传输协议规范

  • 网络传输协议:使用HTTP协议
  • 请求地址:/node/nodeIdList/{chainId}/{groupId}?agencyId={agencyId}&nodeTypes={nodeType}
  • 请求方式:GET
  • 返回格式:JSON

4.8.2 请求参数

1)入参表

序号输入参数类型可为空备注
1chainIdint链编号
2groupIdint群组编号
3agencyIdint机构Id
4nodeTypesList节点类型:sealer、observer、remove

2)入参示例

  1. http://localhost:5005/WeBASE-Chain-Manager/node/nodeIdList/1/1?nodeTypes=sealer&nodeTypes=observer

4.8.3 返回参数

1)出参表

序号输出参数类型备注
1codeInt返回码,0:成功 其它:失败
2messageString描述
4dataList返回信息列表
4.1Object返回信息实体
4.1.1frontPeerNameStringk8s节点peerName
4.1.2nodeIdString节点Id

2)出参示例

  • 成功:
  1. {
  2. "code": 0,
  3. "message": "success",
  4. "data": [{
  5. "frontPeerName": "peer2.org11.d292gp0toy",
  6. "nodeId": "846a2388047a4b81725af14da72972c21cd902cee2a741dbe2e8413ad0bb0c3eeede091ea7f0196c54c7b8e0bf432a84a64ba55a3b7f4268cef1a0c2cd25b78a"
  7. }, {
  8. "frontPeerName": "peer0.org11.d292gp0toy",
  9. "nodeId": "0731d71597f15d04d55a047f78d4eb34a10ff8d7abc793fe1176959586cd6086f50da76cc27de8341321718a8ce94dd76fcb00479b2f49d3beaae8d30e611baa"
  10. }],
  11. "attachment": null,
  12. "success": true
  13. }
  • 失败:
  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,用于部署合约
8contractIdint合约编号(为空时表示新增,不为空表示更新)
9contractPathString合约所在目录
10agencyIdInt合约发起机构(紧新增时保存)

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. "agencyId": 23
  11. }

5.2.3 返回参数

1)出参表

序号输出参数类型备注
1codeInt返回码,0:成功 其它:失败
2messageString描述
3Object返回信息实体
3.1contractIdInt合约编号
3.2contractPathString合约所在目录
3.3contractNameString合约名称
3.4chainIdInt链编号
3.5groupIdInt所属群组编号
3.6contractStatusInt1未部署,2已部署,3部署失败,4编译成功,5编译失败
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修改时间
3.16agencyIdInt合约发起机构(紧新增时保存)

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链编号
1groupIdInt群组id
2contractNameString合约名
3contractAddressString合约地址
4pageSizeInt每页记录数
5pageNumberInt当前页码
6contractStatusInt1未部署,2已部署,3部署失败,4编译成功,5编译失败

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列表
5.1Object返回信息实体
5.1.1contractIdint合约编号
5.1.2contractPathString合约所在目录
5.1.3contractNameString合约名称
5.1.4chainIdint链编号
5.1.5groupIdInt所属群组编号
5.1.6contractStatusint1未部署,2已部署,3部署失败,4编译成功,5编译失败
5.1.7contractTypeInt合约类型(0-普通合约,1-系统合约)
5.1.8contractSourceString合约源码
5.1.9contractAbiString编译合约生成的abi文件内容
5.1.10contractBinString合约运行时binary,用于合约解析
5.1.11bytecodeBinString合约bytecode binary,用于部署合约
5.1.12contractAddressString合约地址
5.1.13deployTimeLocalDateTime部署时间
5.1.14descriptionString备注
5.1.15createTimeLocalDateTime创建时间
5.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部署失败,4编译成功,5编译失败
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部署失败,4编译成功,5编译失败
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"]]

关联接口:/trans/sendByContractId,通过合约ID发送交易

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. }

5.8 根据合约编号编译合约

​ 合约保存到chain-manager之后,在未部署之前都可以根据合约编号进行编译

5.8.1 传输协议规范

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

5.8.2 请求参数

1)入参表

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

2)入参示例

  1. http://localhost:5005/WeBASE-Chain-Manager/contract/compile/400029

5.8.3 返回参数

1)出参表

序号输出参数类型可空备注
1codeInt返回码,0:成功 其它:失败
2messageString描述
3dataObject返回信息实体
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修改时间
6attachmentString错误信息

2)出参示例

  • 成功:
  1. {
  2. "code": 0,
  3. "message": "success",
  4. "data": {
  5. "contractId": 400029,
  6. "contractPath": "myPath",
  7. "contractName": "Ok",
  8. "chainId": 1,
  9. "groupId": 1,
  10. "contractAddress": null,
  11. "deployTime": null,
  12. "contractStatus": 1,
  13. "contractType": 0,
  14. "description": null,
  15. "createTime": 1611654176000,
  16. "modifyTime": 1611654176000,
  17. "contractSource": "cHJhZ21hIHNvbGlkaXR5IF4wLjQuMjsNCmNvbnRyYWN0IE9rew0KICAgIA0KICAgIHN0cnVjdCBBY2NvdW50ew0KICAgICAgICBhZGRyZXNzIGFjY291bnQ7DQogICAgICAgIHVpbnQgYmFsYW5jZTsNCiAgICB9DQogICAgDQogICAgc3RydWN0ICBUcmFuc2xvZyB7DQogICAgICAgIHN0cmluZyB0aW1lOw0KICAgICAgICBhZGRyZXNzIGZyb207DQogICAgICAgIGFkZHJlc3MgdG87DQogICAgICAgIHVpbnQgYW1vdW50Ow0KICAgIH0NCiAgICANCiAgICBBY2NvdW50IGZyb207DQogICAgQWNjb3VudCB0bzsNCiAgICANCiAgICBUcmFuc2xvZ1tdIGxvZzsNCg0KICAgIGZ1bmN0aW9uIE9rKCl7DQogICAgICAgIGZyb20uYWNjb3VudD0weDE7DQogICAgICAgIGZyb20uYmFsYW5jZT0xMDAwMDAwMDAwMDsNCiAgICAgICAgdG8uYWNjb3VudD0weDI7DQogICAgICAgIHRvLmJhbGFuY2U9MDsNCg0KICAgIH0NCiAgICBmdW5jdGlvbiBnZXQoKWNvbnN0YW50IHJldHVybnModWludCl7DQogICAgICAgIHJldHVybiB0by5iYWxhbmNlOw0KICAgIH0NCiAgICBmdW5jdGlvbiB0cmFucyh1aW50IG51bSl7DQogICAgCWZyb20uYmFsYW5jZT1mcm9tLmJhbGFuY2UtbnVtOw0KICAgIAl0by5iYWxhbmNlKz1udW07DQogICAgDQogICAgCWxvZy5wdXNoKFRyYW5zbG9nKCIyMDE3MDQxMyIsZnJvbS5hY2NvdW50LHRvLmFjY291bnQsbnVtKSk7DQogICAgfQ0KDQoNCg0KfQ==",
  18. "contractAbi": "[{\"constant\":false,\"inputs\":[{\"name\":\"num\",\"type\":\"uint256\"}],\"name\":\"trans\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"get\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"}]",
  19. "contractBin": null,
  20. "bytecodeBin": "608060405234801561001057600080fd5b5060016000800160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506402540be40060006001018190555060028060000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600060026001018190555061035f806100c26000396000f30060806040526004361061004c576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806366c99139146100515780636d4ce63c1461007e575b600080fd5b34801561005d57600080fd5b5061007c600480360381019080803590602001909291905050506100a9565b005b34801561008a57600080fd5b50610093610281565b6040518082815260200191505060405180910390f35b80600060010154036000600101819055508060026001016000828254019250508190555060046080604051908101604052806040805190810160405280600881526020017f323031373034313300000000000000000000000000000000000000000000000081525081526020016000800160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001600260000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001838152509080600181540180825580915050906001820390600052602060002090600402016000909192909190915060008201518160000190805190602001906101e292919061028e565b5060208201518160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060408201518160020160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506060820151816003015550505050565b6000600260010154905090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106102cf57805160ff19168380011785556102fd565b828001600101855582156102fd579182015b828111156102fc5782518255916020019190600101906102e1565b5b50905061030a919061030e565b5090565b61033091905b8082111561032c576000816000905550600101610314565b5090565b905600a165627a7a7230582066a9a0e9f95b9ab7c8f0b6249c23b4b1b98ea9db2b2ac8fa66eab6ac2c5810730029"
  21. },
  22. "attachment": null,
  23. "success": true
  24. }
  • 失败:
  1. {
  2. "code": 205002,
  3. "message": "not fount any front",
  4. "data": null
  5. }

5.9 根据合约编号部署合约

​ 合约保存到chain-manager并且编译之后,可以根据合约编号部署该合约

5.9.1 传输协议规范

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

5.9.2 请求参数

1)入参表

序号输入参数类型可为空备注
1contractIdInt合约编号
2signUserIdString私钥用户id
3constructorParamsList合约初始化入参
4constructorParamsJsonString合约初始化入参Json,当constructorParams为空时,取此字段

2)入参示例

  1. http://localhost:5005/WeBASE-Chain-Manager/contract/deployByContractId
  1. {
  2. "constructorParams": [],
  3. "contractId": 400029,
  4. "signUserId": "1SSSaFN1NXH9tfac"
  5. }

5.9.3 返回参数

1)出参表

序号输出参数类型可空备注
1codeInt返回码,0:成功 其它:失败
2messageString描述
3dataObject返回信息实体
5.1.1contractIdint合约编号
5.1.2contractPathString合约所在目录
5.1.3contractNameString合约名称
5.1.4chainIdint链编号
5.1.5groupIdInt所属群组编号
5.1.6contractStatusint1未部署,2已部署
5.1.7contractTypeInt合约类型(0-普通合约,1-系统合约)
5.1.8contractSourceString合约源码
5.1.9contractAbiString编译合约生成的abi文件内容
5.1.10contractBinString合约运行时binary,用于合约解析
5.1.11bytecodeBinString合约bytecode binary,用于部署合约
5.1.12contractAddressString合约地址
5.1.13deployTimeLocalDateTime部署时间
5.1.14descriptionString备注
5.1.15createTimeLocalDateTime创建时间
5.1.16modifyTimeLocalDateTime修改时间
6attachmentString错误信息

2)出参示例

  • 成功:
  1. {
  2. "code": 0,
  3. "message": "success",
  4. "data": {
  5. "contractId": 400029,
  6. "contractPath": "myPath",
  7. "contractName": "Ok",
  8. "chainId": 1,
  9. "groupId": 1,
  10. "contractAddress": "0xc8b5b216584bf2fda209d09ae2a090d7d4e5d3cc",
  11. "deployTime": 1611714428000,
  12. "contractStatus": 2,
  13. "contractType": 0,
  14. "description": null,
  15. "createTime": 1611654176000,
  16. "modifyTime": 1611654176000,
  17. "contractSource": "cHJhZ21hIHNvbGlkaXR5IF4wLjQuMjsNCmNvbnRyYWN0IE9rew0KICAgIA0KICAgIHN0cnVjdCBBY2NvdW50ew0KICAgICAgICBhZGRyZXNzIGFjY291bnQ7DQogICAgICAgIHVpbnQgYmFsYW5jZTsNCiAgICB9DQogICAgDQogICAgc3RydWN0ICBUcmFuc2xvZyB7DQogICAgICAgIHN0cmluZyB0aW1lOw0KICAgICAgICBhZGRyZXNzIGZyb207DQogICAgICAgIGFkZHJlc3MgdG87DQogICAgICAgIHVpbnQgYW1vdW50Ow0KICAgIH0NCiAgICANCiAgICBBY2NvdW50IGZyb207DQogICAgQWNjb3VudCB0bzsNCiAgICANCiAgICBUcmFuc2xvZ1tdIGxvZzsNCg0KICAgIGZ1bmN0aW9uIE9rKCl7DQogICAgICAgIGZyb20uYWNjb3VudD0weDE7DQogICAgICAgIGZyb20uYmFsYW5jZT0xMDAwMDAwMDAwMDsNCiAgICAgICAgdG8uYWNjb3VudD0weDI7DQogICAgICAgIHRvLmJhbGFuY2U9MDsNCg0KICAgIH0NCiAgICBmdW5jdGlvbiBnZXQoKWNvbnN0YW50IHJldHVybnModWludCl7DQogICAgICAgIHJldHVybiB0by5iYWxhbmNlOw0KICAgIH0NCiAgICBmdW5jdGlvbiB0cmFucyh1aW50IG51bSl7DQogICAgCWZyb20uYmFsYW5jZT1mcm9tLmJhbGFuY2UtbnVtOw0KICAgIAl0by5iYWxhbmNlKz1udW07DQogICAgDQogICAgCWxvZy5wdXNoKFRyYW5zbG9nKCIyMDE3MDQxMyIsZnJvbS5hY2NvdW50LHRvLmFjY291bnQsbnVtKSk7DQogICAgfQ0KDQoNCg0KfQ==",
  18. "contractAbi": "[{\"constant\":false,\"inputs\":[{\"name\":\"num\",\"type\":\"uint256\"}],\"name\":\"trans\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"get\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"}]",
  19. "contractBin": null,
  20. "bytecodeBin": "608060405234801561001057600080fd5b5060016000800160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506402540be40060006001018190555060028060000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600060026001018190555061035f806100c26000396000f30060806040526004361061004c576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806366c99139146100515780636d4ce63c1461007e575b600080fd5b34801561005d57600080fd5b5061007c600480360381019080803590602001909291905050506100a9565b005b34801561008a57600080fd5b50610093610281565b6040518082815260200191505060405180910390f35b80600060010154036000600101819055508060026001016000828254019250508190555060046080604051908101604052806040805190810160405280600881526020017f323031373034313300000000000000000000000000000000000000000000000081525081526020016000800160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001600260000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001838152509080600181540180825580915050906001820390600052602060002090600402016000909192909190915060008201518160000190805190602001906101e292919061028e565b5060208201518160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060408201518160020160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506060820151816003015550505050565b6000600260010154905090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106102cf57805160ff19168380011785556102fd565b828001600101855582156102fd579182015b828111156102fc5782518255916020019190600101906102e1565b5b50905061030a919061030e565b5090565b61033091905b8082111561032c576000816000905550600101610314565b5090565b905600a165627a7a7230582066a9a0e9f95b9ab7c8f0b6249c23b4b1b98ea9db2b2ac8fa66eab6ac2c5810730029"
  21. },
  22. "attachment": null,
  23. "success": true
  24. }
  • 失败:
  1. {
  2. "code": 205002,
  3. "message": "not fount any front",
  4. "data": null
  5. }

5.10 根据合约编号发交易

​ 通过chain-manager部署合约之后,可以根据合约编号发送交易来调用该合约函数

5.10.1 传输协议规范

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

5.10.2 请求参数

1)入参表

序号输入参数类型可为空备注
1contractIdInt合约编号
2signUserIdString私钥用户id
3funcNameString合约函数名称
4funcParamList合约函数入参
5funcParamJsonString合约函数入参Json,当funcParam为空时,取此字段

2)入参示例

  1. http://localhost:5005/WeBASE-Chain-Manager/trans/sendByContractId
  1. {
  2. "contractId": 400029,
  3. "funcName": "trans",
  4. "funcParam": [2],
  5. "signUserId": "1SSSaFN1NXH9tfac"
  6. }

5.10.3 返回参数

1)出参表

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

2)出参示例

  • 成功:
  1. {
  2. "code": 0,
  3. "message": "success",
  4. "data": {
  5. "constant": false,
  6. "queryInfo": null,
  7. "transactionHash": "0xc11e5e8c6bad2f85776c1f2034792ed9339961ac9b07239d45d38a6ca38fa2b7",
  8. "blockHash": "0xa8ca227ce42241d4d9645be6cb9a32f9739d80a39abf2b0fd13e515c7e4580ed",
  9. "blockNumber": 20,
  10. "gasUsed": 149266,
  11. "status": "0x0",
  12. "from": "0x06d48b8447ce02ade289412992252cbb59cdfd99",
  13. "to": "0xc8b5b216584bf2fda209d09ae2a090d7d4e5d3cc",
  14. "input": "0x66c991390000000000000000000000000000000000000000000000000000000000000002",
  15. "output": "0x"
  16. },
  17. "attachment": null,
  18. "success": true
  19. }
  • 失败:
  1. {
  2. "code": 205002,
  3. "message": "not fount any front",
  4. "data": null
  5. }

5.11 删除合约(DELETE)

​ 支持删除未部署的合约

5.11.1 传输协议规范

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

5.11.2 请求参数

1)入参表

序号输入参数类型可为空备注
1chainIdInt链Id
2groupIdInt群组Id
3contractIdInt合约Id

2)入参示例

  1. http://localhost:5005/WeBASE-Chain-Manager/contract/444/444/444

5.11.3 返回参数

1)出参表

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

2)出参示例

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

5.12 删除合约(POST)

​ 支持删除未部署的合约

5.12.1 传输协议规范

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

5.12.2 请求参数

1)入参表

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

2)入参示例

  1. http://localhost:5005/WeBASE-Chain-Manager/contract/remove
  1. {
  2. "contractId": 22
  3. }

5.12.3 返回参数

1)出参表

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

2)出参示例

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

5.13 查询合约数

传输协议规范

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

请求参数

1)入参表

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

2)入参示例

  1. http://localhost:5005/WeBASE-Chain-Manager/contract/count?chainId=1&groupId=&agencyId=3

5.13.3 返回参数

1)出参表

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

2)出参示例

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

6 私钥用户管理模块

6.1 新建私钥用户

​ 创建或者导入一个私钥用户,该用户可以用来部署和调用合约

​ 场景1:privateKey字段入参为空,由服务器生成新的私钥

​ 场景2:privateKey字段入参不为空,直接保存该私钥。

6.1.1 传输协议规范

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

6.1.2 请求参数

1)入参表

序号输入参数类型可为空备注
1chainIdint链编号
2appIdString应用id(群组唯一标志,可取group_name字段值)
3encryptTypeint链加密类型(0-ECDS,1-国密),如不传则从front查询
4signUserIdString用户唯一编号,如不传如则自动产生
5signUserNamestring用户名称
6privateKeystring私钥base64(此字段不为空就保存到db,否则生成新的私钥)
7descriptionBigInteger备注

2)入参示例

  1. http://localhost:5005/WeBASE-Chain-Manager/user/newUser
  • 只输必填参数
  1. {
  2. "appId": "chain_1_group_10",
  3. "chainId": 1,
  4. "signUserName": "testUserLosi"
  5. }
  • 输入所有参数
  1. {
  2. "appId": "chain_1_group_10",
  3. "chainId": 1,
  4. "description": "test new User",
  5. "encryptType": 0,
  6. "signUserId": "1SSSaFN1NXH9tfa5",
  7. "signUserName": "testUserBob"
  8. }
  • 导入私钥
  1. {
  2. "appId": "chain_1_group_10",
  3. "chainId": 1,
  4. "description": "test new User",
  5. "encryptType": 0,
  6. "signUserId": "1SSSaFN1NXH9tfac",
  7. "signUserName": "testUserBob1",
  8. "privateKey":"Y2QzZmQ1NDMxMTdjZWNjNTZiMzhhN2ZjNTUyYzYwYzBjNTZkZTc3NDFjMDg4OTBlYTlmZjMyMDJhMTAzY2Q0NA=="
  9. }

6.1.3 返回参数

1)出参表

序号输出参数类型可空备注
1codeInt返回码,0:成功 其它:失败
2messageString错误信息
3dataObject返回信息对象
3.1appIdString应用编号(群组唯一标志)
3.2chainIdint链编号
3.3addressString用户地址
3.4publicKeyString公钥
3.5signUserNameString用户名称
3.6descriptionString描述
3.7encryptTypeint链加密类型(0-ECDS,1-国密)
3.8signUserIdString私钥用户id
4attachmentString错误信息

2)出参示例

  • 成功:
  1. {
  2. "code": 0,
  3. "message": "success",
  4. "data": {
  5. "signUserId": "1SSSaFN1NXH9tfa5",
  6. "appId": "chain_1_group_10",
  7. "address": "0xca6a924f713c13c39b477de97c9315ec9d3062e0",
  8. "publicKey": "0497f11ec7ce57d276988625c40abd01048fbf80842e15210efb166b4d527dd5cdcd3df99c9c4429c51bff8b4bbffaf8fa418b73b61417f2ab171fef08ff455cf1",
  9. "privateKey": "",
  10. "signUserName": "testUserBob",
  11. "description": null,
  12. "encryptType": 0
  13. },
  14. "attachment": null,
  15. "success": true
  16. }
  • 失败:
  1. {
  2. "code": 105000,
  3. "message": "system exception",
  4. "data": {}
  5. }

6.2 修改用户备注

​ 允许修改私钥用户的备注信息

6.2.1 传输协议规范

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

6.2.2 请求参数

1)入参表

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

2)入参示例

  1. http://localhost:5005/WeBASE-Chain-Manager/user/update
  1. {
  2. "signUserId": "1SSSaFN1NXH9tfa5",
  3. "description": "test new User"
  4. }

6.2.3 返回参数

1)出参表

序号输出参数类型可空备注
1codeInt返回码,0:成功 其它:失败
2messageString错误信息
3dataObject信息对象
4attachmentString错误信息

2)出参示例

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

6.3 分页查询私钥用户信息

​ 能够根据appid分页查询当前应用(群组)下的私钥用户列表

6.3.1 传输协议规范

  • 网络传输协议:使用HTTP协议
  • 请求地址: /user/list/{appId}/{pageNumber}/{pageSize}
  • 请求方式:GET
  • 返回格式:JSON

6.3.2 请求参数

1)入参表

序号输入参数类型可为空备注
1appIdString应用id
2pageNumberInteger页码
3pageSizeInteger每页记录数

2)入参示例

  1. http://localhost:5005/WeBASE-Chain-Manager/user/list/chain_1_group_10/1/10

6.3.3 返回参数

1)出参表

序号输出参数类型可空备注
1codeInt返回码,0:成功 其它:失败
2messageString错误信息
3totalCountInteger总记录数
4dataList返回信息列表
4.1Object返回信息实体
4.1.1appIdString应用编号(群组唯一标志)
4.1.2chainIdint链编号
4.1.3addressString用户地址
4.1.4publicKeyString公钥
4.1.5signUserNameString用户名称
4.1.6descriptionString描述
4.1.7encryptTypeint链加密类型(0-ECDS,1-国密)
5attachmentString错误信息

2)出参示例

  • 成功:
  1. {
  2. "code": 0,
  3. "message": "success",
  4. "data": [
  5. {
  6. "signUserId": "1SSSaFN1NXH9tfa5",
  7. "appId": "chain_1_group_10",
  8. "address": "0xca6a924f713c13c39b477de97c9315ec9d3062e0",
  9. "publicKey": "0497f11ec7ce57d276988625c40abd01048fbf80842e15210efb166b4d527dd5cdcd3df99c9c4429c51bff8b4bbffaf8fa418b73b61417f2ab171fef08ff455cf1",
  10. "privateKey": "",
  11. "signUserName": "testUserBob",
  12. "description": null,
  13. "encryptType": 0
  14. },
  15. {
  16. "signUserId": "1SSS10SSS6fe9d91746ef43a3b6e9335db0c86a5d",
  17. "appId": "chain_1_group_10",
  18. "address": "0x30d64594b66b8cfd03189e305f117f572f02b265",
  19. "publicKey": "048424666a32ae72acb264b82cb17b4d8495d230648e9b547031699dc45395020260b028d3f47ceddb695adad3afdaaa349c81f29d9826c7555262536fc438dd79",
  20. "privateKey": "",
  21. "signUserName": "testUserLosi",
  22. "description": null,
  23. "encryptType": 0
  24. }
  25. ],
  26. "totalCount": 2
  27. }
  • 失败:
  1. {
  2. "code": 105000,
  3. "message": "system exception",
  4. "data": {}
  5. }

7 机构管理模块

7.1 查询机构下的所有资源

​ 根据机构编号获取机构下的所有链、前置、群组、合约等信息。

7.1.1 传输协议规范

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

7.1.2 请求参数

1)入参表

序号输入参数类型可为空备注
1agencyIdint机构编号

2)入参示例

  1. http://localhost:5005/WeBASE-Chain-Manager/agency/10/owned

7.1.3 返回参数

1)出参表

序号输出参数类型可空备注
1codeInt返回码,0:成功 其它:失败
2messageString错误信息
3dataObject返回信息对象
3.1chainIdListList链编号列表
3.2groupListList群组列表
3.2.1Object群组信息对象
3.2.1.1chainIdInt所属链编号
3.2.1.2groupIdInt群组编号
3.2.1.3groupNameString群组名称
3.3frontListList前置列表
3.3.1Object前置信息对象
3.3.1.1chainIdInt所属链编号
3.3.1.2frontIdInt前置编号
3.3.1.3nodeIdString节点id
3.3.1.4frontPeerNameString节点前置名称
3.4contractListList合约列表
3.4.1Object合约信息对象
3.4.1.1chainIdInt所属链编号
3.4.1.2groupIdInt群组编号
3.4.1.3contractIdInt合约编号
3.4.1.4contractPathString合约路径
3.4.1.5contractNameString合约名称
3.5contractListAddedByShelfList由本机构添加的合约列表(结构同contractList)
4attachmentString错误信息

2)出参示例

  • 成功:
  1. {
  2. "code": 0,
  3. "message": "success",
  4. "data": {
  5. "chainIdList": [
  6. 1
  7. ],
  8. "groupList": [
  9. {
  10. "chainId": 1,
  11. "groupId": 1,
  12. "groupName": "chain_1_group_1"
  13. },
  14. {
  15. "chainId": 1,
  16. "groupId": 2,
  17. "groupName": "chain_1_group_2"
  18. }
  19. ],
  20. "frontList": [
  21. {
  22. "chainId": 1,
  23. "frontId": 200036,
  24. "nodeId": "53060c93c5c7bfdc2b35ffae766e5e9f0ca16340f8e4ed09421cbbdb86cc974d57eb6460d41c33a71634f033a898d92486dd5081e2db1672bd426fff6e4af5f8",
  25. "frontPeerName": "peer0.testinvite.d292gp0toy"
  26. }
  27. ],
  28. "contractList": [
  29. {
  30. "chainId": 1,
  31. "groupId": 1,
  32. "contractId": 400030,
  33. "contractPath": "myPath",
  34. "contractName": "Ok"
  35. }
  36. ]
  37. },
  38. "attachment": null,
  39. "success": true
  40. }
  • 失败:
  1. {
  2. "code": 105000,
  3. "message": "system exception",
  4. "data": {}
  5. }

7.2 查询机构列表

7.2.1 传输协议规范

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

7.2.2 请求参数

1)入参表

序号输入参数类型可为空备注
1chainIdInt链编号
2groupIdInt群组编号
3nodeTypesList节点类型:sealer、observer、remove

2)入参示例

  • 案例一:
  1. curl -X GET "http://localhost:5005/WeBASE-Chain-Manager/agency/list?chainId=495&groupId=5"
  • 案例二:
  1. curl --location --request GET 'http://localhost:5005/WeBASE-Chain-Manager/agency/list?chainId=495&groupId=1&nodeTypes=observer,sealer'

7.2.3 返回参数

1)出参表

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

2)出参示例

  • 成功:
  1. {
  2. "code": 0,
  3. "message": "success",
  4. "data": [146],
  5. "attachment": null,
  6. "success": true
  7. }
  • 失败:
  1. {
  2. "code": 105000,
  3. "message": "system exception",
  4. "data": {}
  5. }

7.3 查询机构数

7.3.1 传输协议规范

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

7.3.2 请求参数

1)入参表

序号输入参数类型可为空备注
1chainIdint链编号
2groupIdint群组编号
3nodeTypesarray节点类型[“observer”,”sealer”,”remove”]

2)入参示例

  1. curl --location --request GET 'http://localhost:5005/WeBASE-Chain-Manager/agency/count?chainId=1&groupId=&nodeTypes=sealer,observer'

7.3.3 返回参数

1)出参表

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

2)出参示例

  • 成功:
  1. {
  2. "code": 0,
  3. "message": "success",
  4. "data": 3,
  5. "attachment": null,
  6. "success": true
  7. }
  • 失败:
  1. {
  2. "code": 102000,
  3. "message": "system exception",
  4. "data": {}
  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参数异常