Updated on 2023-06-20 GMT+08:00

Creating a BCS Service

Function

This API is used to create a pay-per-use BCS service.

URI

POST /v2/{project_id}/blockchains

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID obtained from IAM. Generally, a project ID contains 32 characters.

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token obtained from IAM.

Minimum: 1

Maximum: 32768

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

name

Yes

String

BCS service name. The name can contain 4 to 24 characters, including letters, digits, and hyphens (-). It cannot start with a hyphen (-).

version_type

Yes

Long

BCS versions. Options: 4 (Basic), 2 (Professional) If the service is created by an invitee, the value must be the same as that of the inviting party.

fabric_version

No

String

Fabric version. The value can only be 2.2 if the service was created by an inviting party or is a private blockchain. If the service was created by an invitee, the value must be the same as the version of the inviting party's blockchain. The CCE cluster used by Fabric v1.4 services can only be v1.15 or earlier. The default value is 2.2.

blockchain_type

No

String

Blockchain type. The value can be union (consortium blockchain) or private (private blockchain). Default value: private. If the service is created by an invitee, the value must be the same as that of the inviting party.

consensus

No

String

Consensus algorithm used by the BCS service. For Fabric v1.4, the value can be SOLO or SFLIC (fast Byzantine fault tolerance). For Fabric v2.2, the value can be etcdraft or SFLIC (fast Byzantine fault tolerance). If the service is created by an invitee, the value must be the same as that of the inviting party.

sign_algorithm

No

String

Security mechanism used by the BCS service. The value can be ECDSA or sm2 (OSCCA-published cryptographic algorithms).

enterprise_project_id

Yes

String

ID of the enterprise project that the BCS service belongs to.

volume_type

No

String

Type of the storage volume used by the CCE cluster. The value can be evs (EVS disk), nfs (SFS), or efs (SFS Turbo).

evs_disk_type

No

String

EVS disk type, which is required when volume_type is evs. The value can be SATA (common I/O), SAS (high I/O), or SSD (ultra-high I/O).

org_disk_size

No

Long

Storage capacity of the peer organization. Minimum value: 100 GB for the basic and professional editions.

database_type

No

String

Type of the database used by the BCS service, including the file database (goleveldb*) and NoSQL (couchdb). If couchdb is used, specify the couchdb_info field.

resource_password

Yes

String

Resource access and blockchain management password.

orderer_node_number

No

Long

Number of orderers. This parameter is not required when an invitee is creating a BCS service, but is required for a Fabric v2.2 service.

use_eip

No

Boolean

Whether to use the elastic IP address (EIP) of a CCE node.

bandwidth_size

No

Long

EIP bandwidth.

cluster_type

Yes

String

Cluster type, which can be a CCE cluster.

create_new_cluster

Yes

Boolean

Indication of whether to create a cluster. If you use an existing cluster, set this parameter to the value of the cce_cluster_info field. If you create a cluster, set this parameter to the value of the cce_create_info field.

cce_cluster_info

No

CCEClusterInfo object

Information about an existing CCE cluster. The CCE cluster used by Fabric v1.4 services can only be v1.15 or earlier.

cce_create_info

No

CCECreateInfo object

Information of the CCE cluster being created.

ief_deploy_mode

No

Long

IEF cluster deployment mode. The value can be 0 (a node can be randomly allocated to an organization) or 1 (a peer organization is bound with a node). If this parameter is set to 1, the peer_orgs parameter must be set. The organization name must be the same as the IEF node name.

ief_nodes_info

No

Array of IEFNode objects

IEF cluster nodes. This parameter is required when the BCS service is deployed using IEF.

peer_orgs

No

Array of OrgPeer objects

Peer organization list. If a peer organization is bound with a node, the organization must be named after the node. This parameter is required when the BCS service is deployed using IEF.

channels

No

Array of ChannelInfoV2 objects

Channel list.

couchdb_info

No

CouchDb object

CouchDB information.

turbo_info

No

TurboInfo object

Information about the SFS Turbo file system.

block_info

No

block_info object

Block generation configurations.

kafka_create_info

No

KafkaCreateInfo object

Kafka instance creation information.

tc3_need

No

Boolean

Whether Trusted Computing Platform is enabled.

restful_api_support

No

Boolean

Whether RESTful APIs are enabled.

is_invitee

No

Boolean

Indication of whether the BCS service is created for an invitee. If yes, specify the invitor_infos field.

invitor_infos

No

InvitorInfos object

Inviting party information.

Table 4 CCEClusterInfo

Parameter

Mandatory

Type

Description

cluster_id

Yes

String

Cluster ID.

cluster_name

Yes

String

Cluster name.

cluster_platform_type

Yes

String

Cluster CPU architecture type. The value can be VirtualMachine (x86) or ARM64 (Arm).

Table 5 CCECreateInfo

Parameter

Mandatory

Type

Description

node_num

Yes

Long

Number of CCE cluster nodes.

node_flavor

Yes

String

Flavor ID of a CCE cluster node (minimum 4 vCPUs and 8 GB memory).

cce_flavor

Yes

String

CCE cluster flavor.

init_node_pwd

Yes

String

Initial password of the node.

az

Yes

String

AZ.

cluster_platform_type

Yes

String

Cluster CPU architecture type. The value can be VirtualMachine (x86) or ARM64 (Arm).

Table 6 IEFNode

Parameter

Mandatory

Type

Description

id

Yes

String

Node ID.

status

Yes

String

Node state (ACTIVE).

public_ip_address

Yes

String

Node public IP address.

Table 7 OrgPeer

Parameter

Mandatory

Type

Description

name

Yes

String

Organization name.

node_count

Yes

Long

Number of peers in the organization.

Table 8 ChannelInfoV2

Parameter

Mandatory

Type

Description

name

Yes

String

Channel name.

org_names

Yes

Array of strings

Names of organizations in the channel.

description

No

String

Channel description.

Table 9 CouchDb

Parameter

Mandatory

Type

Description

user_name

Yes

String

CouchDB username.

password

Yes

String

CouchDB password.

Table 10 TurboInfo

Parameter

Mandatory

Type

Description

share_type

Yes

String

Sharing mode. The value is fixed at STANDARD.

type

Yes

String

Type. The value is fixed to efs-ha.

available_zone

Yes

String

AZ. The value can be an empty string.

resource_spec_code

Yes

String

Specifications. The value is fixed at sfs.turbo.standard.

Table 11 block_info

Parameter

Mandatory

Type

Description

batch_timeout

No

Long

Block generation interval in seconds. The default interval is 2s.

max_message_count

No

Long

Number of transactions in a block. The default quantity is 500.

preferred_maxbytes

No

Long

Block size in MB. The default size is 2 MB.

Table 12 KafkaCreateInfo

Parameter

Mandatory

Type

Description

spec

Yes

String

Kafka instance specifications. The value can be mini (100 MB/s bandwidth), small (300 MB/s bandwidth), middle (600 MB/s bandwidth), or high (1200 MB/s bandwidth).

storage

Yes

Long

Storage space in GB. The maximum value is 9000. The storage space is at least 300 for mini instances, 1200 for small instances, 2400 for middle instances, and 4800 for high instances.

az

Yes

String

AZs configured for the Kafka instance.

Table 13 InvitorInfos

Parameter

Mandatory

Type

Description

tenant_id

Yes

String

Tenant ID of the inviting party.

project_id

Yes

String

Project ID of the inviting party.

blockchain_id

Yes

String

BCS service ID of the inviting party.

Response Parameters

Status code: 200

Table 14 Response body parameters

Parameter

Type

Description

blockchain_id

String

BCS service instance ID.

blockchain_name

String

BCS service instance name.

operation_id

String

Operation ID.

Status code: 400

Table 15 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

Minimum: 8

Maximum: 36

error_msg

String

Error message.

Minimum: 2

Maximum: 512

Status code: 401

Table 16 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

Minimum: 8

Maximum: 36

error_msg

String

Error message.

Minimum: 2

Maximum: 512

Status code: 403

Table 17 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

Minimum: 8

Maximum: 36

error_msg

String

Error message.

Minimum: 2

Maximum: 512

Status code: 404

Table 18 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

Minimum: 8

Maximum: 36

error_msg

String

Error message.

Minimum: 2

Maximum: 512

Status code: 500

Table 19 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

Minimum: 8

Maximum: 36

error_msg

String

Error message.

Minimum: 2

Maximum: 512

Example Requests

{
  "name" : "bcs-test",
  "fabric_version" : "2.2",
  "blockchain_type" : "union",
  "consensus" : "etcdraft",
  "version_type" : 4,
  "sign_algorithm" : "ECDSA",
  "enterprise_project_id" : "0",
  "volume_type" : "nfs",
  "evs_disk_type" : "SATA",
  "org_disk_size" : 100,
  "database_type" : "goleveldb",
  "resource_password" : "xxx",
  "orderer_node_number" : 3,
  "use_eip" : true,
  "bandwidth_size" : 5,
  "cluster_type" : "cce",
  "create_new_cluster" : false,
  "cce_cluster_info" : {
    "cluster_id" : "5adc2ce2-9712-11ea-9535-0255ac100b0d",
    "cluster_name" : "byl-1-15",
    "cluster_platform_type" : "ARM64"
  },
  "cce_create_info" : {
    "node_num" : 1,
    "node_flavor" : "Si1.xlarge.4.linux",
    "cce_flavor" : "cce.s1.small",
    "init_node_pwd" : "JDYkUzdOOUR0JEdyajFQV0tSWXNQRjZBZlhiSE5MVmpWV204V3M5alFMUXl4Z3dtOVNKb25xR0lIZWZaNUFReDVWeHNJa3gvb3JML2d1WjZyazNLQmNWczBpWVVFR2gw",
    "az" : "cn-north-7a",
    "cluster_platform_type" : "ARM64"
  },
  "ief_deploy_mode" : 0,
  "ief_nodes_info" : [ {
    "status" : "ACTIVE",
    "public_ip_address" : "192.168.1.95",
    "id" : "5700372e-49ef-4f4c-b433-11d95ad7acea"
  }, {
    "status" : "ACTIVE",
    "public_ip_address" : "192.168.1.213",
    "id" : "2455e71a-d806-4827-9cf4-81e1b3764681"
  } ],
  "peer_orgs" : [ {
    "name" : "organization",
    "node_count" : 2
  } ],
  "channels" : [ {
    "name" : "channel",
    "org_names" : [ "organization" ],
    "description" : ""
  } ],
  "block_info" : {
    "batch_timeout" : 2,
    "max_message_count" : 500,
    "preferred_maxbytes" : 2
  },
  "turbo_info" : {
    "share_type" : "STANDARD",
    "type" : "efs-ha",
    "available_zone" : "cn-north-7a",
    "resource_spec_code" : "sfs.turbo.standard"
  }
}

Example Responses

Status code: 200

Ok

{
  "blockchain_id" : "12691561-a50d-5207-6041-7346c90d4499",
  "blockchain_name" : "bcs-api",
  "operation_id" : "BCSSVC01-03-1617158790255323683"
}

Status code: 400

Bad Request

{
  "error_code" : "BCS.4006005",
  "error_msg" : "keyType error, keyType: blok not supported"
}

Status code: 401

Unauthorized

{
  "error_code" : "BCS.4010401",
  "error_msg" : "Incorrect token or token resolution failed"
}

Status code: 403

Forbidden

{
  "error_code" : "BCS.4030403",
  "error_msg" : "No permissions to request this method"
}

Status code: 404

Not Found

{
  "error_code" : "BCS.4040404",
  "error_msg" : "Not Found:the url is not found"
}

Status code: 500

InternalServerError

{
  "error_code" : "BCS.5000500",
  "error_msg" : "Internal Server Error"
}

Status Codes

Status Code

Description

200

Ok

400

Bad Request

401

Unauthorized

403

Forbidden

404

Not Found

500

InternalServerError

Error Codes

See Error Codes.