接口说明

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. 合约部署接口

接口描述

将合约部署到当前节点

接口URL

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

调用方法

HTTP POST

请求参数

1)参数表

序号中文参数名类型最大长度必填说明
1所属群组groupIdint
2用户编号userString用户编号或者用户地址
3合约名称contractNameString
4合约abiabiInfoList合约编译后生成的abi文件内容
5合约binbytecodeBinString合约编译的bytecode(bin),用于部署合约
6构造函数参数funcParamList
7是否需要加密私钥useAesboolean

2)数据格式

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

响应参数

1)数据格式

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

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

接口描述

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

接口URL

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

调用方法

HTTP POST

请求参数

1)参数表

序号中文参数名类型最大长度必填说明
1所属群组groupIdint
2签名用户编号signUserIdStringWeBASE-Sign服务的用户编号
3合约binbytecodeBinString合约编译的bytecode(bin),用于部署合约
4合约abicontractAbiList合约编译后生成的abi文件内容
5构造函数参数funcParamList

2)数据格式

  1. {
  2. "groupId":1,
  3. "signUserId":100001,
  4. "bytecodeBin":"xxx",
  5. "contractAbi": [],
  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\": 100001}"

响应参数

1)数据格式

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

1.4. 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.5. 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.6. 保存合约接口

接口描述

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

接口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.7. 删除合约接口

接口描述

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

接口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.8. 分页查询合约列表

接口描述

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

接口URL

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

调用方法

HTTP POST

请求参数

1)参数表

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

2)数据格式

  1. {
  2. "groupId": "1",
  3. "pageNumber": 0,
  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.9. 合约是否被修改接口

接口描述

校验已部署的合约是否被修改了,返回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.10. 后台编译合约

接口描述

通过后台的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. }

2. 密钥接口

2.1. 获取公私钥接口

接口描述

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

接口URL

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

调用方法

HTTP GET

请求参数

1)参数表

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

2)数据格式

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

响应参数

1)数据格式

  1. {
  2. "address": "0x2007e1430f41f75c850464307c0994472bd92ee0",
  3. "publicKey": "0x9bd35211855f9f8de22d8a8da7f30d35d62ab2c3d36ea5162008fcbb9faff4d83809f7033deb20049bf51e081105076ec7a09a847f852530f81e978b1eda0392",
  4. "privateKey": "42caa160cadcb635381b980ddd981171c862d3105981fe92d6db330f30615f21",
  5. "userName": "test",
  6. "type": 0
  7. }

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&useAes=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. }

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

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

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

5. 交易接口

5.1. 交易处理接口

接口描述

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

接口URL

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

调用方法

HTTP POST

请求参数

1)参数表

序号中文参数名类型最大长度必填说明
1用户编号userString用户编号或者用户地址
2合约名称contractNameString
3合约地址contractAddressString
4方法名funcNameString
5合约编译后生成的abi文件内容contractAbiListJSONArray,如果传入此字段,则使用这个abi。如果没有传入此字段,则从db或cns获取合约abi
5方法参数funcParamListJSONArray,对应合约方法参数,多个参数以“,”分隔,根据所调用的合约方法判断是否必填
6群组IDgroupIdint默认为1
7是否是加密私钥useAesboolean

2)数据格式

不传入合约abi:

  1. {
  2. "useAes":false,
  3. "user":"700001",
  4. "contractName":"HelloWorld",
  5. "contractAddress":"dasdfav23rf213vbcdvadf3bcdf2fc23rqde",
  6. "funcName":"set",
  7. "funcParam":["Hi,Welcome!"],
  8. "groupId" :"1"
  9. }

示例:

  1. curl -l -H "Content-type: application/json" -X POST -d '{"contractName":
  2. "HelloWorld", "funcName": "set", "funcParam": ["Hi,Welcome!"], "user": 700001, "useAes": false, "contractAddress":"dasdfav23rf213vbcdvadf3bcdf2fc23rqde","groupId": 1}' http://10.0.0.1:5002/WeBASE-Front/trans/handle

传入合约abi:

  1. {
  2. "useAes ":false,
  3. "user":"700001",
  4. "contractName":"HelloWorld",
  5. "contractAddress":"dasdfav23rf213vbcdvadf3bcdf2fc23rqde",
  6. "funcName":"set",
  7. "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"}],
  8. "funcParam":["Hi,Welcome!"],
  9. "groupId" :"1"
  10. }

响应参数

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

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

接口描述

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

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

接口URL

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

调用方法

HTTP POST

请求参数

1)参数表

序号中文参数名类型最大长度必填说明
1群组编号groupIdint群组编号,默认为1
2用户编号signUserIdint签名用户编号(查询方法可不传)
3合约编译后生成的abi文件内容contractAbiList
4合约地址contractAddressString
5方法名funcNameString
6方法参数funcParamListJSONArray,对应合约方法参数,多个参数以“,”分隔,根据所调用的合约方法判断是否必填

2)数据格式

  1. {
  2. "groupId" :1,
  3. "signUserId":100001,
  4. "contractAbi":[],
  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\": 100001}"

响应参数

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时不可为空
6是否为加密私钥useAesBoolean默认值为false

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时不可为空
6是否为加密私钥useAesBoolean默认值为false

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四种权限
5是否为加密私钥useAesBoolean默认值为false

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]
5是否为加密私钥useAesBoolean默认值为false

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获取
5是否为加密私钥useAesBoolean默认值为false

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,小写
4是否为加密私钥useAesBoolean默认值为false

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

7. 链上事件订阅接口

7.1. 订阅出块事件通知

接口描述

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

接口URL

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

调用方法

HTTP POST

请求参数

1)参数表

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

2)数据格式

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

响应参数

1)数据格式

成功:

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

失败(如:重复订阅)

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

7.2. 订阅合约event事件通知

接口描述

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

接口URL

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

调用方法

HTTP POST

请求参数

1)参数表

序号中文参数名类型最大长度必填说明
1应用编号appIdString注册事件通知的应用的唯一编号
2所属群组groupIdInteger
3交换机名字exchangeNameString队列所属交换机
4队列名queueNameString队列名,一般以用户名作队列名
5合约abicontractAbiList合约的ABI,用于合约event解析
6event起始区块fromBlockString最小值为1;填写latest,表示一直监听最新区块
7event末区块toBlockString最小值为1,最大值为当前区块高度,需 要大于等于fromBlock;填写latest,表示一直监听最新区块
8合约地址contractAddressString合约地址
9合约event名列表topicListList合约event事件名的list,以中括号括住,以英文逗号相隔,不带空格;如[HelloWorld(string)]

2)数据格式

  1. {
  2. "appId": "app2",
  3. "groupId": 1,
  4. "exchangeName": "group001",
  5. "queueName": "user2",
  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. }

响应参数

1)数据格式

成功:

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

失败(如:重复订阅)

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

8 其他接口

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

9. 附录

1. 返回码信息列表

codemessage描述
0success成功
101001system error系统异常
101002param valid fail参数校验异常
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私钥已存在
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节点类型(共识状态不能为空)
201200params not fit参数不符合要求
201201address is invalid账户地址不正确
201208unsupported for this system config key不支持设置该系统配置
201209provide value by positive integer mode, from 100000 to 2147483647请输入正值或[100000, 2147483647]范围的值
201210set system config value fail for params error or permission denied设置系统配置失败,请检查权限
201211query system config value list fail获取系统配置列表失败
201216node id is invalid节点id错误
201217invalid node type: sealer, observer, remove节点类型(共识状态)错误:sealer, observer, remove
201218set node consensus type fail, check permission or node’s group config file节点类型(共识状态)修改失败,请检查权限或节点群组配置文件
201221Contract version should only contains ‘A-Z’ or ‘a-z’ or ‘0-9’ or dot markCNS合约版本号应只包含大小写字母、数字和”.”
201222version of contract is out of length合约版本号过长
201226sql syntax errorsql语句错误
201227crud sql fail执行sql语句失败
201228table not exists操作的表格不存在
-51503crud sql execute error执行sql失败
201231Cert file not found, please check cert path in config配置文件中的证书地址错误,未找到证书文件
201232Pem file format error, must surrounded by ——-XXXXX PRIVATE KEY——-pem证书格式错误,必须以”——-XXXXX PRIVATE KEY——-“开头结尾
201233Pem file content errorpem证书内容错误
201241Exchange or message queue not exists, please check mq server or mq configuration交换机或消息队列不存在,请检查mq-server运行状态及其配置
201242Database error: data already exists in db数据库错误:该数据记录已存在于数据库中

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