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