接口说明

1. 合约接口

1.1. 发送abi接口

接口描述

根据abi内容判断合约是否已部署,未部署则生成对应abi文件

接口URL

http://localhost:5002/WeBASE-Front/contract/abiInfo

调用方法

HTTP POST

请求参数

1)参数表

序号中文参数名类型最大长度必填说明
1所属群组groupIdInteger
2合约名称contractNameString
3合约地址addressString
4合约abiabiInfoListabi文件里面的内容,是一个JSONArray
5合约bincontractBinString合约编译的runtime-bytecode(runtime-bin)

2)数据格式

  1. {
  2. "groupId": 1,
  3. "contractName": "HelloWorld",
  4. "address": "0x31b26e43651e9371c88af3d36c14cfd938baf4fd",
  5. "contractBin": "608060405234801561001057600080fd5b5060405161031d38038061031d8339810180",
  6. "abiInfo": [
  7. {"inputs": [{"type": "string", "name": "n"}], "constant": false, "name": "set",
  8. "outputs": [], "payable": false, "type": "function"},
  9. {"inputs": [], "constant": true, "name": "get", "outputs": [{"type": "string",
  10. "name": ""}], "payable": false, "type": "function"},
  11. {"inputs": [], "constant": false, "name": "HelloWorld", "outputs": [],
  12. "payable": false, "type": "function"}
  13. ]
  14. }

响应参数

1)数据格式

1.2. 合约部署接口(结合WeBASE-Sign)

接口描述

将合约部署到当前节点。此接口需结合WeBASE-Sign使用,通过调用WeBASE-Sign服务的签名接口让相关用户对数据进行签名,拿回签名数据再发送上链。需要调用此接口时,工程配置文件application.yml中的配置”keyServer”需配置WeBASE-Sign服务的ip和端口,并保证WeBASE-Sign服务正常和存在相关用户。

构造方法参数(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"]]

构造方法参数(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"]]

查看WeBASE-Front通过本地私钥(测试用户)部署合约的接口(非WeBASE-Sign签名交易),可查看其他接口-合约部署接口(本地签名)

接口URL

http://localhost:5002/WeBASE-Front/contract/deployWithSign

调用方法

HTTP POST

请求参数

1)参数表

序号中文参数名类型最大长度必填说明
1所属群组groupIdint
2用户编号signUserIdString64WeBASE-Sign中的用户编号,通过webase-sign创建私钥获取
3合约名称contractNameString
4合约abiabiInfoList合约编译后生成的abi文件内容
5合约binbytecodeBinString合约编译的bytecode(bin),用于部署合约
6构造函数参数funcParamList合约构造函数所需参数,JSON数组,多个参数以逗号分隔(参数为数组时同理),如:[“str1”,[“arr1”,”arr2”]]
7合约版本versionString用于指定合约在CNS中的版本

2)数据格式

  1. {
  2. "groupId":1,
  3. "signUserId": "458ecc77a08c486087a3dcbc7ab5a9c3",
  4. "bytecodeBin":"xxx",
  5. "abiInfo": [],
  6. "funcParam":[]
  7. }

示例:

  1. curl -X POST "http://localhost:5002/WeBASE-Front/contract/deployWithSign" -H "accept: */*" -H "Content-Type: application/json" -d "{ \"contractAbi\": [ { \"outputs\": [], \"constant\": false, \"payable\": false, \"inputs\": [ { \"name\": \"n\", \"type\": \"string\" } ], \"name\": \"set\", \"stateMutability\": \"nonpayable\", \"type\": \"function\" }, { \"outputs\": [ { \"name\": \"\", \"type\": \"string\" } ], \"constant\": true, \"payable\": false, \"inputs\": [], \"name\": \"get\", \"stateMutability\": \"view\", \"type\": \"function\" }, { \"payable\": false, \"inputs\": [], \"stateMutability\": \"nonpayable\", \"type\": \"constructor\" }, { \"inputs\": [ { \"indexed\": false, \"name\": \"name\", \"type\": \"string\" } ], \"name\": \"nameEvent\", \"anonymous\": false, \"type\": \"event\" } ], \"bytecodeBin\": \"608060405234801561001057600080fd5b506040805190810160405280600681526020017f68656c6c6f2100000000000000000000000000000000000000000000000000008152506000908051906020019061005c92919061011c565b507f9645e7fb5eec05c0f156d4901a10663561199c6dd0401214a0b833fe0022d899600060405180806020018281038252838181546001816001161561010002031660029004815260200191508054600181600116156101000203166002900480156101095780601f106100de57610100808354040283529160200191610109565b820191906000526020600020905b8154815290600101906020018083116100ec57829003601f168201915b50509250505060405180910390a16101c1565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061015d57805160ff191683800117855561018b565b8280016001018555821561018b579182015b8281111561018a57825182559160200191906001019061016f565b5b509050610198919061019c565b5090565b6101be91905b808211156101ba5760008160009055506001016101a2565b5090565b90565b610391806101d06000396000f30060806040526004361061004c576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680634ed3885e146100515780636d4ce63c146100ba575b600080fd5b34801561005d57600080fd5b506100b8600480360381019080803590602001908201803590602001908080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050919291929050505061014a565b005b3480156100c657600080fd5b506100cf61021e565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561010f5780820151818401526020810190506100f4565b50505050905090810190601f16801561013c5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b80600090805190602001906101609291906102c0565b507f9645e7fb5eec05c0f156d4901a10663561199c6dd0401214a0b833fe0022d8996000604051808060200182810382528381815460018160011615610100020316600290048152602001915080546001816001161561010002031660029004801561020d5780601f106101e25761010080835404028352916020019161020d565b820191906000526020600020905b8154815290600101906020018083116101f057829003601f168201915b50509250505060405180910390a150565b606060008054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156102b65780601f1061028b576101008083540402835291602001916102b6565b820191906000526020600020905b81548152906001019060200180831161029957829003601f168201915b5050505050905090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061030157805160ff191683800117855561032f565b8280016001018555821561032f579182015b8281111561032e578251825591602001919060010190610313565b5b50905061033c9190610340565b5090565b61036291905b8082111561035e576000816000905550600101610346565b5090565b905600a165627a7a723058201be6d6e6936e66c64b93771f9bd7ee708553fb6faf82e0273336fac2b1c6d83d0029\", \"funcParam\": [ ], \"groupId\": 1, \"signUserId\": "458ecc77a08c486087a3dcbc7ab5a9c3"}"

响应参数

1)数据格式

  1. {
  2. "0x7571ff73f1a37ca07f678aebc4d8213e7ef5c266"
  3. }

1.3. cns接口

接口描述

根据合约名及版本号查询合约地址

接口URL

http://localhost:5002/WeBASE-Front/contract/cns?groupId={groupId}&name={name}&version={version}

调用方法

HTTP GET

请求参数

  1. 参数表
序号中文参数名类型最大长度必填说明
1所属群组groupIdint
2合约名称nameString
3合约版本versionString

2)数据格式

  1. http://localhost:5002/WeBASE-Front/contract/cns?groupId=1&name=HelloWorld&version=2

响应参

1)数据格式

  1. {
  2. "0x31b26e43651e9371c88af3d36c14cfd938baf4fd"
  3. }

1.4. java转译接口

接口描述

将合约abi转成java文件

接口URL

http://localhost:5002/WeBASE-Front/contract/compile-java

调用方法

HTTP POST

请求参数

1)参数表

序号中文参数名类型最大长度必填说明
1合约名称contractNameString
2合约abiabiInfoList
3合约bincontractBinString合约编译的runtime-bytecode(runtime-bin)
4所在目录packageNameString生成java所在的包名

2)数据格式

  1. {
  2. "contractName": "HeHe",
  3. "abiInfo": [],
  4. "contractBin": "60806040526004361061004c576000357c0100000000000000000000029",
  5. "packageName": "com.webank"
  6. }

响应参数

1)数据格式 java文件

1.5. 保存合约接口

接口描述

支持前置的控制台保存合约信息

接口URL

http://localhost:5002/WeBASE-Front/contract/save

调用方法

HTTP POST

请求参数

1)参数表

序号中文参数名类型最大长度必填说明
1所属群组groupIdint
2合约编号contractIdint
3合约名称contractNameString
4合约所在目录contractPathString
5合约abicontractAbiString
6合约bytecodeBinbytecodeBinString合约编译的bytecode(bin),用于部署合约
7合约bincontractBinString合约编译的runtime-bytecode(runtime-bin),用于交易解析
8合约源码contractSourceString

2)数据格式

  1. {
  2. "groupId": "1",
  3. "contractName": "HeHe",
  4. "contractPath": "/",
  5. "contractSource": "cHJhZ21hIHNvbGlkaXR5IF4wLjQuMjsn0=",
  6. "contractAbi": “[]”
  7. "contractBin": "60806040526004361061004c576000357c0100000000000000000000000029",
  8. "bytecodeBin": "6080604052348015610010572269b80029",
  9. "contractId": 1
  10. }

响应参数

1)参数表

序号中文参数名类型最大长度必填说明
1合约编号idInteger
2所在目录contractPathString
3合约名称contractNameString
4合约状态contractStatusInteger1未部署,2已部署
5所属群组groupIdInteger
6合约源码contractSourceString
7合约abicontractAbiString合约编译后生成的abi文件内容
8合约bincontractBinString合约编译的runtime-bytecode(runtime-bin),用于交易解析
9合约bytecodeBinbytecodeBinString合约编译的bytecode(bin),用于部署合约
10合约地址contractAddressString
11部署时间deployTimeString
12修改时间modifyTimeString
13创建时间createTimeString
14备注descriptionString

2)数据格式

  1. {
  2. "id": 1,
  3. "contractPath": "/",
  4. "contractName": "HeHe",
  5. "contractStatus": 1,
  6. "groupId": 1,
  7. "contractSource": "cHJhZ21hIHNvbGlkaXR5IF4wLjQuMjsKCmICB9Cn0=",
  8. "contractAbi": "[{\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"}]",
  9. "contractBin": "60806040526004361061004c5760003569b80029",
  10. "bytecodeBin": "608060405234801561001057600080fd5b506029",
  11. "contractAddress": null,
  12. "deployTime": null,
  13. "description": null,
  14. "createTime": "2019-06-10 11:48:51",
  15. "modifyTime": "2019-06-10 15:31:29"
  16. }

1.6. 删除合约接口

接口描述

支持前置的控制台通过群组编号和合约编号删除未部署的合约信息

接口URL

http://localhost:5002/WeBASE-Front/contract/{groupId}/{contractId}

调用方法

HTTP DELETE

请求参数

1)参数表

序号中文参数名类型最大长度必填说明
1所属群组groupIdint
2合约编号contractIdint

2)数据格式

  1. http://localhost:5002/WeBASE-Front/contract/1/1

响应参数

1)参数表

序号中文参数名类型必填说明
1返回码codeString返回码信息请参看附录1
2提示信息messageString
3返回数据dataObject

2)数据格式

  1. {
  2. "code": 0,
  3. "message": "success",
  4. "data": null
  5. }

1.7. 分页查询合约列表

接口描述

支持前置的控制台分页查询合约列表

接口URL

http://localhost:5002/WeBASE-Front/contract/contractList

调用方法

HTTP POST

请求参数

1)参数表

序号中文参数名类型最大长度必填说明
1所属群组groupIdInteger
2合约名称contractNameString
3合约状态contractStatusInteger1未部署,2已部署
4合约地址contractAddressString
5当前页码pageNumberInteger从1开始
6每页记录数pageSizeInteger

2)数据格式

  1. {
  2. "groupId": "1",
  3. "pageNumber": 1,
  4. "pageSize": 10,
  5. "contractName": "",
  6. "contractAddress": "",
  7. "contractStatus": 2
  8. }

响应参数

1)参数表

序号中文参数名类型必填说明
1返回码codeString返回码信息请参看附录1
2提示信息messageString
3返回数据dataObject
3.1合约编号idInteger
3.2所在目录contractPathString
3.3合约名称contractNameString
3.4合约状态contractStatusInteger1未部署,2已部署
3.5所属群组groupIdInteger
3.6合约源码contractSourceString
3.7合约abicontractAbiString合约编译后生成的abi文件内容
3.8合约bincontractBinString合约编译的runtime-bytecode(runtime-bin),用于交易解析
3.9bytecodeBinbytecodeBinString合约编译的bytecode(bin),用于部署合约
3.10合约地址contractAddressString
3.11部署时间deployTimeString
3.12修改时间modifyTimeString
3.13创建时间createTimeString
3.14备注descriptionString

2)数据格式

  1. {
  2. "code": 0,
  3. "message": "success",
  4. "data": [
  5. {
  6. "id": 2,
  7. "contractPath": "/",
  8. "contractName": "HeHe",
  9. "contractStatus": 1,
  10. "groupId": 1,
  11. "contractSource": "cHJhZ21hIHNvbGlkaXR5IICB9Cn0=",
  12. "contractAbi": "",
  13. "contractBin": "",
  14. "bytecodeBin": null,
  15. "contractAddress": null,
  16. "deployTime": null,
  17. "description": null,
  18. "createTime": "2019-06-10 16:42:50",
  19. "modifyTime": "2019-06-10 16:42:52"
  20. }
  21. ],
  22. "totalCount": 1
  23. }

1.8. 合约是否被修改接口

接口描述

校验已部署的合约是否被修改了,返回true或false

接口URL

http://localhost:5002/WeBASE-Front/contract/ifChanged/{groupId}/{contractId}

调用方法

HTTP GET

请求参数

1)参数表

序号中文参数名类型最大长度必填说明
1所属群组groupIdint
2合约编号contractIdint

2)数据格式

  1. http://localhost:5002/WeBASE-Front/contract/ifChanged/1/10

响应参数

1)数据格式

  1. true

1.9. 后台编译合约

接口描述

通过后台的solcJ对solidity合约进行编译,返回合约的BIN与ABI

接口URL

http://localhost:5002/WeBASE-Front/contract/contractCompile

调用方法

HTTP POST

请求参数

1)参数表

序号中文参数名类型最大长度必填说明
1合约名称contractNameString
2合约源码solidityBase64String经过Base64编码的合约源码内容

2)数据格式

  1. {
  2. "contractName": "HelloWorld",
  3. "solidityBase64": "cHJhZ21hIHNvbGlkaXR5IF4wLjQuMjsKCmICB9Cn0"
  4. }

响应参数

1)参数表

序号中文参数名类型最大长度必填说明
1合约名称contractNameString
3合约binbytecodeBinString
4合约abicontractAbiString

2)数据格式

  1. {
  2. "contractName": "HeHe",
  3. "contractSource": "cHJhZ21hIHNvbGlkaXR5IF4wLjQuMjsKCmICB9Cn0=",
  4. "bytecodeBin": "608060405234801561001057600080fd5b506029",
  5. "contractAbi": "[{\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"}]",
  6. }

1.10. 多合约编译

接口描述

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

接口URL

http://localhost:5002/WeBASE-Front/contract/multiContractCompile

调用方法

HTTP POST

请求参数

1)参数表

序号中文参数名类型最大长度必填说明
1合约源码contractZipBase64String合约文件压缩成zip,并Base64编码

2)数据格式

  1. {
  2. "contractZipBase64": "UEsDBBQAAAAIAIqMeFAi98KgkQAAAPwAAAAOAAAASGVsbG9Xb3JsZC5zb2xdjjELwjAQhfdC/8ON7VJE3Iq7k4uDmxDSMwSSi1yugkj/u7GJNPjGe/e+9x6sjFcQg7OTlRfcdsNh2I9towMJKy1wQufCNbCb3m0DSVHYkgFSHsd8wSeSwAXlnG5d5ffl4T6TFhsIDErXJ3QUlRKMMjPFkui//Kzi1B3LHykm0q+pTqK32xRaB2StsCNtuOUDUEsBAj8AFAAAAAgAiox4UCL3wqCRAAAA/AAAAA4AJAAAAAAAAAAgAAAAAAAAAEhlbGxvV29ybGQuc29sCgAgAAAAAAABABgA3EMdrL8B1gGPz3r5xAjWAX8gr5/Rr9UBUEsFBgAAAAABAAEAYAAAAL0AAAAAAA=="
  3. }

响应参数

1)参数表

序号中文参数名类型最大长度必填说明
1合约名称contractNameString
2合约binbytecodeBinString
3合约abicontractAbiString
4合约内容contractSourceString单个合约内容Base64编码

2)数据格式

  1. [
  2. {
  3. "contractName": "HelloWorld",
  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. "contractSource": "cHJhZ21hIHNvbGlkaXR5IF4wLjQuMjsNCmNvbnRyYWN0IEhlbGxvV29ybGR7DQogICAgc3RyaW5nIG5hbWU7DQogICAgZXZlbnQgU2V0TmFtZShzdHJpbmcgbmFtZSk7DQogICAgZnVuY3Rpb24gZ2V0KCljb25zdGFudCByZXR1cm5zKHN0cmluZyl7DQogICAgICAgIHJldHVybiBuYW1lOw0KICAgIH0NCiAgICBmdW5jdGlvbiBzZXQoc3RyaW5nIG4pew0KICAgICAgICBlbWl0IFNldE5hbWUobik7DQogICAgICAgIG5hbWU9bjsNCiAgICB9DQp9",
  6. "bytecodeBin": "608060405234801561001057600080fd5b50610373806100206000396000f30060806040526004361061004c576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063299f7f9d146100515780633590b49f146100e1575b600080fd5b34801561005d57600080fd5b5061006661014a565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100a657808201518184015260208101905061008b565b50505050905090810190601f1680156100d35780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156100ed57600080fd5b50610148600480360381019080803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091929192905050506101ec565b005b606060008054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156101e25780601f106101b7576101008083540402835291602001916101e2565b820191906000526020600020905b8154815290600101906020018083116101c557829003601f168201915b5050505050905090565b7f05432a43e07f36a8b98100b9cb3631e02f8e796b0a06813610ce8942e972fb81816040518080602001828103825283818151815260200191508051906020019080838360005b8381101561024e578082015181840152602081019050610233565b50505050905090810190601f16801561027b5780820380516001836020036101000a031916815260200191505b509250505060405180910390a1806000908051906020019061029e9291906102a2565b5050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106102e357805160ff1916838001178555610311565b82800160010185558215610311579182015b828111156103105782518255916020019190600101906102f5565b5b50905061031e9190610322565b5090565b61034491905b80821115610340576000816000905550600101610328565b5090565b905600a165627a7a72305820cff924cb0783dc84e2e107aae1fd09e1e04154b80834c9267a4eaa630997b2b90029"
  7. }
  8. ]

1.11. 已签名交易发送

接口描述

发送已签名的交易上链,返回交易收据;

接口URL

http://localhost:5002/WeBASE-Front/trans/signed-transaction

调用方法

HTTP POST

请求参数

1)参数表

序号中文参数名类型最大长度必填说明
1已签名字符串signedStrString
2是否同步发送syncbool
2群组IDgroupIdint

2)数据格式

  1. {
  2. "signedStr": "0xddd",
  3. "sync": 1,
  4. "groupId":1
  5. }

响应参数

1)数据格式

  1. {
  2. "transactionHash": "0xb2c733b742045e61c0fd6e7e2bafece04d56262a4887de9f78dad2c5dd2f944b",
  3. "transactionIndex": 0,
  4. "blockHash": "0xf27ff42d4be65329a1e7b11365e190086d92f9836168d0379e92642786db7ade",
  5. "blockNumber": 100,
  6. "cumulativeGasUsed": 121038,
  7. "gasUsed": 121038,
  8. "contractAddress": "0x0000000000000000000000000000000000000000",
  9. "root": null,
  10. "from": null,
  11. "to": null,
  12. "logs": [
  13. {
  14. "removed": false,
  15. "logIndex": 0,
  16. "transactionIndex": 0,
  17. "transactionHash": "0xb2c733b742045e61c0fd6e7e2bafece04d56262a4887de9f78dad2c5dd2f944b",
  18. "blockHash": "0xf27ff42d4be65329a1e7b11365e190086d92f9836168d0379e92642786db7ade",
  19. "blockNumber": 100,
  20. "address": "0x986278eb8e8b4ef98bdfc055c02d65865fc87ad2",
  21. "data": "0x00000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000160000000000000000000000000000000000000000000000000000000000000001caf3fbec3675eabb85c0b25e2992d6f0a5e1546dad85c20733fdb27cfa4ca782a5fdfb621b416f3494c7d8ca436c12309884550d402ea79f03ef8ddfdd494f7a40000000000000000000000000000000000000000000000000000000000000040666164363863656230616530316530643731616635356331316561643031613532656638363435343866306134643133633836363164393664326461366239380000000000000000000000000000000000000000000000000000000000000002363000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000023630000000000000000000000000000000000000000000000000000000000000",
  22. "type": "mined",
  23. "topics": [
  24. "0xbf474e795141390215f4f179557402a28c562b860f7b74dce4a3c0e0604cd97e"
  25. ],
  26. "logIndexRaw": "0",
  27. "blockNumberRaw": "100",
  28. "transactionIndexRaw": "0"
  29. }
  30. ],
  31. "logsBloom": null,
  32. "gasUsedRaw": "0x1d8ce",
  33. "blockNumberRaw": "100",
  34. "transactionIndexRaw": "0",
  35. "cumulativeGasUsedRaw": "0x1d8ce",
  36. "message": null,
  37. "txProof": null,
  38. "receiptProof": null
  39. }

1.12. 已编码查询交易发送

接口描述

发送已编码的查询交易,返回合约的返回值;

接口URL

http://localhost:5002/WeBASE-Front/trans/query-transaction

调用方法

HTTP POST

请求参数

1)参数表

序号中文参数名类型最大长度必填说明
1已编码字符串encodeStrString
2合约地址contractAddressString
3群组IDgroupIdint
4合约名funcNameString
5合约abicontractAbiString
6用户地址userAddressString

2)数据格式

  1. {
  2. "encodeStr": "0xddd",
  3. "contractAddress": "0x2b5ad5c4795c026514f8317c7a215e218dccd6cf",
  4. "groupId":1,
  5. "funcName": "get",
  6. "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\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"num\",\"type\":\"uint256\"}],\"name\":\"TransEvent\",\"type\":\"event\"}]"
  7. }

响应参数

Object返回类型

  1. {"Hi,Welcome!"}

2. 密钥接口

2.1. 获取公私钥接口

接口描述

通过调用此接口获取公私钥对和对应账户信息

接口URL

http://localhost:5002/WeBASE-Front/privateKey?type={type}&userName={userName}

调用方法

HTTP GET

请求参数

1)参数表

序号中文参数名类型最大长度必填说明
1私钥类型typeint0-本地用户;1-本地随机;2-外部用户
2用户名userNameString类型为本地用户时必填

2)数据格式

  1. http://localhost:5002/WeBASE-Front/privateKey?type=0&userName=test

响应参数

1)数据格式 本地用户时:

  1. {
  2. "address": "0x2007e1430f41f75c850464307c0994472bd92ee0",
  3. "publicKey": "0x9bd35211855f9f8de22d8a8da7f30d35d62ab2c3d36ea5162008fcbb9faff4d83809f7033deb20049bf51e081105076ec7a09a847f852530f81e978b1eda0392",
  4. "privateKey": "42caa160cadcb635381b980ddd981171c862d3105981fe92d6db330f30615f21",
  5. "userName": "test",
  6. "type": 0,
  7. "signUserId": null, // 本地用户则为空
  8. "appId": null // 本地用户则为空
  9. }

外部用户时(来自WeBASE-Sign):

  1. {
  2. "address": "0x2007e1430f41f75c850464307c0994472bd92ee0",
  3. "publicKey": "0x9bd35211855f9f8de22d8a8da7f30d35d62ab2c3d36ea5162008fcbb9faff4d83809f7033deb20049bf51e081105076ec7a09a847f852530f81e978b1eda0392",
  4. "userName": "test",
  5. "type": 0,
  6. "signUserId": "458ecc77a08c486087a3dcbc7ab5a9c3",
  7. "appId": "458ecc77a08c486087a3dcbc7ab5a9c3"
  8. }

2.2. 导入私钥接口

接口描述

导入私钥信息,并返回对应的公钥及用户地址

接口URL

http://localhost:5002/WeBASE-Front/privateKey/import?privateKey={privateKey}&userName={userName}

调用方法

HTTP GET

请求参数

1)参数表

序号中文参数名类型最大长度必填说明
1私钥信息privateKeyString
2用户名userNameString

2)数据格式

  1. http://localhost:5002/WeBASE-Front/privateKey/import?privateKey=8cf98bd0f37fb0984ab43ed6fc2dcdf58811522af7e4a3bedbe84636a79a501c&userName=lili

响应参数

1)数据格式

  1. {
  2. "address": "0x2e8ff65fb1b2ce5b0c9476b8f8beb221445f42ee",
  3. "publicKey": "0x1c7073dc185af0644464b178da932846666a858bc492450e9e94c77203428ed54e2ce45679dbb36bfed714dbe055a215dc1aaf4a75faeddce6a62b39c0158e1e",
  4. "privateKey": "8cf98bd0f37fb0984ab43ed6fc2dcdf58811522af7e4a3bedbe84636a79a501c",
  5. "userName": "lili",
  6. "type": 0
  7. }

2.3. 获取本地公私钥列表接口

接口描述

返回本地公私钥信息列表

接口URL

http://localhost:5002/WeBASE-Front/privateKey/localKeyStores

调用方法

HTTP GET

请求参数

1)参数表

2)数据格式

  1. http://localhost:5002/WeBASE-Front/privateKey/localKeyStores

响应参数

1)数据格式

  1. [
  2. {
  3. "address": "0x2007e1430f41f75c850464307c0994472bd92ee0",
  4. "publicKey": "0x9bd35211855f9f8de22d8a8da7f30d35d62ab2c3d36ea5162008fcbb9faff4d83809f7033deb20049bf51e081105076ec7a09a847f852530f81e978b1eda0392",
  5. "privateKey": "42caa160cadcb635381b980ddd981171c862d3105981fe92d6db330f30615f21",
  6. "userName": "test",
  7. "type": 0
  8. },
  9. {
  10. "address": "0x2e8ff65fb1b2ce5b0c9476b8f8beb221445f42ee",
  11. "publicKey": "0x1c7073dc185af0644464b178da932846666a858bc492450e9e94c77203428ed54e2ce45679dbb36bfed714dbe055a215dc1aaf4a75faeddce6a62b39c0158e1e",
  12. "privateKey": "8cf98bd0f37fb0984ab43ed6fc2dcdf58811522af7e4a3bedbe84636a79a501c",
  13. "userName": "lili",
  14. "type": 0
  15. }
  16. ]

2.4. 删除公私钥接口

接口描述

支持前置的控制台通过用户地址删除公私钥信息

接口URL

http://localhost:5002/WeBASE-Front/privateKey/{address}

调用方法

HTTP DELETE

请求参数

1)参数表

序号中文参数名类型最大长度必填说明
1用户地址addressString

2)数据格式

  1. http://localhost:5002/WeBASE-Front/privateKey/0x2e8ff65fb1b2ce5b0c9476b8f8beb221445f42ee

响应参数

1)参数表

序号中文参数名类型必填说明
1返回码codeString返回码信息请参看附录1
2提示信息messageString
3返回数据dataObject

2)数据格式

  1. {
  2. "code": 0,
  3. "message": "success",
  4. "data": null
  5. }

2.5. 导入.pem私钥用户

接口描述

导入.pem格式的私钥

接口URL

http://localhost:5002/WeBASE-Front/privateKey/importPem

调用方法

HTTP POST

请求参数

1)参数表

序号中文参数名类型最大长度必填说明
1pem文件内容pemContentString必须以——-BEGIN PRIVATE KEY——-\n开头,以\n——-END PRIVATE KEY——-\n结尾的格式
2用户名userNameString

2)数据格式

  1. http://localhost:5002/WeBASE-Front/privateKey/importPem
  1. {
  2. "pemContent":"-----BEGIN PRIVATE KEY-----\nMIGEAgEAMBAGByqGSM49AgEGBSuBBAAKBG0wawIBAQQgC8TbvFSMA9y3CghFt51/\nXmExewlioX99veYHOV7dTvOhRANCAASZtMhCTcaedNP+H7iljbTIqXOFM6qm5aVs\nfM/yuDBK2MRfFbfnOYVTNKyOSnmkY+xBfCR8Q86wcsQm9NZpkmFK\n-----END PRIVATE KEY-----\n",
  3. "userName":"test222"
  4. }

响应参数

1)参数表

序号中文参数名类型必填说明
1返回码codeString返回码信息请参看附录1
2提示信息messageString
3返回数据dataObject

2)数据格式

  1. {
  2. "code": 0,
  3. "message": "success",
  4. "data": null
  5. }

2.6. 导入.p12私钥用户

接口描述

导入.p12格式的私钥

接口URL

http://localhost:5002/WeBASE-Front/privateKey/importP12

调用方法

HTTP POST | Content-type: form-data

请求参数

1)参数表

序号中文参数名类型最大长度必填说明
1p12文件p12FileMultipartFile
2p12文件密码p12PasswordString缺省时默认为””,即空密码;p12无密码时,可传入空值或不传;不包含中文
2用户名userNameString

2)数据格式

  1. http://localhost:5002/WeBASE-Front/privateKey/importP12

响应参数

1)参数表

序号中文参数名类型必填说明
1返回码codeString返回码信息请参看附录1
2提示信息messageString
3返回数据dataObject

2)数据格式

  1. {
  2. "code": 0,
  3. "message": "success",
  4. "data": null
  5. }

2.7. 导入私钥到WeBASE-Sign

接口描述

导入私钥到WeBASE-Sign,其中privateKey经过Base64加密

接口URL

http://localhost:5002/WeBASE-Front/privateKey/importWithSign

调用方法

HTTP POST | Content-type: form-data

请求参数

1)参数表

序号中文参数名类型最大长度必填说明
1用户编号signUserIdString64
2应用编号appIdString64
2私钥privateKeyString经过Base64加密后的内容

2)数据格式

  1. http://localhost:5002/WeBASE-Front/privateKey/importWithSign
  1. {
  2. "privateKey": "OGFmNWIzMzNmYTc3MGFhY2UwNjdjYTY3ZDRmMzE4MzU4OWRmOThkMjVjYzEzZGFlMGJmODhkYjhlYzVhMDcxYw==",
  3. "appId": "app_001",
  4. "signUserId": "user_001"
  5. }

响应参数

1)参数表

序号中文参数名类型必填说明
1返回码codeString返回码信息请参看附录1
2提示信息messageString
3返回数据dataObject

2)数据格式

  1. {
  2. "code": 0,
  3. "message": "success",
  4. "data": null
  5. }

3. web3接口

3.1. 获取块高接口

接口描述

获取节点最新块高

接口URL

http://localhost:5002/WeBASE-Front/{groupId}/web3/blockNumber

调用方法

HTTP GET

请求参数

1)参数表

序号中文参数名类型最大长度必填说明
1群组编号groupIdint

2)数据格式

  1. http://localhost:5002/WeBASE-Front/1/web3/blockNumbe

响应参数

1)数据格式

  1. {
  2. 8346
  3. }

3.2. 根据块高获取块信息接口

接口描述

通过块高获取块信息

接口URL

http://localhost:5002/WeBASE-Front/1/web3/blockByNumber/{blockNumber}

调用方法

HTTP GET

请求参数

  1. 参数表
序号中文参数名类型最大长度必填说明
1群组编号groupIdint
2块高blockNumberBigInteger

2)数据格式

  1. http://localhost:5002/WeBASE-Front/1/web3/blockByNumber/100

响应参数

1)数据格式

  1. {
  2. "code": 0,
  3. "message": "success",
  4. "data": {
  5. "number": 100,
  6. "hash": "0xf27ff42d4be65329a1e7b11365e190086d92f9836168d0379e92642786db7ade",
  7. "parentHash": "0xc784a2af86e6726fcdc63b57ed1b91a40efc7d8b1b7285154d399ea78bd18754",
  8. "nonce": 0,
  9. "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
  10. "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000040000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000800000000000000000000000000",
  11. "transactionsRoot": "0x27055bac669a67e8aaa1455ad9fd70b75dd86dc905c6bd0d111ed67ab182d1dc",
  12. "stateRoot": "0xa05ad5db11b8be6aed3b591f2f64fdbb241506cbe9ef591f3a4b946ca777f838",
  13. "receiptsRoot": "0xc1d4b43ed68d7263ddf50861feec26440e933a0b152917e938194f5079b48ce4",
  14. "author": "0x0000000000000000000000000000000000000000",
  15. "miner": "0x0000000000000000000000000000000000000000",
  16. "mixHash": null,
  17. "difficulty": 1,
  18. "totalDifficulty": 101,
  19. "extraData": "0xd98097312e332e302b2b302d524c696e75782f672b2b2f496e74",
  20. "size": 71,
  21. "gasLimit": 2000000000,
  22. "gasUsed": 121038,
  23. "timestamp": 1526437108478,
  24. "transactions": [
  25. {
  26. "hash": "0xb2c733b742045e61c0fd6e7e2bafece04d56262a4887de9f78dad2c5dd2f944b",
  27. "nonce": 9.1623055443573E+74,
  28. "blockHash": "0xf27ff42d4be65329a1e7b11365e190086d92f9836168d0379e92642786db7ade",
  29. "blockNumber": 100,
  30. "transactionIndex": 0,
  31. "from": "0x59bd3815f73b197d6ef327f2a45089f50aba942a",
  32. "to": "0x986278eb8e8b4ef98bdfc055c02d65865fc87ad2",
  33. "value": 0,
  34. "gasPrice": 30000000,
  35. "gas": 30000000,
  36. "input": "0x48f85bce000000000000000000000000000000000000000000000000000000000000001caf3fbec3675eabb85c0b25e2992d6f0a5e1546dad85c20733fdb27cfa4ca782a5fdfb621b416f3494c7d8ca436c12309884550d402ea79f03ef8ddfdd494f7a4",
  37. "creates": null,
  38. "publicKey": null,
  39. "raw": null,
  40. "r": null,
  41. "s": null,
  42. "v": 0,
  43. "valueRaw": "0x0",
  44. "gasPriceRaw": "0x1c9c380",
  45. "gasRaw": "0x1c9c380",
  46. "blockNumberRaw": "0x64",
  47. "transactionIndexRaw": "0x0",
  48. "nonceRaw": "0x2069170146129593df177e2c37f1b7fe74e2d0fda53dcbbca34a243d46e367a"
  49. }
  50. ],
  51. "uncles": [],
  52. "sealFields": null,
  53. "gasUsedRaw": "0x1d8ce",
  54. "totalDifficultyRaw": "0x65",
  55. "numberRaw": "0x64",
  56. "nonceRaw": null,
  57. "sizeRaw": "0x47",
  58. "gasLimitRaw": "0x77359400",
  59. "timestampRaw": "0x16366bddafe",
  60. "difficultyRaw": "0x1"
  61. }
  62. }

3.3. 根据块hash获取块信息接口

接口描述

通过块hash获取块信息

接口URL

http://localhost:5002/WeBASE-Front/{groupId}/web3/blockByHash/{blockHash}

调用方法

HTTP GET

请求参数

1)参数表

序号中文参数名类型最大长度必填说明
1群组编号groupIdint
2区块hashblockByHashString

2)数据格式

  1. http://localhost:5002/WeBASE-Front/1/web3/blockByHash/0xf27ff42d4be65329a1e7b11365e190086d92f9836168d0379e92642786db7ade

响应参数

1)数据格式

  1. {
  2. "code": 0,
  3. "message": "success",
  4. "data": {
  5. "number": 100,
  6. "hash": "0xf27ff42d4be65329a1e7b11365e190086d92f9836168d0379e92642786db7ade",
  7. "parentHash": "0xc784a2af86e6726fcdc63b57ed1b91a40efc7d8b1b7285154d399ea78bd18754",
  8. "nonce": 0,
  9. "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
  10. "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000040000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000800000000000000000000000000",
  11. "transactionsRoot": "0x27055bac669a67e8aaa1455ad9fd70b75dd86dc905c6bd0d111ed67ab182d1dc",
  12. "stateRoot": "0xa05ad5db11b8be6aed3b591f2f64fdbb241506cbe9ef591f3a4b946ca777f838",
  13. "receiptsRoot": "0xc1d4b43ed68d7263ddf50861feec26440e933a0b152917e938194f5079b48ce4",
  14. "author": "0x0000000000000000000000000000000000000000",
  15. "miner": "0x0000000000000000000000000000000000000000",
  16. "mixHash": null,
  17. "difficulty": 1,
  18. "totalDifficulty": 101,
  19. "extraData": "0xd98097312e332e302b2b302d524c696e75782f672b2b2f496e74",
  20. "size": 71,
  21. "gasLimit": 2000000000,
  22. "gasUsed": 121038,
  23. "timestamp": 1526437108478,
  24. "transactions": [
  25. {
  26. "hash": "0xb2c733b742045e61c0fd6e7e2bafece04d56262a4887de9f78dad2c5dd2f944b",
  27. "nonce": 9.1623055443573E+74,
  28. "blockHash": "0xf27ff42d4be65329a1e7b11365e190086d92f9836168d0379e92642786db7ade",
  29. "blockNumber": 100,
  30. "transactionIndex": 0,
  31. "from": "0x59bd3815f73b197d6ef327f2a45089f50aba942a",
  32. "to": "0x986278eb8e8b4ef98bdfc055c02d65865fc87ad2",
  33. "value": 0,
  34. "gasPrice": 30000000,
  35. "gas": 30000000,
  36. "input": "0x48f85bce000000000000000000000000000000000000000000000000000000000000001caf3fbec3675eabb85c0b25e2992d6f0a5e1546dad85c20733fdb27cfa4ca782a5fdfb621b416f3494c7d8ca436c12309884550d402ea79f03ef8ddfdd494f7a4",
  37. "creates": null,
  38. "publicKey": null,
  39. "raw": null,
  40. "r": null,
  41. "s": null,
  42. "v": 0,
  43. "valueRaw": "0x0",
  44. "gasPriceRaw": "0x1c9c380",
  45. "gasRaw": "0x1c9c380",
  46. "blockNumberRaw": "0x64",
  47. "transactionIndexRaw": "0x0",
  48. "nonceRaw": "0x2069170146129593df177e2c37f1b7fe74e2d0fda53dcbbca34a243d46e367a"
  49. }
  50. ],
  51. "uncles": [],
  52. "sealFields": null,
  53. "gasUsedRaw": "0x1d8ce",
  54. "totalDifficultyRaw": "0x65",
  55. "numberRaw": "0x64",
  56. "nonceRaw": null,
  57. "sizeRaw": "0x47",
  58. "gasLimitRaw": "0x77359400",
  59. "timestampRaw": "0x16366bddafe",
  60. "difficultyRaw": "0x1"
  61. }
  62. }

3.4. 获取块中交易个数接口

接口描述

根据块高获取该块中的交易个数

接口URL

http://localhost:5002/WeBASE-Front/{groupId}/web3/blockTransCnt/{blockNumber}

调用方法

HTTP GET

请求参数

  1. 参数表
序号中文参数名类型最大长度必填说明
1群组编号groupIdint
2块高blockNumberBigInteger

2)数据格式

  1. http://localhost:5002/WeBASE-Front/1/web3/blockTransCnt/100

响应参数

1)数据格式

  1. {
  2. 1
  3. }

3.5. 获取PbftView接口

接口描述

通过调用此接口获取PbftView

接口URL

http://localhost:5002/WeBASE-Front/{groupId}/web3/pbftView

调用方法

HTTP GET

请求参数

  1. 参数表
序号中文参数名类型最大长度必填说明
1群组编号groupIdint

2)数据格式

  1. http://localhost:5002/WeBASE-Front/1/web3/pbftView

响应参数

1)数据格式

  1. {
  2. 160565
  3. }

3.6. 获取交易回执接口

接口描述

根据交易hash获取交易回执

接口URL

http://localhost:5002/WeBASE-Front/{groupId}/web3/transactionReceipt/{transHash}

调用方法

HTTP GET

请求参数

1)参数表

序号中文参数名类型最大长度必填说明
1群组编号groupIdint
2交易hashtransHashString

2)数据格式

  1. http://localhost:5002/WeBASE-Front/1/web3/transactionReceipt/0xb2c733b742045e61c0fd6e7e2bafece04d56262a4887de9f78dad2c5dd2f944b

响应参数

2)数据格式

  1. {
  2. "transactionHash": "0xb2c733b742045e61c0fd6e7e2bafece04d56262a4887de9f78dad2c5dd2f944b",
  3. "transactionIndex": 0,
  4. "blockHash": "0xf27ff42d4be65329a1e7b11365e190086d92f9836168d0379e92642786db7ade",
  5. "blockNumber": 100,
  6. "cumulativeGasUsed": 121038,
  7. "gasUsed": 121038,
  8. "contractAddress": "0x0000000000000000000000000000000000000000",
  9. "root": null,
  10. "from": null,
  11. "to": null,
  12. "logs": [
  13. {
  14. "removed": false,
  15. "logIndex": 0,
  16. "transactionIndex": 0,
  17. "transactionHash": "0xb2c733b742045e61c0fd6e7e2bafece04d56262a4887de9f78dad2c5dd2f944b",
  18. "blockHash": "0xf27ff42d4be65329a1e7b11365e190086d92f9836168d0379e92642786db7ade",
  19. "blockNumber": 100,
  20. "address": "0x986278eb8e8b4ef98bdfc055c02d65865fc87ad2",
  21. "data": "0x00000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000160000000000000000000000000000000000000000000000000000000000000001caf3fbec3675eabb85c0b25e2992d6f0a5e1546dad85c20733fdb27cfa4ca782a5fdfb621b416f3494c7d8ca436c12309884550d402ea79f03ef8ddfdd494f7a40000000000000000000000000000000000000000000000000000000000000040666164363863656230616530316530643731616635356331316561643031613532656638363435343866306134643133633836363164393664326461366239380000000000000000000000000000000000000000000000000000000000000002363000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000023630000000000000000000000000000000000000000000000000000000000000",
  22. "type": "mined",
  23. "topics": [
  24. "0xbf474e795141390215f4f179557402a28c562b860f7b74dce4a3c0e0604cd97e"
  25. ],
  26. "logIndexRaw": "0",
  27. "blockNumberRaw": "100",
  28. "transactionIndexRaw": "0"
  29. }
  30. ],
  31. "logsBloom": null,
  32. "gasUsedRaw": "0x1d8ce",
  33. "blockNumberRaw": "100",
  34. "transactionIndexRaw": "0",
  35. "cumulativeGasUsedRaw": "0x1d8ce",
  36. "message": null,
  37. "txProof": null,
  38. "receiptProof": null
  39. }

3.7. 根据交易hash获取交易信息接口

接口描述

根据交易hash获取交易信息

接口URL

http://localhost:5002/WeBASE-Front/{groupId}/web3/transaction/{transHash}

调用方法

HTTP GET

请求参数

1)参数表

序号中文参数名类型最大长度必填说明
1群组编号groupIdint
2交易hashtransHashString

2)数据格式

  1. http://localhost:5002/WeBASE-Front/1/web3/transaction/0xa6750b812b1a7e36313879b09f0c41fc583b463c15e57608416f3a32688b432b

响应参数

1)数据格式

  1. {
  2. "hash": "0xb2c733b742045e61c0fd6e7e2bafece04d56262a4887de9f78dad2c5dd2f944b",
  3. "nonce": 9.1623055443573E+74,
  4. "blockHash": "0xf27ff42d4be65329a1e7b11365e190086d92f9836168d0379e92642786db7ade",
  5. "blockNumber": 100,
  6. "transactionIndex": 0,
  7. "from": "0x59bd3815f73b197d6ef327f2a45089f50aba942a",
  8. "to": "0x986278eb8e8b4ef98bdfc055c02d65865fc87ad2",
  9. "value": 0,
  10. "gasPrice": 30000000,
  11. "gas": 30000000,
  12. "input": "0x48f85bce000000000000000000000000000000000000000000000000000000000000001caf3fbec3675eabb85c0b25e2992d6f0a5e1546dad85c20733fdb27cfa4ca782a5fdfb621b416f3494c7d8ca436c12309884550d402ea79f03ef8ddfdd494f7a4",
  13. "creates": null,
  14. "publicKey": null,
  15. "raw": null,
  16. "r": null,
  17. "s": null,
  18. "v": 0,
  19. "nonceRaw": "0x2069170146129593df177e2c37f1b7fe74e2d0fda53dcbbca34a243d46e367a",
  20. "blockNumberRaw": "0x64",
  21. "transactionIndexRaw": "0x0",
  22. "valueRaw": "0x0",
  23. "gasPriceRaw": "0x1c9c380",
  24. "gasRaw": "0x1c9c380"
  25. }

3.8. 获取web3j版本接口

接口描述

获取web3j版本

接口URL

http://localhost:5002/WeBASE-Front/{groupId}/web3/clientVersion

调用方法

HTTP GET

请求参数

1)参数表

无入参

2)数据格式

  1. http://localhost:5002/WeBASE-Front/1/web3/clientVersion

响应参数

1)参数表

序号中文参数名类型最大长度必填说明
1群组编号groupIdint

2)数据格式

  1. {
  2. "Build Time": "20190318 10:56:37",
  3. "Build Type": "Linux/g++/RelWithDebInfo",
  4. "FISCO-BCOS Version": "2.0.0-rc1",
  5. "Git Branch": "master",
  6. "Git Commit Hash": "2467ddf73b091bc8e0ee611ccee85db7989ad389"
  7. }

3.9. 获取合约二进制代码接口

接口描述

获取指定块高区块指定合约地址的二进制代码

接口URL

http://localhost:5002/WeBASE-Front/{groupId}/web3/code/{address}/{blockNumber}

调用方法

HTTP GET

请求参数

1)参数表

序号中文参数名类型最大长度必填说明
1群组编号groupIdint
2合约地址addressString
3块高blockNumberBigInteger

2)数据格式

  1. http://localhost:5002/WeBASE-Front/1/web3/code/0x0000000000000000000000000000000000000000/1

响应参数

1)数据格式

  1. {
  2. 0xxxx
  3. }

3.10. 获取总交易数

接口描述

获取总交易数量

接口URL

http://localhost:5002/WeBASE-Front/{groupId}/web3/transaction-total

调用方法

HTTP GET

请求参数

1)参数表

序号中文参数名类型最大长度必填说明
1群组编号groupIdint

2)数据格式

  1. http://localhost:5002/WeBASE-Front/1/web3/transaction-total

响应参数

1)参数表

序号中文参数名类型最大长度必填说明
1总交易数txSumint
2快高blockNumberint
3blockNumberRawString
4txSumRawString

2)数据格式

  1. {
  2. "txSum": 125,
  3. "blockNumber": 125,
  4. "blockNumberRaw": "0x7d",
  5. "txSumRaw": "0x7d"
  6. }

3.11. 根据块hash和交易index获取交易接口

接口描述

获取指定区块指定位置的交易信息

接口URL

http://localhost:5002/WeBASE-Front/{groupId}/web3/transByBlockHashAndIndex/{blockHash}/{transactionIndex}

调用方法

HTTP GET

请求参数

1)参数表

序号中文参数名类型最大长度必填说明
1群组编号groupIdint
2块hashblockHashString
3交易位置transactionIndexBigInteger

2)数据格式

  1. http://localhost:5002/WeBASE-Front/1/web3/transByBlockHashAndIndex/0xf27ff42d4be65329a1e7b11365e190086d92f9836168d0379e92642786db7ade/0

响应参数

1)数据格式

  1. {
  2. "hash": "0x7c503f202a5e275d8792dd2419ac48418dbec602038fb2a85c899403471f065d",
  3. "nonce": 1.26575985412899E+75,
  4. "blockHash": "0x0d9ed7b20645d5b8200347a72e7fb15347b83d74c6e1b6c3995cdb7a849f95d9",
  5. "blockNumber": 100,
  6. "transactionIndex": 0,
  7. "from": "0x6f00a620a61fd6b33e6076880fecc49959eaa4ea",
  8. "to": "0x9cb5641d991df690ed905c34f9aaf22370034220",
  9. "value": 0,
  10. "gasPrice": 1,
  11. "gas": 100000000,
  12. "input": "0x4ed3885e000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000016100000000000000000000000000000000000000000000000000000000000000",
  13. "creates": null,
  14. "publicKey": null,
  15. "raw": null,
  16. "r": null,
  17. "s": null,
  18. "v": 0,
  19. "blockNumberRaw": "0x64",
  20. "nonceRaw": "0x2cc650a5cbeb268577ac15c7dd2afee0680901de94f8543e86e906247e7edbf",
  21. "valueRaw": "0x0",
  22. "gasPriceRaw": "0x1",
  23. "gasRaw": "0x5f5e100",
  24. "transactionIndexRaw": "0x0"
  25. }

3.12. 根据块高和交易index获取交易接口

接口描述

获取指定区块指定位置的交易信息

接口URL

http://localhost:5002/WeBASE-Front/{groupId}/web3/transByBlockNumberAndIndex/{blockNumber}/{transactionIndex}

调用方法

HTTP GET

请求参数

1)参数表

序号中文参数名类型最大长度必填说明
1群组编号groupIdint
2块高blockNumberBigInteger
3交易位置transactionIndexBigInteger

2)数据格式

  1. http://localhost:5002/WeBASE-Front/1/web3/transByBlockNumberAndIndex/100/0

响应参数

1)数据格式

  1. {
  2. "hash": "0x7c503f202a5e275d8792dd2419ac48418dbec602038fb2a85c899403471f065d",
  3. "nonce": 1.26575985412899E+75,
  4. "blockHash": "0x0d9ed7b20645d5b8200347a72e7fb15347b83d74c6e1b6c3995cdb7a849f95d9",
  5. "blockNumber": 100,
  6. "transactionIndex": 0,
  7. "from": "0x6f00a620a61fd6b33e6076880fecc49959eaa4ea",
  8. "to": "0x9cb5641d991df690ed905c34f9aaf22370034220",
  9. "value": 0,
  10. "gasPrice": 1,
  11. "gas": 100000000,
  12. "input": "0x4ed3885e000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000016100000000000000000000000000000000000000000000000000000000000000",
  13. "creates": null,
  14. "publicKey": null,
  15. "raw": null,
  16. "r": null,
  17. "s": null,
  18. "v": 0,
  19. "blockNumberRaw": "0x64",
  20. "nonceRaw": "0x2cc650a5cbeb268577ac15c7dd2afee0680901de94f8543e86e906247e7edbf",
  21. "valueRaw": "0x0",
  22. "gasPriceRaw": "0x1",
  23. "gasRaw": "0x5f5e100",
  24. "transactionIndexRaw": "0x0"
  25. }

3.13. 获取群组内的共识状态信息接口

接口描述

返回指定群组内的共识状态信息

接口URL

http://localhost:5002/WeBASE-Front/{groupId}/web3/consensusStatus

调用方法

HTTP GET

请求参数

1)参数表

序号中文参数名类型最大长度必填说明
1群组编号groupIdint

2)数据格式

  1. http://localhost:5002/WeBASE-Front/1/web3/consensusStatus

响应参数

1)数据格式

  1. [
  2. {
  3. "accountType": 1,
  4. "allowFutureBlocks": true,
  5. "cfgErr": false,
  6. "connectedNodes": 3,
  7. "consensusedBlockNumber": 126,
  8. "currentView": 499824,
  9. "groupId": 1,
  10. "highestblockHash": "0x563d4ec57b597d5d81f0c1b0045c04e57ffebe3a02ff3fef402be56742dc8fd1",
  11. "highestblockNumber": 125,
  12. "leaderFailed": false,
  13. "max_faulty_leader": 1,
  14. "node index": 2,
  15. "nodeId": "d822165959a0ed217df6541f1a7dd38b79336ff571dd5f8f85ad76f3e7ec097e1eabd8b03e4a757fd5a9fb0eea905aded56aaf44df83c34b73acb9ab7ac65010",
  16. "nodeNum": 4,
  17. "omitEmptyBlock": true,
  18. "protocolId": 264,
  19. "sealer.0": "552398be0eef124c000e632b0b76a48c52b6cfbd547d92c15527c2d1df15fab2bcded48353db22526c3540e4ab2027630722889f20a4a614bb11a7887a85941b",
  20. "sealer.1": "adfa2f9116d7ff68e0deb75307fa1595d636bf097ad1de4fb55cff00e4fef40b453abb30388aa2112bf5cd4c987afe2e047250f7049791aa1ee7091c9e2ab7bb",
  21. "sealer.2": "d822165959a0ed217df6541f1a7dd38b79336ff571dd5f8f85ad76f3e7ec097e1eabd8b03e4a757fd5a9fb0eea905aded56aaf44df83c34b73acb9ab7ac65010",
  22. "sealer.3": "dde0bbf5eb3a731e6da861586e98e088e16e6fdd9afae2f2c213cead20a4f5eaa3910042b70d62266d2350d98a43c1f235c8e0da384448384893857873abdb75",
  23. "toView": 499824
  24. },
  25. [
  26. {
  27. "nodeId": "552398be0eef124c000e632b0b76a48c52b6cfbd547d92c15527c2d1df15fab2bcded48353db22526c3540e4ab2027630722889f20a4a614bb11a7887a85941b",
  28. "view": 499823
  29. },
  30. {
  31. "nodeId": "adfa2f9116d7ff68e0deb75307fa1595d636bf097ad1de4fb55cff00e4fef40b453abb30388aa2112bf5cd4c987afe2e047250f7049791aa1ee7091c9e2ab7bb",
  32. "view": 499820
  33. },
  34. {
  35. "nodeId": "d822165959a0ed217df6541f1a7dd38b79336ff571dd5f8f85ad76f3e7ec097e1eabd8b03e4a757fd5a9fb0eea905aded56aaf44df83c34b73acb9ab7ac65010",
  36. "view": 499824
  37. },
  38. {
  39. "nodeId": "dde0bbf5eb3a731e6da861586e98e088e16e6fdd9afae2f2c213cead20a4f5eaa3910042b70d62266d2350d98a43c1f235c8e0da384448384893857873abdb75",
  40. "view": 499822
  41. }
  42. ]
  43. ]

3.14. 获取节点状态列表接口

接口描述

返回节点的快高、pbftview及状态。(查看nodeHeartBeat

接口URL

http://localhost:5002/WeBASE-Front/{groupId}/web3/getNodeStatusList

调用方法

HTTP GET

请求参数

1)参数表

序号中文参数名类型最大长度必填说明
1群组编号groupIdint

2)数据格式

  1. http://localhost:5002/WeBASE-Front/1/web3/getNodeStatusList

响应参数

1)参数表

序号中文参数名类型最大长度必填说明
1节点IdnodeIdString
2节点块高blockNumberbigInteger
3节点pbftViewpbftViewbigInteger
4节点状态statusint1正常,2异常
5上次状态修改时间latestStatusUpdateTimeString跟上次状态变更时间间隔至少大于三秒才会重新检测节点状态

2)数据格式

  1. [
  2. {
  3. "nodeId": "2917803543bcb58ad91cdf67e7b576a5b0440b4f76e6f5440edb8b09dadee297174d25133e841a17e4f89aa59bbaf4c80896af9d6a978aae04b3d0b9cd9d5b84",
  4. "blockNumber": 3,
  5. "pbftView": 146093,
  6. "status": 1,
  7. "latestStatusUpdateTime": "2019-07-25 10:07:07"
  8. },
  9. {
  10. "nodeId": "8722cc018a79bc48b7408649fac4a45bd336a88959570ebba15eefb48fdc23b8a96f328d46852f3d12c4dde7346c573585386fadb5568ce1820144c106af1f72",
  11. "blockNumber": 3,
  12. "pbftView": 146095,
  13. "status": 1,
  14. "latestStatusUpdateTime": "2019-07-25 10:07:07"
  15. }
  16. ]

3.15. 获取群组列表接口

接口描述

返回群组列表

接口URL

http://localhost:5002/WeBASE-Front/{groupId}/web3/groupList

调用方法

HTTP GET

请求参数

1)参数表

序号中文参数名类型最大长度必填说明
1群组编号groupIdint

2)数据格式

  1. http://localhost:5002/WeBASE-Front/1/web3/groupList

响应参数

1)数据格式

  1. [
  2. "1",
  3. "2"
  4. ]

3.16. 获取观察及共识节点列表

接口描述

返回指定群组内的共识节点和观察节点列表

接口URL

http://localhost:5002/WeBASE-Front/{groupId}/web3/groupPeers

调用方法

HTTP GET

请求参数

1)参数表

序号中文参数名类型最大长度必填说明
1群组编号groupIdint

2)数据格式

  1. http://localhost:5002/WeBASE-Front/1/web3/groupPeers

响应参数

1)数据格式

  1. [
  2. "d822165959a0ed217df6541f1a7dd38b79336ff571dd5f8f85ad76f3e7ec097e1eabd8b03e4a757fd5a9fb0eea905aded56aaf44df83c34b73acb9ab7ac65010",
  3. "adfa2f9116d7ff68e0deb75307fa1595d636bf097ad1de4fb55cff00e4fef40b453abb30388aa2112bf5cd4c987afe2e047250f7049791aa1ee7091c9e2ab7bb",
  4. "552398be0eef124c000e632b0b76a48c52b6cfbd547d92c15527c2d1df15fab2bcded48353db22526c3540e4ab2027630722889f20a4a614bb11a7887a85941b",
  5. "dde0bbf5eb3a731e6da861586e98e088e16e6fdd9afae2f2c213cead20a4f5eaa3910042b70d62266d2350d98a43c1f235c8e0da384448384893857873abdb75"
  6. ]

3.17. 获取群组内观察节点列表

接口描述

返回指定群组内的观察节点列表

接口URL

http://localhost:5002/WeBASE-Front/{groupId}/web3/observerList

调用方法

HTTP GET

请求参数

1)参数表

序号中文参数名类型最大长度必填说明
1群组编号groupIdint

2)数据格式

  1. http://localhost:5002/WeBASE-Front/1/web3/observerList

响应参数

1)数据格式

  1. [ "d822165959a0ed217df6541f1a7dd38b79336ff571dd5f8f85ad76f3e7ec097e1eabd8b03e4a757fd5a9fb0eea905aded56aaf44df83c34b73acb9ab7a165010"
  2. ]

3.18. 获取已连接的P2P节点信息

接口描述

返回指定群组内已连接的P2P节点信息

接口URL

http://localhost:5002/WeBASE-Front/{groupId}/web3/peers

调用方法

HTTP GET

请求参数

1)参数表

序号中文参数名类型最大长度必填说明
1群组编号groupIdint

2)数据格式

  1. http://localhost:5002/WeBASE-Front/1/web3/peers

响应参数

1)数据格式

  1. [
  2. {
  3. "ipandPort": "127.0.0.1:30301",
  4. "IPAndPort": "127.0.0.1:30301",
  5. "NodeID": "adfa2f9116d7ff68e0deb75307fa1595d636bf097ad1de4fb55cff00e4fef40b453abb30388aa2112bf5cd4c987afe2e047250f7049791aa1ee7091c9e2ab7bb",
  6. "Topic": []
  7. },
  8. {
  9. "ipandPort": "127.0.0.1:57678",
  10. "IPAndPort": "127.0.0.1:57678",
  11. "NodeID": "e28f3d7f5b82e21918a15639eac342dcf678ebb0efe7c65c76514b0ba6b28ace8e47b4a25c9b3f9763b79db847e250a19f827b132f230298980f3ca9779c2564",
  12. "Topic": []
  13. },
  14. {
  15. "ipandPort": "127.0.0.1:57608",
  16. "IPAndPort": "127.0.0.1:57608",
  17. "NodeID": "dde0bbf5eb3a731e6da861586e98e088e16e6fdd9afae2f2c213cead20a4f5eaa3910042b70d62266d2350d98a43c1f235c8e0da384448384893857873abdb75",
  18. "Topic": []
  19. },
  20. {
  21. "ipandPort": "127.0.0.1:57616",
  22. "IPAndPort": "127.0.0.1:57616",
  23. "NodeID": "552398be0eef124c000e632b0b76a48c52b6cfbd547d92c15527c2d1df15fab2bcded48353db22526c3540e4ab2027630722889f20a4a614bb11a7887a85941b",
  24. "Topic": []
  25. },
  26. {
  27. "ipandPort": "127.0.0.1:57670",
  28. "IPAndPort": "127.0.0.1:57670",
  29. "NodeID": "56edfaf60bcb09b9814ad31dcd959eb388f0314445db3deb92cedde97c0ecec210f713591a15f3a7168ba023290cfbe78656b57c37157e6ec74a85182630bd61",
  30. "Topic": []
  31. }
  32. ]

3.19. 获取群组内正在处理的交易数

接口描述

获取群组内正在处理的交易数

接口URL

http://localhost:5002/WeBASE-Front/{groupId}/web3/pending-transactions-count

调用方法

HTTP GET

请求参数

1)参数表

序号中文参数名类型最大长度必填说明
1群组编号groupIdint

2)数据格式

  1. http://localhost:5002/WeBASE-Front/1/web3/pending-transactions-count

响应参数

1)数据格式

  1. 0

3.20. 获取共识节点接口

接口描述

返回群组内共识节点列表

接口URL

http://localhost:5002/WeBASE-Front/{groupId}/web3/sealerList

调用方法

HTTP GET

请求参数

1)参数表

序号中文参数名类型最大长度必填说明
1群组编号groupIdint

2)数据格式

  1. http://localhost:5002/WeBASE-Front/1/web3/sealerList

响应参数

1)数据格式

  1. [
  2. "d822165959a0ed217df6541f1a7dd38b79336ff571dd5f8f85ad76f3e7ec097e1eabd8b03e4a757fd5a9fb0eea905aded56aaf44df83c34b73acb9ab7ac65010",
  3. "adfa2f9116d7ff68e0deb75307fa1595d636bf097ad1de4fb55cff00e4fef40b453abb30388aa2112bf5cd4c987afe2e047250f7049791aa1ee7091c9e2ab7bb",
  4. "552398be0eef124c000e632b0b76a48c52b6cfbd547d92c15527c2d1df15fab2bcded48353db22526c3540e4ab2027630722889f20a4a614bb11a7887a85941b",
  5. "dde0bbf5eb3a731e6da861586e98e088e16e6fdd9afae2f2c213cead20a4f5eaa3910042b70d62266d2350d98a43c1f235c8e0da384448384893857873abdb75"
  6. ]

3.21. 区块/交易

接口描述

如果输入块高就返回区块信息,如果输入交易hash就返回交易信息

接口URL

http://localhost:5002/WeBASE-Front/{groupId}/web3/search?input={inputValue}

调用方法

HTTP GET

请求参数

1)参数表

序号中文参数名类型最大长度必填说明
1群组编号groupIdint
2查询参数inputValueint/String如果输入块高就返回区块信息,如果输入交易hash就返回交易信息

2)数据格式

  1. http://localhost:5002/WeBASE-Front/1/web3/search?input=1

响应参数

1)数据格式

  1. {
  2. "number": 1,
  3. "hash": "0x3875dbec6e0ad0790dc0a0e8535b7c286ef7cee4149e5b1494f5c65631a9e321",
  4. "parentHash": "0xed3350d191d23cbc609c98e920baa583403b9a02fa934df868e7f425cd72f5c3",
  5. "nonce": 0,
  6. "sha3Uncles": null,
  7. "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
  8. "transactionsRoot": "0xa3db8478e08931f8967023a60d260b182d828aad959433e0b77f097d7650b742",
  9. "stateRoot": "0xf32d3e504fc8813c139d1f6f61ae1c8e355502e10b9ea24e5ad5d3ada01ea400",
  10. "receiptsRoot": null,
  11. "author": null,
  12. "sealer": "0x0",
  13. "mixHash": null,
  14. "difficulty": 0,
  15. "totalDifficulty": 0,
  16. "extraData": [],
  17. "size": 0,
  18. "gasLimit": 0,
  19. "gasUsed": 0,
  20. "timestamp": 1557304350431,
  21. "transactions": [
  22. {
  23. "hash": "0x4145b921309fcaa92b05b782e0181d671b8e68fc6d61d939358ed558fa3489c9",
  24. "nonce": 1.47418536037145E+75,
  25. "blockHash": "0x3875dbec6e0ad0790dc0a0e8535b7c286ef7cee4149e5b1494f5c65631a9e321",
  26. "blockNumber": 1,
  27. "transactionIndex": 0,
  28. "from": "0x33a41878e78fb26735bf425f9328990e3a1a89df",
  29. "to": null,
  30. "value": 0,
  31. "gasPrice": 1,
  32. "gas": 100000000,
  33. "input": "0x6080604052348015600f57600080fd5b5060868061001e6000396000f300608060405260043610603f576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806335b09a6e146044575b600080fd5b348015604f57600080fd5b5060566058565b005b5600a165627a7a723058204aacdb57d6f2ae0f7f6c89c28236bba0205631183fd99785de220481566e683f0029",
  34. "creates": null,
  35. "publicKey": null,
  36. "raw": null,
  37. "r": null,
  38. "s": null,
  39. "v": 0,
  40. "nonceRaw": "0x3425bfe0f36e343686ccbe34a4fe8b05e0e0257ea7ee87417a6d898f0eb43ec",
  41. "transactionIndexRaw": "0x0",
  42. "blockNumberRaw": "0x1",
  43. "valueRaw": "0x0",
  44. "gasPriceRaw": "0x1",
  45. "gasRaw": "0x5f5e100"
  46. }
  47. ],
  48. "uncles": null,
  49. "sealFields": null,
  50. "nonceRaw": null,
  51. "numberRaw": "0x1",
  52. "difficultyRaw": null,
  53. "totalDifficultyRaw": null,
  54. "sizeRaw": null,
  55. "gasLimitRaw": "0x0",
  56. "gasUsedRaw": "0x0",
  57. "timestampRaw": "0x16a969296df"
  58. }

3.22. 获取群组内同步状态信息

接口描述

获取群组内同步状态信息

接口URL

http://localhost:5002/WeBASE-Front/{groupId}/web3/syncStatus

调用方法

HTTP GET

请求参数

1)参数表

序号中文参数名类型最大长度必填说明
1群组编号groupIdint

2)数据格式

  1. http://localhost:5002/WeBASE-Front/1/web3/syncStatus

响应参数

1)数据格式

  1. {
  2. "blockNumber": 126,
  3. "genesisHash": "0xed3350d191d23cbc609c98e920baa583403b9a02fa934df868e7f425cd72f5c3",
  4. "isSyncing": false,
  5. "latestHash": "0x49ca6eb004f372c71ed900ec6992582cd107e4f3ea36aaa5a0a78829ebef1f14",
  6. "nodeId": "d822165959a0ed217df6541f1a7dd38b79336ff571dd5f8f85ad76f3e7ec097e1eabd8b03e4a757fd5a9fb0eea905aded56aaf44df83c34b73acb9ab7ac65010",
  7. "peers": [
  8. {
  9. "blockNumber": 126,
  10. "genesisHash": "0xed3350d191d23cbc609c98e920baa583403b9a02fa934df868e7f425cd72f5c3",
  11. "latestHash": "0x49ca6eb004f372c71ed900ec6992582cd107e4f3ea36aaa5a0a78829ebef1f14",
  12. "nodeId": "552398be0eef124c000e632b0b76a48c52b6cfbd547d92c15527c2d1df15fab2bcded48353db22526c3540e4ab2027630722889f20a4a614bb11a7887a85941b"
  13. },
  14. {
  15. "blockNumber": 126,
  16. "genesisHash": "0xed3350d191d23cbc609c98e920baa583403b9a02fa934df868e7f425cd72f5c3",
  17. "latestHash": "0x49ca6eb004f372c71ed900ec6992582cd107e4f3ea36aaa5a0a78829ebef1f14",
  18. "nodeId": "adfa2f9116d7ff68e0deb75307fa1595d636bf097ad1de4fb55cff00e4fef40b453abb30388aa2112bf5cd4c987afe2e047250f7049791aa1ee7091c9e2ab7bb"
  19. },
  20. {
  21. "blockNumber": 126,
  22. "genesisHash": "0xed3350d191d23cbc609c98e920baa583403b9a02fa934df868e7f425cd72f5c3",
  23. "latestHash": "0x49ca6eb004f372c71ed900ec6992582cd107e4f3ea36aaa5a0a78829ebef1f14",
  24. "nodeId": "dde0bbf5eb3a731e6da861586e98e088e16e6fdd9afae2f2c213cead20a4f5eaa3910042b70d62266d2350d98a43c1f235c8e0da384448384893857873abdb75"
  25. }
  26. ],
  27. "protocolId": 265,
  28. "txPoolSize": "0"
  29. }

3.23. 刷新前置

接口描述

刷新前置的群组列表,功能与groupList类似

接口URL

http://localhost:5002/WeBASE-Front/{groupId}/web3/refresh

调用方法

HTTP GET

请求参数

1)参数表

序号中文参数名类型最大长度必填说明
1群组编号groupIdint

2)数据格式

  1. http://localhost:5002/WeBASE-Front/1/web3/refresh

响应参数

1)数据格式

  1. {
  2. "blockNumber": 126,
  3. "genesisHash": "0xed3350d191d23cbc609c98e920baa583403b9a02fa934df868e7f425cd72f5c3",
  4. "isSyncing": false,
  5. "latestHash": "0x49ca6eb004f372c71ed900ec6992582cd107e4f3ea36aaa5a0a78829ebef1f14",
  6. "nodeId": "d822165959a0ed217df6541f1a7dd38b79336ff571dd5f8f85ad76f3e7ec097e1eabd8b03e4a757fd5a9fb0eea905aded56aaf44df83c34b73acb9ab7ac65010",
  7. "peers": [
  8. {
  9. "blockNumber": 126,
  10. "genesisHash": "0xed3350d191d23cbc609c98e920baa583403b9a02fa934df868e7f425cd72f5c3",
  11. "latestHash": "0x49ca6eb004f372c71ed900ec6992582cd107e4f3ea36aaa5a0a78829ebef1f14",
  12. "nodeId": "552398be0eef124c000e632b0b76a48c52b6cfbd547d92c15527c2d1df15fab2bcded48353db22526c3540e4ab2027630722889f20a4a614bb11a7887a85941b"
  13. },
  14. {
  15. "blockNumber": 126,
  16. "genesisHash": "0xed3350d191d23cbc609c98e920baa583403b9a02fa934df868e7f425cd72f5c3",
  17. "latestHash": "0x49ca6eb004f372c71ed900ec6992582cd107e4f3ea36aaa5a0a78829ebef1f14",
  18. "nodeId": "adfa2f9116d7ff68e0deb75307fa1595d636bf097ad1de4fb55cff00e4fef40b453abb30388aa2112bf5cd4c987afe2e047250f7049791aa1ee7091c9e2ab7bb"
  19. },
  20. {
  21. "blockNumber": 126,
  22. "genesisHash": "0xed3350d191d23cbc609c98e920baa583403b9a02fa934df868e7f425cd72f5c3",
  23. "latestHash": "0x49ca6eb004f372c71ed900ec6992582cd107e4f3ea36aaa5a0a78829ebef1f14",
  24. "nodeId": "dde0bbf5eb3a731e6da861586e98e088e16e6fdd9afae2f2c213cead20a4f5eaa3910042b70d62266d2350d98a43c1f235c8e0da384448384893857873abdb75"
  25. }
  26. ],
  27. "protocolId": 265,
  28. "txPoolSize": "0"
  29. }

3.24. 动态生成群组

接口描述

在节点上动态生成新群组的配置文件与创世块文件

接口URL

http://localhost:5002/WeBASE-Front/{groupId}/web3/generateGroup

调用方法

HTTP POST

请求参数

1)参数表

序号中文参数名类型最大长度必填说明
1群组编号groupIdint此处groupId可填写任意已有群组
1生成群组的编号generateGroupIdint待生成新群组的id
1共识节点列表nodeListList新群组的共识节点列表,可通过getNodeIdList获取
1群组时间戳timestampBigInteger新群组的创世块时间戳

2)数据格式

  1. {
  2. "generateGroupId": 5,
  3. "nodeList": [
  4. "dd7a2964007d583b719412d86dab9dcf773c61bccab18cb646cd480973de0827cc94fa84f33982285701c8b7a7f465a69e980126a77e8353981049831b550f5c",
  5. "59db64100da70db9c2911f2925bcd0c2f9a1b84f4f8bfef0f6a7edf6d511b2a79203a486c268fb97bc19636f91f71ae9dca076973a4bd551b4a8cdf6d7e7710c"
  6. ],
  7. "timestamp": 1589286309000
  8. }

示例:

  1. curl -X POST "http://localhost:5002/WeBASE-Front/{groupId}/web3/generateGroup" -H "accept: */*" -H "Content-Type: application/json" -d "{ \"generateGroupId\": 8, \"nodeList\": [ \"dd7a2964007d583b719412d86dab9dcf773c61bccab18cb646cd480973de0827cc94fa84f33982285701c8b7a7f465a69e980126a77e8353981049831b550f5c\" ], \"timestamp\":1589286309000}"

响应参数

a、成功:

  1. {
  2. "code": 0,
  3. "message": "success"
  4. }

b、失败:

  1. {
  2. "code": 201128,
  3. "errorMessage": "group peers not connected"
  4. }

3.25. 操作动态群组的状态

接口描述

启动群组、停止群组、移除群组、恢复群组、查询群组状态等操作

创建群组后,需要对群组内每个节点分别调用start来启动群组,群组才是完全创建

接口URL

http://localhost:5002/WeBASE-Front/{groupId}/web3/operateGroup/{type}

调用方法

HTTP GET

请求参数

1)参数表

序号中文参数名类型最大长度必填说明
1群组idgroupIdint操作的群组编号
2操作类型typeStringstart, stop, remove, recover, getStatus

2)数据格式

  1. http://localhost:5002/WeBASE-Front/5/web3/operateGroup/start

响应参数

1)数据格式

a、成功:

  1. {
  2. "code": 0,
  3. "message": "success"
  4. }

b、失败:

  1. {
  2. "code": 201123,
  3. "errorMessage": "group already running"
  4. }

3.26. 获取当前节点的多个群组状态

接口描述

传入多个群组编号,对单个节点查询多个群组的状态

包含五种群组状态:该节点不存在该群组”INEXISTENT”、正在停止群组”STOPPING”、群组运行中”RUNNING”、群组已停止”STOPPED”、群组已删除”DELETED”

接口URL

http://localhost:5002/WeBASE-Front/{groupId}/web3/queryGroupStatus

调用方法

HTTP POST

请求参数

1)参数表

序号中文参数名类型最大长度必填说明
1群组idgroupIdint该编号与所查询群组编号无关
2群组id列表groupIdListList传入多个群组id

2)数据格式

  1. {
  2. "groupIdList": [
  3. 1,2,3,4,5
  4. ]
  5. }

示例:

  1. curl -X POST "http://localhost:5002/WeBASE-Front/{groupId}/web3/queryGroupStatus" -H "accept: */*" -H "Content-Type: application/json" -d "{ \"groupIdList\": [ 1,2,3,4,5 ]}"

响应参数

1)参数表

序号中文参数名类型最大长度必填说明
1群组与状态Map-Map
1.1群组idString群组id
1.2群组状态String包含五种状态:”INEXISTENT”、”STOPPING”、”RUNNING”、”STOPPED”、”DELETED”

a、成功:

  1. {
  2. "code": 0,
  3. "message": "success",
  4. "data": {
  5. "1": "RUNNING",
  6. "2": "RUNNING",
  7. "3": "INEXISTENT",
  8. "4": "INEXISTENT",
  9. "5": "INEXISTENT"
  10. }
  11. }

4. 性能检测接口

4.1. 获取机器配置信息

接口描述

获取机器配置信息

接口URL

http://localhost:5002/WeBASE-Front/performance/config

调用方法

HTTP GET

请求参数

1)参数表

无入参

响应参数

1)参数表

  1. {
  2. "memoryTotalSize": "8010916",
  3. "cpuAmount": "4",
  4. "memoryUsedSize": "7818176",
  5. "cpuSize": "2599",
  6. "ip": "127.0.0.1",
  7. "diskUsedSize": "313811828",
  8. "diskTotalSize": "515928320"
  9. }

4.2. 获取机器历史性能信息

接口描述

获取机器历史性能信息

接口URL

http://localhost:5002/WeBASE-Front/performance

调用方法

HTTP GET

请求参数

1)参数表

序号中文参数名类型最大长度必填说明
1开始日期beginDateLocalDateTime
2结束日期endDateLocalDateTime
3对比开始日期contrastBeginDateLocalDateTime
4对比结束日期contrastEndDateLocalDateTime
5间隔gapint

响应参数

1)参数表

  1. {
  2. [{
  3. "metricType": "cpu",
  4. "data": {
  5. "lineDataList": {
  6. "timestampList": [],
  7. "valueList": []
  8. },
  9. "contrastDataList": {
  10. "timestampList": [],
  11. "valueList": []
  12. }
  13. }
  14. }, {
  15. "metricType": "memory",
  16. "data": {
  17. "lineDataList": {
  18. "timestampList": null,
  19. "valueList": []
  20. },
  21. "contrastDataList": {
  22. "timestampList": null,
  23. "valueList": []
  24. }
  25. }
  26. }, {
  27. "metricType": "disk",
  28. "data": {
  29. "lineDataList": {
  30. "timestampList": null,
  31. "valueList": []
  32. },
  33. "contrastDataList": {
  34. "timestampList": null,
  35. "valueList": []
  36. }
  37. }
  38. }, {
  39. "metricType": "txbps",
  40. "data": {
  41. "lineDataList": {
  42. "timestampList": null,
  43. "valueList": []
  44. },
  45. "contrastDataList": {
  46. "timestampList": null,
  47. "valueList": []
  48. }
  49. }
  50. }, {
  51. "metricType": "rxbps",
  52. "data": {
  53. "lineDataList": {
  54. "timestampList": null,
  55. "valueList": []
  56. },
  57. "contrastDataList": {
  58. "timestampList": null,
  59. "valueList": []
  60. }
  61. }
  62. }]
  63. }
  64. }

4.3. 监测机器性能的启停状态

接口描述

获取机器历史性能信息的开启或关闭状态

接口URL

http://localhost:5002/WeBASE-Front/performance/toggle

调用方法

HTTP GET

请求参数

1)参数表

序号中文参数名类型最大长度必填说明
---

响应参数

1)参数表

  1. {
  2. "code": 0,
  3. "message": "Sync Status is ON",
  4. "data": true
  5. }

4.4. 管理监测机器性能的状态

接口描述

管理监测机器历史性能信息的状态,开启或关闭;默认状态为开启,可通过修改配置文件中constant的monitorEnable值改变监测默认开关状态

接口URL

http://localhost:5002/WeBASE-Front/performance/toggle

调用方法

HTTP POST

请求参数

1)参数表

序号中文参数名类型最大长度必填说明
1开关enableboolean开启为”1”, 关闭为”0”

2)数据格式

  1. {
  2. "enable": 0
  3. }

示例:

  1. curl -l -H "Content-type: application/json" -X POST -d '{"enable": 0}' http://127.0.0.1:5002/WeBASE-Front/performance/toggle

响应参数

a、关闭监测机器性能信息

  1. {
  2. "code": 0,
  3. "message": "Sync Status is OFF",
  4. "data": false
  5. }

b、开启监测机器性能信息

  1. {
  2. "code": 0,
  3. "message": "Sync Status is ON",
  4. "data": true
  5. }

4.5. 获取节点监控信息

接口描述

获取节点监控信息

接口URL

http://localhost:5002/WeBASE-Front/chain

调用方法

HTTP GET

请求参数

1)参数表

序号中文参数名类型最大长度必填说明
1开始日期beginDateLocalDateTime
2结束日期endDateLocalDateTime
3对比开始日期contrastBeginDateLocalDateTime
4对比结束日期contrastEndDateLocalDateTime
5间隔gapint
6群组编号groupIdint

2)入参示例

  1. localhost:5002/WeBASE-Front/chain?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)参数表

序号输出参数类型备注
1dataArray返回信息列表
1.1Object返回信息实体
1.1.1metricTypeString测量类型:blockHeight(块高)、pbftView(pbft视图)、pendingCount(待处理交易数量)
1.1.2dataObject
1.1.2.1lineDataListObject指定时间的数据
1.1.2.1.1timestampListList\<String>时间戳列表
1.1.2.1.2valueListList\<Integer>值列表
1.1.2.2contrastDataListObject比对时间的数据
1.1.2.2.1timestampListList\<String>时间戳列表
1.1.2.2.2valueListList\<Integer>值列表

2)出参示例

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

4.6. 检查节点进程是否存活

接口描述

检查节点进程是否存活

接口URL

http://localhost:5002/WeBASE-Front/chain/checkNodeProcess

调用方法

HTTP GET

请求参数

1)参数表

响应参数

1)参数表

  1. true

4.7. 获取节点所在群组物理大小信息

接口描述

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

接口URL

http://localhost:5002/WeBASE-Front/chain/getGroupSizeInfos

调用方法

HTTP GET

请求参数

1)参数表

响应参数

1)参数表

1)出参表

序号输出参数类型备注
1dataArray返回信息列表
1.1Object返回信息实体
1.1.1groupIdInt群组id
1.1.2groupNameString群组名
1.1.3pathString文件路径
1.1.4sizeLong大小(单位:KB)

2)出参示例

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

5. 交易接口

5.1. 交易处理接口(结合WeBASE-Sign)

接口描述

通过此接口对合约进行调用,前置根据调用的合约方法是否是“constant”方法区分返回信息,“constant”方法为查询,返回要查询的信息。非“constant”方法为发送数据上链,返回块hash、块高、交易hash等信息。

当合约方法为非“constant”方法,要发送数据上链时,此接口需结合WeBASE-Sign使用。通过调用WeBASE-Sign服务的签名接口让相关用户对数据进行签名,拿回签名数据再发送上链。需要调用此接口时,工程配置文件application.yml中的配置”keyServer”需配置WeBASE-Sign服务的ip和端口,并保证WeBASE-Sign服务正常和存在相关用户。

方法入参(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"]]

方法入参(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"]]

查看WeBASE-Front通过本地私钥(测试用户)交易处理接口(非WeBASE-Sign签名交易),可查看其他接口-交易处理接口(本地签名)

接口URL

http://localhost:5002/WeBASE-Front/trans/handleWithSign

调用方法

HTTP POST

请求参数

1)参数表

序号中文参数名类型最大长度必填说明
1用户编号signUserIdString64WeBASE-Sign用户编号(查询方法可不传)
2合约名称contractNameString
3合约地址contractAddressString
4方法名funcNameString
5合约编译后生成的abi文件内容contractAbiList合约中单个函数的ABI,若不存在同名函数可以传入整个合约ABI,格式:JSONArray
6方法参数funcParamListJSON数组,多个参数以逗号分隔(参数为数组时同理),如:[“str1”,[“arr1”,”arr2”]]
7群组IDgroupIdint默认为1
8合约版本versionStringCNS中合约版本,该字段在v1.3.0+版本已弃用

2)数据格式

  1. {
  2. "groupId" :1,
  3. "signUserId": "458ecc77a08c486087a3dcbc7ab5a9c3",
  4. "contractAbi":[{"constant":true,"inputs":[],"name":"getVersion","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getStorageCell","outputs":[{"name":"","type":"string"},{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"n","type":"string"}],"name":"setVersion","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[{"name":"storageHash","type":"string"},{"name":"storageInfo","type":"string"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"}],
  5. "contractAddress":"0x14d5af9419bb5f89496678e3e74ce47583f8c166",
  6. "funcName":"set",
  7. "funcParam":["test"]
  8. }

示例:

  1. curl -X POST "http://localhost:5002/WeBASE-Front/trans/handleWithSign" -H "accept: */*" -H "Content-Type: application/json" -d "{ \"contractAbi\": [ { \"outputs\": [], \"constant\": false, \"payable\": false, \"inputs\": [ { \"name\": \"n\", \"type\": \"string\" } ], \"name\": \"set\", \"stateMutability\": \"nonpayable\", \"type\": \"function\" }, { \"outputs\": [ { \"name\": \"\", \"type\": \"string\" } ], \"constant\": true, \"payable\": false, \"inputs\": [], \"name\": \"get\", \"stateMutability\": \"view\", \"type\": \"function\" }, { \"payable\": false, \"inputs\": [], \"stateMutability\": \"nonpayable\", \"type\": \"constructor\" }, { \"inputs\": [ { \"indexed\": false, \"name\": \"name\", \"type\": \"string\" } ], \"name\": \"nameEvent\", \"anonymous\": false, \"type\": \"event\" } ], \"contractAddress\": \"0x7571ff73f1a37ca07f678aebc4d8213e7ef5c266\", \"funcName\": \"set\", \"funcParam\": [ \"test\" ], \"groupId\": 1, \"signUserId\": "458ecc77a08c486087a3dcbc7ab5a9c3"}"

响应参数

a、正确查询交易返回值信息

  1. {"Hi,Welcome!"}

b、正确发送数据上链返回值信息(交易收据)

  1. {
  2. "transactionHash": "0x0b426a58af8ba449742b937f1e9b2b225335638707b93d6b296dfd8107edddd7",
  3. "transactionIndex": 0,
  4. "blockHash": "0xc8eb7a983ecb8c2a0a64450a059d2cf3de8c8d786211dcec48ab9c47219ee8f7",
  5. "blockNumber": 36985,
  6. "gasUsed": 35400,
  7. "contractAddress": "0x0000000000000000000000000000000000000000",
  8. "root": null,
  9. "status": "0x0",
  10. "from": "0xb173ca9a2e07efe6007aee751a013849d53e7c29",
  11. "to": "0x7571ff73f1a37ca07f678aebc4d8213e7ef5c266",
  12. "input": "0x4ed3885e000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000047465737400000000000000000000000000000000000000000000000000000000",
  13. "output": "0x",
  14. "logs": [
  15. {
  16. "removed": false,
  17. "logIndex": null,
  18. "transactionIndex": null,
  19. "transactionHash": null,
  20. "blockHash": null,
  21. "blockNumber": null,
  22. "address": "0x7571ff73f1a37ca07f678aebc4d8213e7ef5c266",
  23. "data": "0x000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000047465737400000000000000000000000000000000000000000000000000000000",
  24. "type": null,
  25. "topics": [
  26. "0x9645e7fb5eec05c0f156d4901a10663561199c6dd0401214a0b833fe0022d899"
  27. ],
  28. "logIndexRaw": null,
  29. "blockNumberRaw": null,
  30. "transactionIndexRaw": null
  31. }
  32. ],
  33. "logsBloom": "0x00000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000020000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000",
  34. "gasUsedRaw": "0x8a48",
  35. "statusOK": true,
  36. "blockNumberRaw": "0x9079",
  37. "transactionIndexRaw": "0x0"
  38. }

6. 系统管理接口

6.1. 查询权限接口

6.1.1 查询权限接口

接口描述

根据PermissionType权限类型,查询该类权限记录列表。共支持查看六种权限的管理员列表:权限管理权限permission, 用户表管理权限userTable, 部署合约和创建用户表权限deployAndCreate, 节点管理权限node, 使用CNS权限cns, 系统参数管理权限sysConfig

接口URL

http://localhost:5002/WeBASE-Front/permission?groupId={groupId}&permissionType={permissionType}&pageSize={pageSize}&pageNumber={pageNumber}

调用方法

HTTP GET

请求参数

1)参数表

序号中文参数名类型最大长度必填说明
1群组IDgroupIdint节点所属群组ID,默认为1
2权限类型permissionTypeString分配权限的类型
3分页大小pageSizeint默认为10
4分页页码pageNumberint默认为1
5表名tableNameStringpermissionTypeuserTable时为必填

2)数据格式

  1. http://localhost:5002/WeBASE-Front/permission?groupId=1&permissionType=cns&pageSize=5&pageNumber=1

响应参数

1)数据格式

  1. {
  2. "code": 0,
  3. "message": "success",
  4. "data": [
  5. {
  6. "address": "0x009fb217b6d7f010f12e7876d31a738389fecd51",
  7. "table_name": "_sys_table_access_",
  8. "enable_num": "84"
  9. }
  10. ],
  11. "totalCount": 1
  12. }

6.1.2 查询权限接口(不分页)

接口URL

http://localhost:5002/WeBASE-Front/permission/full?groupId={groupId}&permissionType={permissionType}

调用方法

HTTP GET

请求参数

1)参数表

序号中文参数名类型最大长度必填说明
1群组IDgroupIdint节点所属群组ID
2权限类型permissionTypeString分配权限的类型
3表名tableNameString当permissionType为userTable时不可为空

2)数据格式

  1. http://localhost:5002/WeBASE-Front/permission/full?groupId=1&permissionType=cns&pageSize=5&pageNumber=1

响应参数

1)数据格式

  1. {
  2. "code": 0,
  3. "message": "success",
  4. "data": [
  5. {
  6. "address": "0x009fb217b6d7f010f12e7876d31a738389fecd51",
  7. "table_name": "_sys_table_access_",
  8. "enable_num": "84"
  9. }
  10. ],
  11. "totalCount": 1
  12. }

6.1.3 获取权限状态列表接口(不分页)

接口URL

http://localhost:5002/WeBASE-Front/permission/sorted/full?groupId={groupId}

调用方法

HTTP GET

请求参数

1)参数表

序号中文参数名类型最大长度必填说明
1群组IDgroupIdint节点所属群组ID

2)数据格式

  1. http://localhost:5002/WeBASE-Front/permission/sorted/full?groupId=1

响应参数

1)数据格式

  1. {
  2. "code": 0,
  3. "message": "success",
  4. "data": {
  5. "0x2cbca2910b650e5816b4731b097eb8985be39805": {
  6. "deployAndCreate": 1,
  7. "cns": 0,
  8. "sysConfig": 0,
  9. "node": 0
  10. },
  11. "0x79d3632a8bc9b3e823a8e475436d5aa6e0fb88a7": {
  12. "deployAndCreate": 1,
  13. "cns": 1,
  14. "sysConfig": 1,
  15. "node": 1
  16. },
  17. "0x202b4245087dbf797f954d8425459bfee3c790f8": {
  18. "deployAndCreate": 1,
  19. "cns": 1,
  20. "sysConfig": 1,
  21. "node": 1
  22. },
  23. "0x7db73896a6db5e86563af18f206405030bd569f8": {
  24. "deployAndCreate": 0,
  25. "cns": 1,
  26. "sysConfig": 0,
  27. "node": 0
  28. }
  29. },
  30. "totalCount": 4
  31. }

6.2. 增加管理权限接口

接口描述

由管理员赋予外部账户地址不同类型的权限,包含六种:权限管理权限permission, 用户表管理权限userTable, 部署合约和创建用户表权限deployAndCreate, 节点管理权限node, 使用CNS权限cns, 系统参数管理权限sysConfig

其中userTable权限还需传入相应的表明tableName

接口URL

http://localhost:5002/WeBASE-Front/permission

调用方法

HTTP POST

请求参数

1)参数表

序号中文参数名类型最大长度必填说明
1群组IDgroupIdint节点所属群组ID
2权限类型permissionTypeString分配权限的类型(六种:permission, userTable, deployAndCreate, node, cns, sysConfig)
3管理员地址fromAddressString
4被授予权限地址addressString
5表名tableNameString当permissionType为userTable时不可为空

2)数据格式

  1. {
  2. "groupId": 1,
  3. "permissionType": "permission",
  4. "fromAddress": "0xd5bba8fe456fce310f529edecef902e4b63129b1",
  5. "address": "0x2357ad9d97027cd71eea1d639f1e5750fbdfd38e"
  6. }

示例:

  1. curl -l -H "Content-type: application/json" -X POST -d '{"groupId": 1, "permissionType": "permission", "fromAddress": "0xd5bba8fe456fce310f529edecef902e4b63129b1", "address": "0x2357ad9d97027cd71eea1d639f1e5750fbdfd38e"}' http://10.0.0.1:5002/WeBASE-Front/permission

响应参数

a、成功:

  1. {
  2. "code": 0,
  3. "message": "success"
  4. }

b、失败:

  1. {
  2. "code": -51000,
  3. "message": "table name and address already exist"
  4. }

6.3. 去除管理权限接口

接口描述

由管理员去除外部账户地址不同类型的权限,包含六种:权限管理权限permission, 用户表管理权限userTable, 部署合约和创建用户表权限deployAndCreate, 节点管理权限node, 使用CNS权限cns, 系统参数管理权限sysConfig

其中userTable权限还需传入相应的表明tableName

接口URL

http://localhost:5002/WeBASE-Front/permission

调用方法

HTTP DELETE

请求参数

1)参数表

序号中文参数名类型最大长度必填说明
1群组IDgroupIdint节点所属群组ID
2权限类型permissionTypeString分配权限的类型(六种:permission, userTable, deployAndCreate, node, cns, sysConfig)
3管理员地址fromAddressString
4被授予权限地址addressString
5表名tableNameString当permissionType为userTable时不可为空

2)数据格式

  1. {
  2. "groupId": 1,
  3. "permissionType": "permission",
  4. "fromAddress": "0xd5bba8fe456fce310f529edecef902e4b63129b1",
  5. "address": "0x2357ad9d97027cd71eea1d639f1e5750fbdfd38e"
  6. }

示例:

  1. curl -l -H "Content-type: application/json" -X DELETE -d '{"groupId": 1, "permissionType": "permission", "fromAddress": "0xd5bba8fe456fce310f529edecef902e4b63129b1", "address": "0x2357ad9d97027cd71eea1d639f1e5750fbdfd38e"}' http://10.0.0.1:5002/WeBASE-Front/permission

响应参数

a、成功:

  1. {
  2. "code": 0,
  3. "message": "success"
  4. }

b、失败:

  1. {
  2. "code": -51001,
  3. "message": "table name and address does not exist"
  4. }

6.4. 管理用户权限状态接口

接口描述

管理用户权限状态,批量修改用户权限

注:目前只支持cns、deployAndCreate、sysConfig、node四种权限管理

接口URL

http://localhost:5002/WeBASE-Front/permission/sorted

调用方法

HTTP POST

请求参数

1)参数表

序号中文参数名类型最大长度必填说明
1群组IDgroupIdint节点所属群组ID
2管理员地址fromAddressString
3被授予权限地址addressString
4用户权限状态permissionStateObject使用{“permissionType”: 1}格式,参照下文数据格式;1代表赋予,0代表去除;支持cns、deployAndCreate、sysConfig、node四种权限

2)数据格式

  1. {
  2. "groupId": "2",
  3. "fromAddress": "0x09fb217b6d7f010f12e7876d31a738389fecd517",
  4. "address": "0x09fb217b6d7f010f12e7876d31a738389fecd517",
  5. "permissionState": {
  6. "deployAndCreate": 1,
  7. "node": 1,
  8. "sysConfig": 1,
  9. "cns": 1
  10. }
  11. }

示例:

  1. curl -l -H "Content-type: application/json" -X POST -d '{"groupId": "2","fromAddress": "0x09fb217b6d7f010f12e7876d31a738389fecd517","address":"0x09fb217b6d7f010f12e7876d31a738389fecd517","permissionState": {"deployAndCreate": 1,"node": 1,"sysConfig": 1,"cns": 1}}' http://localhost:5002/WeBASE-Front/permission/sorted

响应参数

a、成功:

  1. {
  2. "code": 0,
  3. "message": "success",
  4. "data": {
  5. "node": 1,
  6. "sysConfig": 1,
  7. "cns": 1,
  8. "deployAndCreate": 1
  9. }
  10. }

b、失败:

  1. {
  2. "code": 201202,
  3. "message": "permission denied, please check chain administrator permission"
  4. }

6.5. 查询CNS接口

接口描述

根据群组id和合约名(或合约名加版本)获取CNS的list列表。

接口URL

http://localhost:5002/WeBASE-Front/precompiled/cns/list?groupId={groupId}&contractNameAndVersion={contractNameAndVersion}&pageSize={pageSize}&pageNumber={pageNumber}

调用方法

HTTP GET

请求参数

1)参数表

序号中文参数名类型最大长度必填说明
1群组IDgroupIdint节点所属群组ID
2合约名与版本contractNameAndVersionString版本非必填,合约名与版本中间用英文冒号”:”连接,版本号最长为40,由字母数字与”.”组成。无版本参数时返回全部版本
3分页大小pageSizeint默认为10
4分页页码pageNumberint默认为1

2)数据格式

  1. http://localhost:5002/WeBASE-Front/precompiled/cns/list?groupId=1&contractNameAndVersion=HelloWorld&pageSize=5&pageNumber=1

响应参数

1)数据格式

  1. {
  2. "code": 0,
  3. "message": "success",
  4. "data": [
  5. {
  6. "name": "HelloWorld",
  7. "version": "2d36b8ed7ed12da01ed51cc0c85c3002085b17b6",
  8. "address": "0x2d36b8ed7ed12da01ed51cc0c85c3002085b17b6",
  9. "abi": "[{\"constant\":false,\"inputs\":[{\"indexed\":false,\"name\":\"n\",\"type\":\"string\"}],\"name\":\"set\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"get\",\"outputs\":[{\"indexed\":false,\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"constant\":false,\"inputs\":[{\"indexed\":false,\"name\":\"name\",\"type\":\"string\"}],\"name\":\"nameEvent\",\"payable\":false,\"type\":\"event\"}]"
  10. }
  11. ],
  12. "totalCount": 1
  13. }

6.6. 查询系统配置接口

接口描述

根据群组id获取系统配置SystemConfig的list列表,目前只支持tx_count_limit, tx_gas_limit两个参数。

接口URL

http://localhost:5002/WeBASE-Front/sys/config/list?groupId={groupId}&pageSize={pageSize}&pageNumber={pageNumber}

调用方法

HTTP GET

请求参数

1)参数表

序号中文参数名类型最大长度必填说明
1群组IDgroupIdint节点所属群组ID
2分页大小pageSizeint默认为10
3分页页码pageNumberint默认为1

2)数据格式

  1. http://localhost:5002/WeBASE-Front/sys/config/list?groupId=1&pageSize=5&pageNumber=1

响应参数

1)数据格式

  1. {
  2. "code": 0,
  3. "message": "success",
  4. "data": [
  5. {
  6. "id": 6,
  7. "groupId": 1,
  8. "fromAddress": "0x",
  9. "configKey": "tx_gas_limit",
  10. "configValue": "300000000"
  11. },
  12. {
  13. "id": 5,
  14. "groupId": 1,
  15. "fromAddress": "0xd0b56b4ce0e8ce5e064f896d9ad1c16b2603f285",
  16. "configKey": "tx_count_limit",
  17. "configValue": "10002"
  18. }
  19. ],
  20. "totalCount": 2
  21. }

6.7. 设置系统配置接口

接口描述

系统配置管理员设置系统配置,目前只支持tx_count_limit, tx_gas_limit两个参数。

接口URL

http://localhost:5002/WeBASE-Front/sys/config

调用方法

HTTP POST

请求参数

1)参数表

序号中文参数名类型最大长度必填说明
1群组IDgroupIdint节点所属群组ID
2管理员地址fromAddressString
3配置的键configKeyString目前类型两种(tx_count_limit, tx_gas_limit,用户可自定义key如tx_gas_price
4配置的值configValueStringtx_gas_limit范围为 [100000, 2147483647]

2)数据格式

  1. {
  2. "groupId": 1,
  3. "fromAddress": "0xd5bba8fe456fce310f529edecef902e4b63129b1",
  4. "configKey": "tx_count_limit",
  5. "configValue": "1001"
  6. }

示例:

  1. curl -l -H "Content-type: application/json" -X POST -d '{"groupId": 1, "fromAddress": "0xd5bba8fe456fce310f529edecef902e4b63129b1", "configKey": "tx_count_limit", "configValue": "1001"}' http://10.0.0.1:5002/WeBASE-Front/sys/config

响应参数

a、成功:

  1. {
  2. "code": 0,
  3. "message": "success"
  4. }

b、失败:

  1. {
  2. "code": -50000,
  3. "message": "permission denied"
  4. }

6.8. 查询节点接口(节点管理)

接口描述

获取节点的list列表,列表包含节点id,节点共识状态。

注:接口返回所有的共识/观察节点(无论运行或停止),以及正在运行的游离节点

接口URL

http://localhost:5002/WeBASE-Front/precompiled/consensus/list?groupId={groupId}&pageSize={pageSize}&pageNumber={pageNumber}

调用方法

HTTP GET

请求参数

1)参数表

序号中文参数名类型最大长度必填说明
1群组IDgroupIdint节点所属群组ID
2分页大小pageSizeint默认为10
3分页页码pageNumberint默认为1

2)数据格式

  1. http://localhost:5002/WeBASE-Front/precompiled/consensus/list?groupId=1&pageSize=5&pageNumber=1

响应参数

1)数据格式

  1. {
  2. "code": 0,
  3. "message": "success",
  4. "data": [
  5. {
  6. "nodeId": "13e0f2b94cbce924cc3737385a38587939e809fb786c4fc34a6ba3ea97693bccfa173b352ac41f1dbb97e9e4910ccbec1df38ad4020cef3b2044e833188adad9",
  7. "nodeType": "sealer"
  8. },
  9. {
  10. "nodeId": "bce4b2269c25c2cdba30155396bfe90af08c3c08cff205213477683117e4243ebe26588479519e636a5d5d93545cab778435cacacc41993f28f58f60fa5ceb72",
  11. "nodeType": "sealer"
  12. },
  13. {
  14. "nodeId": "e815cc5637cb8c3274c83215c680822e4a0110d0a8315fcf03e43e8e3944edd758c8b173c4e0076f599aa1f853fa207d47cc95d201ae8d0206b71ad5aa8c3f59",
  15. "nodeType": "sealer"
  16. }
  17. ],
  18. "totalCount": 3
  19. }

6.9. 设置节点共识状态接口(节点管理)

接口描述

节点管理相关接口,可用于节点三种共识状态的切换。分别是共识节点sealer, 观察节点observer, 游离节点remove

接口URL

http://localhost:5002/WeBASE-Front/precompiled/consensus

调用方法

HTTP POST

请求参数

1)参数表

序号中文参数名类型最大长度必填说明
1群组IDgroupIdint节点所属群组ID
2管理员地址fromAddressString
3节点类型nodeTypeString节点类型:observer,sealer,remove
4节点IDnodeIdString节点id,从节点根目录/conf/node.id获取

2)数据格式

  1. {
  2. "groupId": 1,
  3. "fromAddress": "0xd5bba8fe456fce310f529edecef902e4b63129b1",
  4. "nodeType": "remove",
  5. "nodeId": "224e6ee23e8a02d371298b9aec828f77cc2711da3a981684896715a3711885a3177b3cf7906bf9d1b84e597fad1e0049511139332c04edfe3daddba5ed60cffa"
  6. }

示例:

  1. curl -l -H "Content-type: application/json" -X POST -d '{"groupId": 1, "fromAddress": "0xd5bba8fe456fce310f529edecef902e4b63129b1", "configKey": "tx_count_limit", "configValue": "1001"}' http://10.0.0.1:5002/WeBASE-Front/sys/config

响应参数

a、成功:

  1. {
  2. "code": 0,
  3. "message": "success"
  4. }

b、失败:

  1. {
  2. "code": -50000,
  3. "message": "permission denied"
  4. }

6.10. CRUD表格操作接口

接口描述

用于操作用户表的CRUD操作,包含create, desc, insert, update, select, remove。

具体sql要求语法参考Fisco-bcos技术文档的 Precompiled Crud API

接口URL

http://localhost:5002/WeBASE-Front/precompiled/crud

调用方法

HTTP POST

请求参数

1)参数表

序号中文参数名类型最大长度必填说明
1群组IDgroupIdint节点所属群组ID
2管理员地址fromAddressString
3SQL语句sqlString包含create, desc, insert, update, select, remove,小写

2)数据格式

  1. {
  2. "groupId": 1,
  3. "fromAddress": "0xd5bba8fe456fce310f529edecef902e4b63129b1",
  4. "sql": "desc t_demo"
  5. }

示例:

  1. curl -l -H "Content-type: application/json" -X POST -d '{"groupId": 1, "fromAddress": "0xd5bba8fe456fce310f529edecef902e4b63129b1", "sql": "desc t_demo"}' http://10.0.0.1:5002/WeBASE-Front/precompiled/crud

响应参数

a、成功:

  1. {
  2. "code": 0,
  3. "message": "success",
  4. "data": {
  5. "tableName": "t_demo",
  6. "key": "name",
  7. "valueFields": "item_id,item_name",
  8. "optional": "",
  9. "entry": {
  10. "fields": {}
  11. },
  12. "condition": {
  13. "conditions": {}
  14. }
  15. }
  16. }

b、失败:

  1. {
  2. "code": 2012228,
  3. "message": "table not exists",
  4. "data": "Table not exists "
  5. }

6.11. 查询节点证书接口

接口描述

获取Front对应节点的Fisco证书和sdk证书(包含链证书、机构证书和节点证书)的内容;

需要在项目配置文件中constant-nodePath配置Front连接节点的绝对路径;

注:

接口只返回了证书的文本(Base64编码),未包含开头与结尾以及换行的格式文本; 如需将文本保存为一个证书文件,需要加上开头“—–BEGIN CERTIFICATE—–\n”和结尾“\n—–END CERTIFICATE—–\n”;

接口URL

http://localhost:5002/WeBASE-Front/cert

调用方法

HTTP GET

请求参数

1)参数表

序号中文参数名类型最大长度必填说明
---

2)数据格式

  1. http://localhost:5002/WeBASE-Front/cert

响应参数

1)数据格式

a、成功:

  1. {
  2. "node": "MIICOTCCASGgAwIBAgIJAKHsAYI3TsAOMA0GCSqGSIb3DQEBCwUAMDgxEDAOBgNV\nBAMMB2FnZW5jeUExEzARBgNVBAoMCmZpc2NvLWJjb3MxDzANBgNVBAsMBmFnZW5j\neTAeFw0xOTA3MTIwMjA2MTZaFw0yOTA3MDkwMjA2MTZaMDIxDDAKBgNVBAMMA3Nk\nazETMBEGA1UECgwKZmlzY28tYmNvczENMAsGA1UECwwEbm9kZTBWMBAGByqGSM49\nAgEGBSuBBAAKA0IABJ79rSKIb97xZwByW58xH6tzoNKNLaKG7J5wxAEgAb03O2h4\nMkEMLtf/LB7tELOiyCiIEhLScprb1LjvDDt2RDGjGjAYMAkGA1UdEwQCMAAwCwYD\nVR0PBAQDAgXgMA0GCSqGSIb3DQEBCwUAA4IBAQC0u2lfclRmCszBTi2rtvMibZec\noalRC0sQPBPRb7UQhGCodxmsAT3dBUf+s4wLLrmN/cnNhq5HVObbWxzfu7gn3+IN\nyQEeqdbGdzlu1EDcaMgAz6p2W3+FG/tmx/yrNza29cYekWRL44OT5LOUPEKrJ4bJ\neOBRY4QlwZPFmM0QgP7DoKxHXldRopkmvqT4pbW51hWvPgj7KrdqwbVWzuWQuI3i\n3j3O96XZJsaDZ0+IGa5093+TsTNPfWUZzp5Kg+EyNR6Ea1evuMDNq9NAqqcd5bX9\nO9kgkb8+llO8I5ZhdnN0BuhGvv9wpsa9hW8BImOLzUBwfSVYouGCkoqlVq9X",
  3. "chain": "MIIDPTCCAiWgAwIBAgIJAMfvnu4d5fHdMA0GCSqGSIb3DQEBCwUAMDUxDjAMBgNV\nBAMMBWNoYWluMRMwEQYDVQQKDApmaXNjby1iY29zMQ4wDAYDVQQLDAVjaGFpbjAe\nFw0xOTA3MTIwMjA2MTZaFw0yOTA3MDkwMjA2MTZaMDUxDjAMBgNVBAMMBWNoYWlu\nMRMwEQYDVQQKDApmaXNjby1iY29zMQ4wDAYDVQQLDAVjaGFpbjCCASIwDQYJKoZI\nhvcNAQEBBQADggEPADCCAQoCggEBAMGsKT/S60cxvFS4tBLyfT0QKPLW1g3ZgMND\n03hrWp1FAnvE9htsDEgqvNLD5hKWaYcUhjQMq0WttiP/vPxkwwJkZhzWhXpdSxMR\nqKVX4BppnkT0ICm84jYSyJdNFjKvfWlBIptIfFuTUDMT+XqF/Ct756JksiUwKZRW\neRAVcYzFM4u4ZuKeaept/8Bv8Z/RlJzGI57qj5BELeA0meUagq2WoCgJrPyvbO0b\nLwogFWS4kEjv20IIdj3fTqeJlooEXtPnuegunSMQB6aIh2im74FfJ3sHuOjQDFuC\nb5ZUiyUHG6IOGCqs+Grk+/VYI16Mx+8OoGBD5koTpK8B+/aedsUCAwEAAaNQME4w\nHQYDVR0OBBYEFLTg2FsUFekx9XjIi01BrDpo0aPIMB8GA1UdIwQYMBaAFLTg2FsU\nFekx9XjIi01BrDpo0aPIMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEB\nAJmuMLhWSld8G6i3Vw21TN/d2rSRg3hNqOyycPYtdVK1YXEj4Xm91qgL8An3Kui8\njSq1S9+PstGvyh14YUw43Y1VtEPGpNVTvDtkxQ/8rs1sGHbqUxshgFMbqruxp7WH\ns0fxgn5COHEnRC4jQn02wZAk8pIjFVZLkhqdIYBtC35buHr17mXNL0S4H5cJxzPN\nk3XtKBqXedkTrEsDhR/bZ6qDDq0BcduhtKiYVPiVw9z3moLuwDb0QDM59zCexpcz\nb/w7K4lIxWqpD5tbpKSmj/3v5TCqez0Mim8/j4q29bP913KQrngnVCdCezOsPWIH\nDDoihgeRQHuz1VuGGZ259Hc=",
  4. "agency": "MIIDADCCAeigAwIBAgIJAJUF2Dp1a9U6MA0GCSqGSIb3DQEBCwUAMDUxDjAMBgNV\nBAMMBWNoYWluMRMwEQYDVQQKDApmaXNjby1iY29zMQ4wDAYDVQQLDAVjaGFpbjAe\nFw0xOTA3MTIwMjA2MTZaFw0yOTA3MDkwMjA2MTZaMDgxEDAOBgNVBAMMB2FnZW5j\neUExEzARBgNVBAoMCmZpc2NvLWJjb3MxDzANBgNVBAsMBmFnZW5jeTCCASIwDQYJ\nKoZIhvcNAQEBBQADggEPADCCAQoCggEBANBT4CTciIYdSeEabgJzif+CFB0y3GzG\ny+XQYtWK+TtdJWduXqhnnZiYAZs7OPGEu79Yx/bEpjEXsu2cXH0D6BHZk+wvuxG6\nezXWq5MYjCw3fQiSRWkDYoxzWgulkRyYROF1xoZeNGQssReFmCgP+pcQwRxjcq8z\nIA9iT61YxyW5nrS7xnra9uZq/EE3tsJ0ae3ax6zixCT66aV49S27cMcisS+XKP/q\nEVPxhO7SUjnzZY69MgZzNSFxCzIbapnlmYAOS26vIT0taSkoKXmIsYssga45XPwI\n7YBVCc/34kHzW9xrNjyyThMWOgDsuBqZN9xvapGSQ82Lsh7ObN0dZVUCAwEAAaMQ\nMA4wDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQsFAAOCAQEAu3aHxJnCZnICpHbQ\nv1Lc5tiXtAYE9aEP5cxb/cO14xY8dS+t0wiLIvyrE2aTcgImzr4BYNBm1XDt5suc\nMpzha1oJytGv79M9/WnI/BKmgUqTaaXOV2Ux2yPX9SadNcsD9/IbrV0b/hlsPd6M\nK8w7ndowvBgopei+A1NQY6jTDUKif4RxD4u5HZFWUu7pByNLFaydU4qBKVkucXOq\nxmWoupL5XrDk5o490kiz/Zgufqtb4w6oUr3lrQASAbFB3lID/P1ipi0DwX7kZwVX\nECDLYvr+eX6GbTClzn0JGuzqV4OoRo1rrRv+0tp1aLZKpCYn0Lhf6s1iw/kCeM2O\nnP9l2Q=="
  5. }

b、失败:

  1. {
  2. "code": 201231,
  3. "message": "Cert file not found, please check cert path in config",
  4. "data": "FileNotFound, node cert(node.crt) path prefix error"
  5. }

6.12. 合约状态管理

接口描述

冻结、解冻合约和授权用户操作权限,还可以查询合约状态和合约用户权限列表

接口URL

http://localhost:5002/WeBASE-Front/precompiled/contractStatusManage

调用方法

HTTP POST

请求参数

1)入参表

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

2)入参示例

  1. {
  2. "contractAddress": "0x1d518bf3fb0edceb18519808edf7ad8adeeed792",
  3. "grantAddress": "",
  4. "groupId": 1,
  5. "handleType": "freeze",
  6. "signUserId": "user1001"
  7. }

响应参数

1)数据格式

  1. {
  2. "code": 0,
  3. "message": "success",
  4. "data": null
  5. }

7. 链上事件订阅接口

7.1. 获取出块事件的订阅信息列表

接口描述

获取所有订阅的出块事件配置信息

将返回对应的id值, exchange, queue, routingKey等信息

接口URL

http://localhost:5002/WeBASE-Front/event/newBlockEvent/list/{groupId}/{pageNumber}/{pageSize}

调用方法

HTTP GET

请求参数

1)参数表

序号中文参数名类型最大长度必填说明
1群组编号groupIdint群组编号
2页码pageNumberint同时缺省则返回全量数据
3页大小pageSizeint同时缺省则返回全量数据

2)数据格式

  1. http://localhost:5002/WeBASE-Front/event/newBlockEvent/list/{groupId}/{pageNumber}/{pageSize}

响应参数

1)数据格式

成功:

  1. {
  2. "code": 0,
  3. "message": "success",
  4. "data": [
  5. {
  6. "id": "8aba82b570f22a750170f22bcab90000",
  7. "eventType": 1,
  8. "appId": "app2",
  9. "groupId": 1,
  10. "exchangeName": "group001",
  11. "queueName": "app2",
  12. "routingKey": "app2_block_b63",
  13. "createTime": "2020-03-19 17:42:01"
  14. }
  15. ],
  16. "totalCount": 1
  17. }

7.2. 获取出块事件的订阅信息

接口描述

根据群组编号,应用编号获取该应用订阅的出块事件配置信息

将返回对应的id值, exchange, queue, routingKey等信息

接口URL

http://localhost:5002/WeBASE-Front/event/newBlockEvent/{groupId}/{appId}

调用方法

HTTP GET

请求参数

1)参数表

序号中文参数名类型最大长度必填说明
1群组编号groupIdint
2应用编号appIdString


2)数据格式

  1. http://localhost:5002/WeBASE-Front/event/newBlockEvent/{groupId}/{appId}

响应参数

1)数据格式

成功:

  1. {
  2. "code": 0,
  3. "message": "success",
  4. "data": [
  5. {
  6. "id": "8aba82b570f22a750170f22bcab90000",
  7. "eventType": 1,
  8. "appId": "app2",
  9. "groupId": 1,
  10. "exchangeName": "group001",
  11. "queueName": "app2",
  12. "routingKey": "app2_block_b63",
  13. "createTime": "2020-03-19 17:42:01"
  14. }
  15. ]
  16. }

7.3. 订阅出块事件通知

接口描述

订阅后将在消息队列中获取出块的事件通知

接口URL

http://localhost:5002/WeBASE-Front/event/newBlockEvent

调用方法

HTTP POST

请求参数

1)参数表

序号中文参数名类型最大长度必填说明
1应用编号appIdString注册事件通知的应用的唯一编号,仅支持数字字母和下划线
2所属群组groupIdInteger
3交换机名字exchangeNameString队列所属交换机
4队列名queueNameString队列名,以appId作队列名

2)数据格式

  1. {
  2. "appId": "app1",
  3. "groupId": 1,
  4. "exchangeName": "group001",
  5. "queueName": "app1"
  6. }

响应参数

1)数据格式

成功:

  1. {
  2. "code": 0,
  3. "message": "success"
  4. }

失败(如:重复订阅)

  1. {
  2. "code": 201242,
  3. "errorMessage": "This data is already in db."
  4. }

7.4. 取消订阅出块事件通知

接口描述

取消在消息队列中获取出块的事件通知的订阅

接口URL

http://localhost:5002/WeBASE-Front/event/newBlockEvent

调用方法

HTTP DELETE

请求参数

1)参数表

序号中文参数名类型最大长度必填说明
1数据编号idString注册事件通知数据的唯一编号,可通过GET接口获取
2应用编号appIdString注册事件通知的应用的唯一编号
3所属群组groupIdInteger
4交换机名字exchangeNameString队列所属交换机
5队列名queueNameString队列名,以appId作队列名

2)数据格式

  1. {
  2. "id":"8aba82b5707a1f5701707a248c340000",
  3. "appId": "app1",
  4. "groupId": 1,
  5. "exchangeName": "group001",
  6. "queueName": "app1"
  7. }

响应参数

1)数据格式

成功:

  1. {
  2. "code": 0,
  3. "message": "success"
  4. }

7.5. 获取合约Event事件订阅信息列表

接口描述

获取所有订阅的合约Event事件配置信息

将返回对应的id值, exchange, queue, routingKey及合约Event配置内容(fromBlock, toBlock, contractAddress..)等信息

接口URL

http://localhost:5002/WeBASE-Front/event/contractEvent/list/{groupId}/{pageNumber}/{pageSize}

调用方法

HTTP GET

请求参数

1)参数表

序号中文参数名类型最大长度必填说明
1群组编号groupIdint群组编号
2页码pageNumberint同时缺省则返回全量数据
3页大小pageSizeint同时缺省则返回全量数据

2)数据格式

  1. http://localhost:5002/WeBASE-Front/event/contractEvent/list/{groupId}/{pageNumber}/{pageSize}

响应参数

1)数据格式

成功:

  1. {
  2. "code": 0,
  3. "message": "success",
  4. "data": [
  5. {
  6. "id": "8aba82b57076ae09017076ae403a0001",
  7. "eventType": 2,
  8. "appId": "app1",
  9. "groupId": 1,
  10. "exchangeName": "group001",
  11. "queueName": "app1",
  12. "routingKey": "app1_event_b3c",
  13. "contractAbi": "[{\"constant\":false,\"inputs\":[{\"name\":\"n\",\"type\":\"string\"}],\"name\":\"set\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"get\",\"outputs\":[{\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"name\",\"type\":\"string\"}],\"name\":\"SetName\",\"type\":\"event\"}]",
  14. "fromBlock": "latest",
  15. "toBlock": "latest",
  16. "contractAddress": "0x657201d59ec41d1dc278a67916f751f86ca672f7",
  17. "topicList": "SetName(string)"
  18. }
  19. ],
  20. "totalCount":1
  21. }

7.6. 获取合约Event事件订阅信息

接口描述

根据群组编号,应用编号获取该应用订阅的合约Event事件配置信息

将返回对应的id值, exchange, queue, routingKey及合约Event配置内容(fromBlock, toBlock, contractAddress..)等信息

接口URL

http://localhost:5002/WeBASE-Front/event/contractEvent/{groupId}/{appId}

调用方法

HTTP GET

请求参数

1)参数表

序号中文参数名类型最大长度必填说明
1群组编号groupIdint
2应用编号appIdString

2)数据格式

  1. http://localhost:5002/WeBASE-Front/event/contractEvent/{groupId}/{appId}

响应参数

1)数据格式

成功:

  1. {
  2. "code": 0,
  3. "message": "success",
  4. "data": [
  5. {
  6. "id": "8aba82b57076ae09017076ae403a0001",
  7. "eventType": 2,
  8. "appId": "app1",
  9. "groupId": 1,
  10. "exchangeName": "group001",
  11. "queueName": "app1",
  12. "routingKey": "app1_event_b3c",
  13. "contractAbi": "[{\"constant\":false,\"inputs\":[{\"name\":\"n\",\"type\":\"string\"}],\"name\":\"set\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"get\",\"outputs\":[{\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"name\",\"type\":\"string\"}],\"name\":\"SetName\",\"type\":\"event\"}]",
  14. "fromBlock": "latest",
  15. "toBlock": "latest",
  16. "contractAddress": "0x657201d59ec41d1dc278a67916f751f86ca672f7",
  17. "topicList": "SetName(string)",
  18. "createTime": "2020-02-26 16:21:12"
  19. }
  20. ]
  21. }

7.7. 订阅合约event事件通知

接口描述

订阅后将在消息队列中获取相应智能合约的event事件通知

接口URL

http://localhost:5002/WeBASE-Front/event/contractEvent

调用方法

HTTP POST

请求参数

1)参数表

序号中文参数名类型最大长度必填说明
1应用编号appIdString注册事件通知的应用的唯一编号,仅支持数字字母和下划线
2所属群组groupIdInteger
3交换机名字exchangeNameString队列所属交换机
4队列名queueNameString队列名,以appId作队列名
5合约abicontractAbiList合约的ABI,用于合约event解析
6event起始区块fromBlockString默认latest,表示一直监听最新区块,最小值为1
7event末区块toBlockString最小值为1,最大值为当前区块高度,需 要大于等于fromBlock;填写latest,表示一直监听最新区块
8合约地址contractAddressString合约地址
9合约event列表topicListListList类型,合约Event事件列表,Event参数之间不带空格

2)数据格式

  1. {
  2. "appId": "app2",
  3. "groupId": 1,
  4. "exchangeName": "group001",
  5. "queueName": "app2",
  6. "contractAbi": [{"constant":false,"inputs":[{"name":"n","type":"string"}],"name":"set","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"get","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"anonymous":false,"inputs":[{"indexed":false,"name":"name","type":"string"}],"name":"SetName","type":"event"}],
  7. "fromBlock": "latest",
  8. "toBlock": "latest",
  9. "contractAddress": "0x657201d59ec41d1dc278a67916f751f86ca672f7",
  10. "topicList": ["SetName(string)","TransferEvent(string,address)"],
  11. "createTime": "2020-02-26 16:21:12"
  12. }

响应参数

1)数据格式

成功:

  1. {
  2. "code": 0,
  3. "message": "success"
  4. }

失败(如:重复订阅)

  1. {
  2. "code": 201242,
  3. "errorMessage": "This data is already in db."
  4. }

7.8. 取消合约Event事件通知的订阅

接口描述

取消在消息队列中获取合约Event事件通知的订阅

接口URL

http://localhost:5002/WeBASE-Front/event/contractEvent

调用方法

HTTP DELETE

请求参数

1)参数表

序号中文参数名类型最大长度必填说明
1数据编号idString注册事件通知数据的唯一编号,可通过GET接口获取
2应用编号appIdString注册事件通知的应用的唯一编号
3所属群组groupIdInteger
4交换机名字exchangeNameString队列所属交换机
5队列名queueNameString队列名,以appId作队列名

2)数据格式

  1. {
  2. "id": "8aba82b57076ae09017076ae403a0001",
  3. "appId": "app2",
  4. "groupId": 1,
  5. "exchangeName": "group001",
  6. "queueName": "app2"
  7. }

响应参数

1)数据格式

成功则返回该app中剩余已订阅的合约Event事件通知:

  1. {
  2. "code": 0,
  3. "message": "success",
  4. "data": []
  5. }

8. Abi管理接口

8.1. 获取Abi信息

接口描述

根据abiId获取abi信息

接口URL

http://localhost:5002/WeBASE-Front/abi/{abiId}

调用方法

HTTP GET

请求参数

1)参数表

序号中文参数名类型最大长度必填说明
1abi编号abiIdLongabi编号

2)数据格式

  1. http://localhost:5002/WeBASE-Front/abi/{abiId}

响应参数

1)数据格式

a、成功:

  1. {
  2. "code": 0,
  3. "message": "success",
  4. "data": {
  5. "abiId": 1,
  6. "groupId": 1,
  7. "contractName": "TTT",
  8. "contractAddress": "0x3214227e87bccca63893317febadd0b51ade735e",
  9. "contractAbi": "[{\"constant\":false,\"inputs\":[{\"name\":\"n\",\"type\":\"string\"}],\"name\":\"set\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"get\",\"outputs\":[{\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"n\",\"type\":\"string\"}],\"name\":\"setSender\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"name\",\"type\":\"string\"}],\"name\":\"SetName\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"\",\"type\":\"uint256[2]\"}],\"name\":\"EventList\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"SetSender\",\"type\":\"event\"}]",
  10. "contractBin": "608060405260043610610057576000357...",
  11. "createTime": "2020-05-18 10:59:02",
  12. "modifyTime": "2020-05-18 10:59:02"
  13. }
  14. }

8.2. 获取Abi信息分页列表

接口描述

获取abi信息的列表

接口URL

http://localhost:5002/WeBASE-Front/abi/list/{groupId}/{pageNumber}/{pageSize}

调用方法

HTTP GET

请求参数

1)参数表

序号中文参数名类型最大长度必填说明
1群组idgroupIdint群组编号
2页码pageNumberint
3页大小pageSizeint

2)数据格式

  1. http://localhost:5002/WeBASE-Front/abi/list/{groupId}/{pageNumber}/{pageSize}

响应参数

1)数据格式

a、成功:

  1. {
  2. "code": 0,
  3. "message": "success",
  4. "data": [
  5. {
  6. "abiId": 1,
  7. "groupId": 1,
  8. "contractName": "TTT",
  9. "contractAddress": "0x3214227e87bccca63893317febadd0b51ade735e",
  10. "contractAbi": "[{\"constant\":false,\"inputs\":[{\"name\":\"n\",\"type\":\"string\"}],\"name\":\"set\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"get\",\"outputs\":[{\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"n\",\"type\":\"string\"}],\"name\":\"setSender\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"name\",\"type\":\"string\"}],\"name\":\"SetName\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"\",\"type\":\"uint256[2]\"}],\"name\":\"EventList\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"SetSender\",\"type\":\"event\"}]",
  11. "contractBin": "608060405260043610610057576000357c0100000000000000000000000000000000000000000000000000000000900463fffff...29",
  12. "createTime": "2020-05-18 10:59:02",
  13. "modifyTime": "2020-05-18 10:59:02"
  14. }
  15. ],
  16. "totalCount": 1
  17. }

8.3. 导入已部署合约的abi

接口描述

将其他平台已部署的合约导入到本平台进行管理

接口URL

http://localhost:5002/WeBASE-Front/abi

调用方法

HTTP POST

请求参数

1)参数表

序号中文参数名类型最大长度必填说明
1所属群组groupIdInteger
2合约地址contractAddressString合约地址
3合约名contractNameString
4合约abicontractAbiList合约的ABI

2)数据格式

  1. {
  2. "groupId": 1,
  3. "contractAddress": "0x3214227e87bccca63893317febadd0b51ade735e",
  4. "contractName": "HelloWorld",
  5. "contractAbi": [{"constant":false,"inputs":[{"name":"n","type":"string"}],"name":"set","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"get","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"anonymous":false,"inputs":[{"indexed":false,"name":"name","type":"string"}],"name":"SetName","type":"event"}]
  6. }

响应参数

1)数据格式

成功:

  1. {
  2. "code": 0,
  3. "message": "success"
  4. }

8.4. 修改已导入的合约abi

接口描述

更新已导入的合约abi内容

接口URL

http://localhost:5002/WeBASE-Front/abi

调用方法

HTTP PUT

请求参数

1)参数表

序号中文参数名类型最大长度必填说明
1abi编号abiIdLong
2所属群组groupIdInteger
3合约地址contractAddressString合约地址
4合约名contractNameString
5合约abicontractAbiList合约的ABI

2)数据格式

  1. {
  2. "abiId": 1,
  3. "groupId": 1,
  4. "contractAddress": "0x3214227e87bccca63893317febadd0b51ade735e",
  5. "contractName": "HelloWorld",
  6. "contractAbi": [{"constant":false,"inputs":[{"name":"n","type":"string"}],"name":"set","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"get","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"anonymous":false,"inputs":[{"indexed":false,"name":"name","type":"string"}],"name":"SetName","type":"event"}]
  7. }

响应参数

1)数据格式

成功:

  1. {
  2. "code": 0,
  3. "message": "success"
  4. }

8.5. 修改合约abi

接口描述

删除合约abi

接口URL

http://localhost:5002/WeBASE-Front/abi/{abiId}

调用方法

HTTP DELETE

请求参数

1)参数表

序号中文参数名类型最大长度必填说明
1abi编号abiIdLong

2)数据格式

  1. {
  2. "abiId": 1
  3. }

响应参数

1)数据格式

成功:

  1. {
  2. "code": 0,
  3. "message": "success"
  4. }

9. 统计日志接口

9.1. 获取网络统计日志数据

接口描述

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

接口URL

http://localhost:5002/WeBASE-Front/charging/getNetWorkData?groupId={groupId}&pageSize={pageSize}&pageNumber={pageNumber}&beginDate={beginDate}&endDate={endDate}

调用方法

HTTP GET

请求参数

1)入参表

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

2)入参示例

  1. http://localhost:5002/WeBASE-Front/charging/getNetWorkData?groupId=1&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. }

9.2. 获取交易Gas统计日志数据

接口描述

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

接口URL

  1. http://localhost:5002/WeBASE-Front/charging/getTxGasData?groupId={groupId}&pageSize={pageSize}&pageNumber={pageNumber}&beginDate={beginDate}&endDate={endDate}&transHash={transHash}

调用方法

HTTP GET

请求参数

1)入参表

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

2)入参示例

  1. http://localhost:5002/WeBASE-Front/charging/getTxGasData?groupId=1&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. }

9.3. 删除统计日志数据

接口描述

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

接口URL

http://localhost:5002/WeBASE-Front/charging/deleteData?groupId={groupId}&type={type}&keepEndDate={keepEndDate}

调用方法

HTTP DELETE

请求参数

1)入参表

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

2)入参示例

  1. http://localhost:5002/WeBASE-Front/charging/deleteData?groupId=1&type=1&keepEndDate=2020-03-27T10:30:04

响应参数

1)出参表

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

2)出参示例

  1. {
  2. "code": 0,
  3. "message": "success",
  4. "data": 5
  5. }

10. 其他接口

10.1. 查询是否使用国密

接口描述

获取WeBASE-Front的encryptType,即是否使用国密版;

接口URL

http://localhost:5002/WeBASE-Front/encrypt

调用方法

HTTP GET

请求参数

1)参数表

序号中文参数名类型最大长度必填说明
---

2)数据格式

  1. http://localhost:5002/WeBASE-Front/encrypt

响应参数

1)数据格式

a、成功:

  1. {
  2. 1 // 1: 国密版,0: 非国密
  3. }

10.2. 查询WeBASE-Front版本

接口描述

获取WeBASE-Front的版本号

接口URL

http://localhost:5002/WeBASE-Front/version

调用方法

HTTP GET

请求参数

1)参数表

序号中文参数名类型最大长度必填说明
---

2)数据格式

  1. http://localhost:5002/WeBASE-Front/version

响应参数

1)数据格式

a、成功:

  1. v1.4.0

10.3. 查询前置连接的WeBASE-Sign版本

接口描述

获取WeBASE-Front的所连接的WeBASE-Sign的版本号

接口URL

http://localhost:5002/WeBASE-Front/version/sign

调用方法

HTTP GET

请求参数

1)参数表

序号中文参数名类型最大长度必填说明
---

2)数据格式

  1. http://localhost:5002/WeBASE-Front/version/sign

响应参数

1)数据格式

a、成功:

  1. v1.4.0

10.4. 合约部署接口(本地签名)

接口描述

此接口为WeBASE-Front使用本地私钥(页面中的测试用户)进行签名

将合约部署到当前节点。

构造方法参数(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"]]

构造方法参数(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"]]

查看WeBASE-Front通过WeBASE-Sign部署合约的接口(非本地私钥签名交易),可查看合约接口-合约部署接口(结合WeBASE-Sign)

接口URL

http://localhost:5002/WeBASE-Front/contract/deploy

调用方法

HTTP POST

请求参数

1)参数表

序号中文参数名类型最大长度必填说明
1所属群组groupIdint
2用户地址userString用户地址,可通过/privateKey接口创建
3合约名称contractNameString
4合约abiabiInfoList合约编译后生成的abi文件内容
5合约binbytecodeBinString合约编译的bytecode(bin),用于部署合约
6构造函数参数funcParamList合约构造函数所需参数,JSON数组,多个参数以逗号分隔(参数为数组时同理),如:[“str1”,[“arr1”,”arr2”]]
7合约版本versionString用于指定合约在CNS中的版本

2)数据格式

  1. {
  2. "user":"0x2db346f9d24324a4b0eac7fb7f3379a2422704db",
  3. "contractName":"HelloWorld",
  4. "abiInfo": [],
  5. "bytecodeBin":"",
  6. "funcParam":[]
  7. }

响应参数

1)数据格式

  1. {
  2. "0x60aac015d5d41adc74217419ea77815ecb9a2192"
  3. }

10.5. 交易处理接口(本地签名)

接口描述

此接口为WeBASE-Front使用本地私钥(页面中的测试用户)进行签名

通过合约信息进行调用,前置根据调用的合约方法是否是“constant”方法区分返回信息,“constant”方法为查询,返回要查询的信息。非“constant”方法为发送数据上链,返回块hash、块高、交易hash等信息。

方法入参(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"]]

查看WeBASE-Front通过WeBASE-Sign交易处理的接口(非本地私钥签名交易),可查看合约接口-交易处理接口(结合WeBASE-Sign)

接口URL

http://localhost:5002/WeBASE-Front/trans/handle

调用方法

HTTP POST

请求参数

1)参数表

序号中文参数名类型最大长度必填说明
1用户地址userString用户地址,可通过/privateKey接口创建
2合约名称contractNameString
3合约地址contractAddressString
4方法名funcNameString
5合约编译后生成的abi文件内容contractAbiList合约中单个函数的ABI,若不存在同名函数可以传入整个合约ABI,格式:JSONArray
6方法参数funcParamListJSON数组,多个参数以逗号分隔(参数为数组时同理),如:[“str1”,[“arr1”,”arr2”]],根据所调用的合约方法判断是否必填
7群组IDgroupIdint默认为1
8合约版本versionStringCNS中合约版本,该字段在v1.3.0+版本已弃用
9合约路径contractPathint

2)数据格式

示例:

  1. curl -l -H "Content-type: application/json" -X POST -d '{"contractName":
  2. "HelloWorld", "contractAbi": [{\"constant\":false,\"inputs\":[{\"indexed\":false,\"name\":\"n\",\"type\":\"string\"}],\"name\":\"set\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"}], funcName": "set", "funcParam": ["Hi,Welcome!"], "user": "0x2db346f9d24324a4b0eac7fb7f3379a2422704db", "contractAddress":"dasdfav23rf213vbcdvadf3bcdf2fc23rqde","groupId": 1}' http://10.0.0.1:5002/WeBASE-Front/trans/handle

传入合约abi:

  1. {
  2. "user":"0x2db346f9d24324a4b0eac7fb7f3379a2422704db",
  3. "contractName":"HelloWorld",
  4. "contractAddress":"dasdfav23rf213vbcdvadf3bcdf2fc23rqde",
  5. "funcName":"set",
  6. "contractAbi":[{"constant":true,"inputs":[],"name":"getVersion","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getStorageCell","outputs":[{"name":"","type":"string"},{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"n","type":"string"}],"name":"setVersion","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[{"name":"storageHash","type":"string"},{"name":"storageInfo","type":"string"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"}],
  7. "funcParam":["Hi,Welcome!"],
  8. "groupId" :"1"
  9. }

响应参数

a、正确查询交易返回值信息

  1. {"Hi,Welcome!"}

b、正确发送数据上链返回值信息(交易收据)

  1. {
  2. "code": 0,
  3. "message": "success",
  4. "data": {
  5. "blockHash":
  6. "0x1d8d8275aa116d65893291c140849be272dac1d4ca0a0a722f44404b2f2356c3",
  7. "gasUsed": 32798,
  8. "transactionIndexRaw": "0",
  9. "blockNumberRaw": "33",
  10. "blockNumber": 33,
  11. "contractAddress": "0x0000000000000000000000000000000000000000",
  12. "cumulativeGasUsed": 32798,
  13. "transactionIndex": 0,
  14. "gasUsedRaw": "0x801e",
  15. "logs": [],
  16. "cumulativeGasUsedRaw": "0x801e",
  17. "transactionHash":"0x0653a8e959771955330461456dd094a96d9071bfa31e6f43b68b30f10a85689c"
  18. }
  19. }

11. 附录

1. 返回码信息列表

codemessage描述
0success成功
101001system error系统异常
101002param valid fail参数校验异常
101003web3jMap of groupId is null, please call /{groupId}/web3/refresh to refresh连接当前群组失败,请调用/{groupId}/web3/refresh刷新群组
101004groupList error for no group, web3jMap is empty群组列表为空,请检查节点共识状态
201001groupId cannot be empty群组编号不能为空
201002user cannot be empty用户地址不能为空
201003useAes cannot be empty是否为加密私钥不能为空
201004version cannot be empty合约版本不能为空
201005funcName cannot be empty方法名不能为空
201006abiInfo cannot be emptyabi内容不能为空
201007bytecodeBin cannot be empty合约bin不能为空
201008contract’s current version has been deployed该合约版本已部署
201009contract is not deployed合约未部署
201010save abi errorabi保存错误
201011contract funcParam is error请求的方法参数错误
201012requst blockNumber is greater than latest请求块高大于最新块高
201013get abi from chain error获取合约abi错误
201014contract deploy error合约部署错误
201015user’s privateKey is null用户私钥为空
201016file is not exist文件不存在
201017failed to get node config获取节点配置失败
201018blockNumber and pbftView unchanged块高和view没有变化
201019request function is error请求的方法错误
201020transaction query from chain failed交易查询失败
201021transaction send to chain failed交易上链失败
201022node request failed节点请求失败
201023contract already exists合约已经存在
201024contract name cannot be repeated合约名不能重复
201025invalid contract id无效的合约编号
201026contract has been deployed合约已部署
201027send abiInfo fail发送abi失败
201028bytecodeBin is null合约bin为空
201029contractAddress is null合约地址为空
201030contractAddress invalid合约地址无效
201031privateKey decode fail私钥编码失败
201032not found config of keyServer密钥服务未配置
201033data request sign error数据请求签名异常
201034groupId not exist群组编号不存在
201035version and address cannot all be null合约版本和地址不能同时为空
201036compile fail合约编译失败
201037user name is null用户名为空
201038user name already exists用户名已存在
201039private key already exists私钥已存在
201040private key not exists私钥不存在
201041external user’s appId and signUserId cannot be empty外部用户的appId和signUserId不能为空
201042There is no sol files in sourcesolidity文件不存在
201043invalid group operate type群组操作类型不正确
201044invalid data type不正确的数据类型
201101groupId cannot be empty群组编号不能为空
201102tableName cannot be empty表名不能为空
201103permissionType cannot be empty权限类型不能为空
201104permissionType not exists权限类型不存在
201105from address cannot be empty管理员地址不能为空
201106contract name cannot be empty合约名不能为空
201107system config key cannot be empty系统配置key值不能为空
201108system config value cannot be empty系统配置value值不能为空
201109node id cannot be empty节点id不能为空
201110node type cannot be empty节点类型(共识状态不能为空)
201111Permission state cannot be all empty更新的用户权限状态不能为空
201112contract address cannot be empty合约地址不能为空
201113contract handle type cannot be empty合约操作类型不能为空
201114grantAddress cannot be empty赋值的地址不能为空
201115invalid contract handle type不正确的合约操作类型
201116contract status handle fail合约状态修改失败
201120group operate fail群组操作失败
201121node internal error节点内部错误
201122group already exists群组已存在
201123group already running群组已运行
201124group already stopped群组已停止
201125group already deleted群组已删除
201126group not found未找到群组
201127group operate param error群组操作入参错误
201128group peers not connected群组内节点未连接
201129group genesis conf already exists群组创世块文件已存在
201130group config.ini already exists群组的配置文件已存在
201131group genesis conf not found未找到群组创世块文件
201132group config.ini not found未找到群组的配置文件
201133group is stopping群组正在停止
201134group not deleted群组未删除
201151Unsupported contract param type to encoded不支持编码的合约参数类型
201152Unsupported contract param type to decoded不支持解码的合约参数类型
201153unable to create instance of type, check input params无法创建该合约参数类型的实例,请检查入参

| 201200 | params not fit | 参数不符合要求 | | 201201 | address is invalid | 账户地址不正确 | | 201202 | permission denied, please check chain administrator permission | 权限不足,请检查用户 |

| 201208 | unsupported for this system config key | 不支持设置该系统配置 | | 201209 | provide value by positive integer mode, from 100000 to 2147483647 | 请输入正值或[100000, 2147483647]范围的值 | | 201210 | set system config value fail for params error or permission denied | 设置系统配置失败,请检查权限 | | 201211 | query system config value list fail | 获取系统配置列表失败 | | 201216 | node id is invalid | 节点id错误 | | 201217 | invalid node type: sealer, observer, remove | 节点类型(共识状态)错误:sealer, observer, remove | | 201218 | set node consensus type fail, check permission or node’s group config file | 节点类型(共识状态)修改失败,请检查权限或节点群组配置文件 | | 201221 | Contract version should only contains ‘A-Z’ or ‘a-z’ or ‘0-9’ or dot mark | CNS合约版本号应只包含大小写字母、数字和”.” | | 201222 | version of contract is out of length | 合约版本号过长 | | 201226 | sql syntax error | sql语句错误 | | 201227 | crud sql fail | 执行sql语句失败 | | 201228 | table not exists | 操作的表格不存在 | | 201231 | Cert file not found, please check cert path in config | 配置文件中的证书地址错误,未找到证书文件 | | 201232 | Pem file format error, must surrounded by —–XXXXX PRIVATE KEY—– | pem证书格式错误,必须以”—–XXXXX PRIVATE KEY—–“开头结尾 | | 201233 | Pem file content error | pem证书内容错误 | | 201235 | p12’s password cannot be chinese | p12证书密码不能是中文 | | 201236 | p12’s password not match | p12证书密码错误 | | 201237 | P12 file content error | p12证书内容错误 | | 201241 | Exchange or message queue not exists, please check mq server or mq configuration | 交换机或消息队列不存在,请检查mq-server运行状态及其配置 | | 201242 | Database error: data already exists in db | 数据库错误:该数据记录已存在于数据库中 | | 201243 | Block range error, from/toBlock must greater than 0, toBlock must be greater than fromBlock | 合约Event区块范围错误,from大于0,to大于from | | 201244 | Database error: data not exists in db, please check your params | 该数据记录不存在,请检查参数 | | 201245 | Only support letter and digit, please check your params | 仅支持使用数字字母与下划线,请检查参数 | | 201246 | Register contractEvent failed, please check your param | 订阅合约事件失败,请检查参数格式 | | 201247 | Unregister event failed, please check mq server exchange | 取消订阅事件失败,请检查参数格式 | | 201248 | Contract abi invalid, please check abi | 合约ABI格式错误,请检查入参 | | 201255 | contract address already exists | 合约地址已存在 | | 201256 | abi info of this id not exists | abi不存在 | | 201257 | Abi Id cannot be empty | abi编号不能为空 |

2. Precompiled Service说明

对预编译合约接口的使用有疑惑,可以查看FISCO BCOS的PreCompiledService API说明

查看预编译合约的solidity接口代码,可以查看FISCO BCOS的web3sdk precompile模块,如crud/TableFactory.sol:

  1. pragma solidity ^0.4.2;
  2. contract TableFactory {
  3. function createTable(string tableName, string key, string valueField) public returns (int);
  4. }

查看FISCO BCOS中实现的precompild合约列表、地址分配及源码:

地址功能源码(libprecompiled目录)
0x1000系统参数管理SystemConfigPrecompiled.cpp
0x1001表工厂合约TableFactoryPrecompiled.cpp
0x1002CRUD合约CRUDPrecompiled.cpp
0x1003共识节点管理ConsensusPrecompiled.cpp
0x1004CNS功能CNSPrecompiled.cpp
0x1005存储表权限管理AuthorityPrecompiled.cpp
0x1006并行合约配置ParallelConfigPrecompiled.cpp

Precompiled Service API 错误码

错误码消息内容备注
0success
-50000permission denied
-50001table name already exist
-50100unknow function call
-50101table does not exist
-51000table name and address already exist
-51001table name and address does not exist
-51100invalid node IDSDK错误码
-51101the last sealer cannot be removed
-51102the node is not reachableSDK错误码
-51103the node is not a group peerSDK错误码
-51104the node is already in the sealer listSDK错误码
-51105the node is already in the observer listSDK错误码
-51200contract name and version already existSDK错误码
-51201version string length exceeds the maximum limitSDK错误码
-51300invalid configuration entry
-51500contract name and version already exist
-51501condition parse error
-51502condition operation undefined