网络创建相关接口
更新时间:2020-11-19
创建网络接口
接口描述
创建一个区块链网络,当前可选的网络类别有超级链试用网络、Fabric联盟链创建与加入、Quorum联盟创建与加入和以太坊四类,其中以太坊可选普通、高级和豪华三种配置,Fabric联盟链创建与加入、Quorum联盟创建与加入网络可选普通和豪华两种配置;必须填写网络所对应的参数,超级链试用网络对应参数为xChainExperienceForm,创建Fabric联盟链对应的参数为fabricConsortiumForm,加入Fabric联盟链参数为joinFabricConsortiumForm,创建Quorum联盟链对应的参数quorumConsortiumForm,加入Quorum联盟链对应的参数为joinQuorumConsortiumForm,以太坊对应参数为ethereumForm。
权限说明
请求发起人需要具有合法的AccessKeyID和SecretAccessKey才能发起请求。
注意事项
如果请求中没有用户验证信息(即匿名访问),返回403 Forbidden
,错误信息:AccessDenied
。
请求(Request)
-
请求语法
Plain Text1POST /v1/blockchain HTTP/1.1 2Host: bbe.bj.baidubce.com 3Date: <Date> 4Authorization: <Authorization_String>
- 请求头域 除公共头域外,无其它特殊头域。
- 请求参数
名称 | 类型 | 位置 | 描述 | 是否必须 |
---|---|---|---|---|
networkType | String | body | 指定创建区块链网络的类型,xChainExperience代超级链试用网络,fabricConsortiumOwner代表创建Fabric联盟,fabricConsortiumParticipant代表加入fabric联盟,quorumConsortiumOwner代表创建Quorum联盟,quorumConsortiumParticipant代表加入Quorum联盟,ether代表以太坊网络 | 必须 |
bbeOrderContent | BaseCreateOrderRequestVo |
body | bcc创建的订单内容,ITEM表示BBE订单模型,参考BbeConfig | 必须 |
logicalZone | []String | body | 节点可用区,可填zoneA, zoneB, zoneC | 必须 |
xChainExperienceForm | XChainExperienceForm | body | 超级链网络参数 | 选填,如networkType 为 xChainExperience ,则此项必填 |
fabricConsortiumForm | FabricConsortiumForm | body | 创建Fabric联盟 | 选填,如networkType 为 fabricConsortiumOwner ,则此项必填 |
joinFabricConsortiumForm | JoinFabricConsortiumForm | body | 加入Fabric联盟 | 选填,如networkType 为 fabricConsortiumParticipant ,则此项必填 |
quorumConsortiumForm | QuorumConsortiumForm | body | 创建Quorum联盟 | 选填,如networkType 为 quorumConsortiumOwner ,则此项必填 |
joinQuorumConsortiumForm | JoinQuorumConsortiumForm | body | 加入Quorum联盟 | 选填,如networkType 为 quorumConsortiumParticipant ,则此项必填 |
ethereumForm | EthereumForm | body | 以太坊网络参数 | 选填,如networkType 为 ether ,则此项必填 |
响应(Response)
-
响应头域
除公共头域外,无其它特殊头域。
- 响应参数
名称 | 类型 | 描述 |
---|---|---|
networkUuid | String | 网络Id |
失败响应参考错误码部分。
示例
- 创建超级链试用网络请求示例
Plain Text
1POST /v1/blockchain HTTP/1.1
2content-type: application/json
3host: bbe.bj.baidubce.com
4x-bce-date: 2019-01-06T06:55:42Z
5x-bce-request-id: b9485394-c7dc-3cfa-d454-57c34773d08c
6authorization: bce-auth-v1/5fded23b03594981872fbfadaad70ef6/2019-01-06T06:55:42Z/1800/host/0b9f07c38e8f3815424002ef2326b2d66d73439f591d561b7d5bfa3fad8c558d
7{
8 "networkType":"xChainExperience",
9 "bbeOrderContent":{
10 "region":"bj",
11 "orderType":"NEW",
12 "items":[
13 {
14 "config":{
15 "serviceType":"BBE",
16 "productType":"prepay",
17 "key":"bbe",
18 "count":1,
19 "time":2,
20 "timeUnit":"DAY",
21 "flavor":[
22 {
23 "name":"subServiceType",
24 "value":"XuperChainTrail"
25 },
26 {
27 "name":"traildays",
28 "value":1
29 }
30 ]
31 }
32 }
33 ]
34 },
35 "xChainExperienceForm":{
36 "tpl":"xplatform",
37 "address":"jvPVe8vkJL5xFtAqN42xADroLGwkEzGhz",
38 "sign":"",
39 "netType":"4",
40 "deployType":"00000010",
41 "nodeObj":{
42 "level":1,
43 "nodes":[
44 {
45 "id":5000,
46 "displayName":"节点名称2",
47 "count":1
48 }
49 ]
50 },
51 "techBased":5,
52 "netName":"baby_hello",
53 "netNameCn":"中国好孩阿达",
54 "consensus":"single",
55 "isExplorer":"1"
56 }
57}
- 创建以太坊网络请求示例
Plain Text
1POST /v1/blockchain HTTP/1.1
2content-type: application/json
3host: bbe.bj.baidubce.com
4x-bce-date: 2019-01-06T06:55:42Z
5x-bce-request-id: b9485394-c7dc-3cfa-d454-57c34773d08c
6authorization: bce-auth-v1/5fded23b03594981872fbfadaad70ef6/2019-01-06T06:55:42Z/1800/host/0b9f07c38e8f3815424002ef2326b2d66d73439f591d561b7d5bfa3fad8c558d
7{
8 "bbeOrderContent": {
9 "items": [{
10 "config": {
11 "flavor": [{
12 "name": "subServiceType",
13 "value": "EthereumDefaultConf"
14 },
15 {
16 "name": "nodeNum",
17 "value": "1"
18 }
19 ]
20 }
21 }]
22 },
23 "logicalZone": [
24 "zoneC"
25 ],
26 "networkType": "ether",
27 "ethereumForm": {
28 "networkName": "test-ether",
29 "nodeNumber": 2,
30 "targetGasLimit": 4294967295,
31 "maxPeers": 2,
32 "verbosity": 1,
33 "syncMode": "full",
34 "gasPrice": 18000000000,
35 "difficulty": 1024,
36 "gasLimit": 4294967295
37 }
38}
- 创建Fabric联盟链
Plain Text
1POST /v1/blockchain HTTP/1.1
2content-type: application/json
3host: bbe.bj.baidubce.com
4x-bce-date: 2019-10-22T13:32:30Z
5x-bce-request-id: 028bd2fe-8c80-4d2d-add5-090aeecba47b
6authorization: bce-auth-v1/3bfbc8ac1a424d8a9c611caa5e750e60/2019-10-22T13:32:30Z/1800/host/f14313bd47eb9feebe7e8c5769e5ab1aa7b4fdd216cf4e8159ac2ecbfb5c7980
7{
8 "bbeOrderContent": {
9 "items": [{
10 "config": {
11 "flavor": [{
12 "name": "subServiceType",
13 "value": "ConsortiumCreateDefaultConf"
14 }
15 ]
16 }
17 }]
18 },
19 "logicalZone": [
20 "zoneC"
21 ],
22 "networkType": "fabricConsortiumOwner",
23 "fabricConsortiumForm": {
24 "name": "first",
25 "englishName": "first",
26 "channelPolicy": "any",
27 "consensus": "kafka",
28 "ordererOrg": "ca38e31c-17b1-2d71-1269-a180972d82a3",
29 "description": "fabric-cons-qa-auto-test"
30 }
31}
- 加入Fabric联盟链
Plain Text
1POST /v1/blockchain HTTP/1.1
2content-type: application/json
3host: bbe.bj.baidubce.com
4x-bce-date: 2019-10-22T13:32:30Z
5x-bce-request-id: 028bd2fe-8c80-4d2d-add5-090aeecba47b
6authorization: bce-auth-v1/3bfbc8ac1a424d8a9c611caa5e750e60/2019-10-22T13:32:30Z/1800/host/f14313bd47eb9feebe7e8c5769e5ab1aa7b4fdd216cf4e8159ac2ecbfb5c7980
7{
8 "bbeOrderContent": {
9 "items": [{
10 "config": {
11 "flavor": [{
12 "name": "subServiceType",
13 "value": "ConsortiumJoinDefaultConf"
14 }
15 ]
16 }
17 }]
18 },
19 "logicalZone": [
20 "zoneC"
21 ],
22 "networkType": "fabricConsortiumParticipant",
23 "joinFabricConsortiumForm":{
24 "consortiumUuid":"dcc7fc68-b281-e98d-37aa-73cd15c6eef0",
25 "orgUuid":"75339ab5-4e5c-fbdd-ac94-66a457d199c6",
26 "approvalUuid":"7180faa0-28a9-a7f4-940f-24d0995ccd90-0"
27 }
28}
- 创建Quorum联盟请求示例
Plain Text
1POST /v1/blockchain HTTP/1.1
2content-type: application/json
3host: bbe.bj.baidubce.com
4x-bce-date: 2019-10-22T12:02:48Z
5x-bce-request-id: abaae432-7f8b-4d07-bc6b-245a36dc305d
6authorization: bce-auth-v1/98cdcde27d8e464d895222fd8023a029/2019-10-22T12:02:48Z/1800/host/df7101be69d2cef005d61a6f4c549127f120971d0c7dc69b7b42c33feaed6d
7{
8 "bbeOrderContent": {
9 "items": [{
10 "config": {
11 "flavor": [{
12 "name": "subServiceType",
13 "value": "QuorumDefaultConf"
14 }]
15 }
16 }]
17 },
18 "logicalZone": [
19 "zoneC"
20 ],
21 "networkType": "quorumConsortiumOwner",
22 "quorumConsortiumForm": {
23 "orgUuid": "bf22b53a-793f-4e81-8a48-b16cfff64999",
24 "name": "test-quorum",
25 "domain": "test-quorum",
26 "description": "test-quorum",
27 "nodeNumber": 1,
28 "gasLimit": 4294967295,
29 "targetGasLimit": 4294967295,
30 "consensus": "IBFT",
31 "blockPeriod": 5
32 }
33}
- 加入Quorum联盟请求示例
Plain Text
1POST /v1/blockchain HTTP/1.1
2content-type: application/json
3host: bbe.bj.baidubce.com
4x-bce-date: 2019-10-22T12:02:48Z
5x-bce-request-id: 51947834-abd5-4158-b703-e6f77c03c041
6authorization: bce-auth-v1/98cdcde27d8e464d895222fd8023a029/2019-10-22T12:02:48Z/1800/host/df7101be69d2cef005d61a6f4c549127f120971d0c7dc69b7b42c33feaed6d3
7{
8 "bbeOrderContent": {
9 "items": [{
10 "config": {
11 "flavor": [{
12 "name": "subServiceType",
13 "value": "QuorumDefaultConf"
14 }]
15 }
16 }]
17 },
18 "logicalZone": [
19 "zoneC"
20 ],
21 "networkType": "quorumConsortiumParticipant",
22 "joinQuorumConsortiumForm": {
23 "orgUuid": "bf22b53a-793f-4e81-8a48-b16cfff64999",
24 "applicationUuid": "55a723e9-c0ef-41e4-979d-706751a9531b",
25 "nodeNumber": 1
26 }
27}
- 响应示例
Plain Text
1200
2Content-Length: 0
3Content-Type: application/json; charset=utf-8
4Date: Fri, 04 Jan 2019 10:25:02 GMT
5 {
6 "data": {
7 "networkUuid": "b80f8971-c21f-46bc-967d-9a35e09b60d4"
8 }
9 }