The cloud Key Management System (KMS) is a service where the cloud manages encrypted keys on behalf of users (Google Cloud Platform (GCP) KMS, Amazon Web Services (AWS) KMS).

Blockchain Open APIKMS API allows you to use keys stored in cloud KMS as your blockchain account wallet keys (private Key, or wallet private key). With the KMS API, users can generate transactions, sign them, and send them to the blockchain without directly managing their blockchain account wallet keys, via the keys stored in KMS instead. The cloud KMS platforms supported by the KMS API are GCP and AWS.

For example, the KMS API can be used as follows:

 

If you already have a key in cloud KMS

  1. Prepare cloud credentials
  2. Register cloud service account information (Credentials) at Hive Console > Blockchain > KMS Credentials > Add Credentials and obtain x-credential-id
  3. Prepare cloud KMS key information
  4. Call an API to register wallet address
  5. Acquire wallet address
  6. Query KMS wallet information
  7. Create transactions with KMS wallet: Call APIs for generating new transactions such as sending tokens and deploying smart contracts
  8. Sign the created transaction with KMS Sign API
  9. Send the signed transaction to the blockchain network

 

If you are not using cloud KMS, or if there are no keys in cloud KMS

  1. Prepare the cloud KMS service account
  2. Create wallet key: Generated it by the wallet key creation API
    1. Prepare cloud credentials
    2. Prepare Blockchain API authentication key
    3. Register cloud service account information (Credentials) at Hive Console > Blockchain > KMS Credentials > Add Credentials and obtain x-credential-id
    4. Use x-credential-id and the API authentication key to create KMS wallet key
    5. Acquire wallet key and wallet address
  3. Query KMS wallet information
  4. Create transactions with KMS wallet: Call APIs for generating new transactions such as sending tokens and deploying smart contracts
  5. Sign the created transaction with KMS Sign API
  6. Send the signed transaction to the blockchain network

 

 

Pre-requisites

Register your Cloud KMS Credentials in Hive Console > Blockchain > KMS Credentials > Add Credentials.

Creating Blockchain Account Wallet Address and KMS Wallet Key

Creates a wallet key in KMS using your cloud service account, and based on this wallet key, creates a blockchain account wallet address. The wallet key is stored in KMS and cannot be verified. If there is a delay during key creation process, the wallet address might not be included in the API response. You can retrieve the wallet address using the KMS Wallet Information Inquiry API with the key ID (keyId).

Request URL

Live URL https://bc-api.qpyou.cn/core/v1/kms
Sandbox URL https://sandbox-bc-api.qpyou.cn/core/v1/kms
HTTP Method POST
Content-Type application/json

Header Parameters

Field Name Description Type Required
x-network Blockchain network {ploygon, xpla} string Y
x-credential-id The unique value obtained when registering Credentials in the Hive console string Y
Authorization The authentication token required to call the API string Y

Request Body

Field Name Description Type Required
keyName Enter the desired name for the key to be created. string Y
keyOptions KMS wallet key option information json Y
keyOptions.location The location where the key will be stored. This refers to the KMS location information used by each cloud service. string
  • GCP: Y (location, example: asia-northeast3)
  • AWS: Y (region, example: ap-northeast-2d)
keyOptions.project GCP project ID string
  • GCP: Y
  • AWS: N
keyOptions.keyRing Information on GCP KeyRing string
  • GCP: Y
  • AWS: N

Responses

Field Name Description Type
code API call result code, 0: Success number
message Result message string
data API response data json
data.keyId The unique ID of the created key string
data.keyName The alias of the created key string
data.address Blockchain account wallet address created with the KMS key string
data.purpose Purpose of the key usage string
data.algorithm Type of key generation algorithm string
data.cloudType Type of cloud platform string
data.network Blockchain network the key will be used on string
data.options Key option information json
data.options.project GCP project ID string
data.options.location The location where the key is stored string
data.options.keyRing Information on GCP KeyRing string
data.options.keyVersion Information on GCP key version string
data.regId Key registrant ID string
data.modId Key modifier ID string
data.createdAt Key registration date string
data.updatedAt Key modification date string

Request Sample

Response Sample

Register Blockchain Account Wallet Address

Create a blockchain account wallet address based on the KMS wallet key and register it to the Hive server. When using GCP, you must specify the key version (keyVersion).

Request URL

Live URL https://bc-api.qpyou.cn/core/v1/kms/import
Sandbox URL https://sandbox-bc-api.qpyou.cn/core/v1/kms/import
HTTP Method POST
Content-Type application/json

Header Parameters

Field Name Description Type Required
x-network Blockchain network {ploygon, xpla} string Y
x-credential-id The unique value obtained when registering Credentials in the Hive console string Y
Authorization The authentication token required to call the API string Y

Request Body

Field Name Description Type Required
keys KMS wallet key information array(json) Y
keys.keyId The unique ID of the created key string Y
keys.keyVersion Key version information when using GCP string
  • GCP: Y
  • AWS: N
keyOptions Key option information json Y
keyOptions.location The location to store the key. This is the KMS location information used by each cloud. string
  • GCP: Y (location, example: asia-northeast3)
  • AWS: Y (region, example: ap-northeast-2d)
keyOptions.project GCP project ID string
  • GCP: Y
  • AWS: N
keyOptions.keyRing Information on GCP key ring string
  • GCP: Y
  • AWS: N
requesterId The requester ID. It is an arbitrary value to distinguish the API caller. The account ID logged into the Hive console is entered as requesterId when a KMS wallet is created. string N

Responses

Field Name Description Type
code API call result code, 0: Success number
message Result message string
data API response data json
data.keyId The unique ID of the created key string
data.keyName The alias of the created key string
data.address Blockchain account wallet address created with the KMS key string
data.purpose Purpose of using the key string
data.algorithm Type of key generation algorithm string
data.cloudType Type of cloud platform string
data.network Blockchain network the key will be used on string
data.options Key option information json
data.options.project GCP project ID string
data.options.location Location where the key is stored string
data.options.keyRing Information on GCP key ring string
data.options.keyVersion Information on GCP key version string
data.regId ID of the key registrant. It is the same as requesterId. string
data.modId ID of the key modifier string
data.createdAt Key registration date string
data.updatedAt Key modification date string

Request Sample

Response Sample

Retrieve KMS Key Wallet Information and Account Wallet Address

Retrieve KMS key wallet information and account wallet address using the unique ID (keyId) of the KMS wallet key or the key name (keyName). This can be used if you were unable to verify the wallet address when creating the key.

Request URL

Live URL https://bc-api.qpyou.cn/core/v1/kms/{key}
Sandbox URL https://sandbox-bc-api.qpyou.cn/core/v1/kms/{key}
HTTP Method GET
Content-Type application/json

Path Parameters

Field Name Description Type Required
key Unique ID of the key, or the key name string Y

Header Parameters

Field Name Description Type Required
x-credential-id The unique value obtained when registering Credentials in the Hive console string Y
Authorization The authentication token required to call the API string Y

Responses

Field Name Description Type
code API call result code, 0:success number
message Result message string
data API response data json
data.keyId Unique ID of the created key string
data.keyName Alias of the created key string
data.purpose Purpose of key usage string
data.algorithm Type of key generation algorithm string
data.cloudType Type of cloud platform string
data.network Blockchain network the key will be used on string
data.options Key option information json
data.options.project GCP project ID string
data.options.location Location where the key is stored string
data.options.keyRing GCP key ring information string
data.options.keyVersion GCP key version information string
data.regId Key registrant ID string
data.modId Key modifier ID string
data.createdAt Key registration date string
data.updatedAt Key modification date string

Request Sample

Response Sample

Retrieve KMS Key Wallet Information and Account Wallet Address List

Retrieve the list of KMS key wallet information and account wallet addresses.

Request URL

Live URL https://bc-api.qpyou.cn/core/v1/kms
Sandbox URL https://sandbox-bc-api.qpyou.cn/core/v1/kms
HTTP Method GET
Content-Type application/json

Header Parameters

Field Name Description Type Required
x-network Blockchain network {ploygon, xpla} string Y
x-credential-id The unique value obtained when registering Credentials in the Hive console string Y
Authorization The authentication token required to call the API string Y

Query Parameters

Field Name Description Type Required
page Current page number number N
limit Number of KMS key wallet information and account wallet addresses to display per page number N

Responses

Field Name Description Type
code API call result code, 0: success number
message Result message string
data API response data json
data.kms List of KMS wallet key information and wallet addresses array(json)
data.meta Pagination information json
data.meta.totalItems Total number of items queried (number of KMS wallet keys and wallet address information) number
data.meta.itemsPerPage Number of KMS wallet key and wallet address information displayed per page number
data.meta.totalPages Total number of pages number
data.meta.currentPage Current page number number

 

Information of each element contained in the data.kms array: KMS Wallet Key Information and Account Wallet Address

Field Name Description Type
keyId Unique ID of the created key string
keyName Alias of the created key string
address Blockchain account wallet address created with the KMS key string
purpose Purpose of using the key string
algorithm Type of key generation algorithm string
cloudType Type of cloud platform string
network Blockchain network where the key will be used string
options Key options information json
options.project GCP project ID string
options.location Location where the key is stored string
options.keyRing GCP keyring information string
options.keyVersion GCP key version information string
regId Key registrant ID string
modId Key modifier ID string
createdAt Key registration date string
updatedAt Key modification date string

Request Sample

Response Sample

Sign Transaction with KMS Wallet Key

Sign transactions with the KMS wallet key. Only transactions created with the KMS wallet account can be signed with the KMS wallet key.

Request URL

Live URL https://bc-api.qpyou.cn/core/v1/kms/sign
Sandbox URL https://sandbox-bc-api.qpyou.cn/core/v1/kms/sign
HTTP Method POST
Content-Type application/json

Header Parameters

Field Name Description Type Required
x-credential-id The unique value obtained when registering Credentials in the Hive console string Y
Authorization The authentication token required to call the API string Y

Request Body

Field Name Description Type Required
from The KMS wallet address from which the signature will be made. It must be identical to the from in the Request Body of the API (example) that creates the transaction. string Y
unsignedTx The unsigned transaction data. This is the data.rawTx you receive as a response when a transaction is created. The following types are supported for unsignedTx:

  1. Transaction data
  2. Multi-signature transaction data (when x-network is polygon)
string Y

Responses

Field Name Description Type
code API call result code, 0: success number
message Result message string
data API response data json
data.signedTx The information of signed transaction string

Request Sample

Response Sample