Hive Blockchain API is the web 3.0 game API that is powered by Hive, using its AppID and PlayerID. The game player can mint many tokens at once, up to 200 tokens, and the game studio can get transaction log per user. There are many other features optimal for the web 3 games. With the Hive Blockchain API, you can efficiently set up the development, operation, and management of web 3 game projects. The Hive Blockchain API supports Polygon and XPLA blockchains.

Pre-requisites: Get API Authentication Token

To call a Hive Blockchain API, you have to append an auth token to the header of an API. This is how to get your API auth token.

  1. Sign up at the Hive Console, go to AppCenter > Game List > Register new game.
  2. Create an new AppID at AppCenter > AppID List > Register new AppID.
    • Register new AppID: Web Login AppID
    • Purpose of use: Blockchain
    • AppID to use: Choose “automatically generated AppID” or “automatically generated AppID” with “Additional Information”
  3. Go to the the Hive Console > Blockchain > Search for API Authentication Key, select and search the game name, and get the ID and the Secret key.
  4. Insert the ID and the Secret key in the request body of auth-token API and call this API.
  5. You can get your API auth key as data.accessToken in the API responses.

NFT API

Mint NFT

Create a transaction that mint tokens to a specific address (to). Load the required NFT information (mintMsg.tokenId, mintMsg.metadata, etc.) into an array and call this API. You can mint a maximum of 200/50 tokens to 1 account for XPLA/Polygon per API call. from must be the account that has a right to mint.

Request URL

Live URL https://bc-api.qpyou.cn/service/v1/nft/{contract}/mint
Sandbox URL https://sandbox-bc-api.qpyou.cn/service/v1/nft/{contract}/mint
HTTP Method POST
Content-Type application/json

Path Parameters

Field Name Description Type Required
contract the NFT contract address string Y

Header Parameters

Field Name Description Type Required
Authorization The authentication token required to call APIs string Y
x-network the blockchain networks {ploygon, xpla} string Y
x-appid This is the AppID of an app. Go to the Hive Console AppCenter > AppID lists to check an AppID. string Y

Request Body

Field Name Description Type Required
playerId the player id string Y
from the account address that mints NFTs string Y
to the wallet address that receives NFTs string Y
isSend If true, when there is a wallet key in KMS, it automatically signs the transaction with this key and sends it to the blockchain. You will receive txHash as a response. If false, you will receive data.rawTx as a response, which is the transaction data that requires manual signing by the user. boolean Y
mintMsg the required information array Y
mintMsg.tokenId This is the NFT ID. The NFT ID should be unique, and is defined by the NFT minter.

  • Polygon: Only strings and integers (0~2256-1) are allowed.
  • XPLA: Only strings are allowed.
string Y
mintMsg.royaltyPercentage This is the royalty percentage. It is the money given to the creator of an NFT or the claimant every time the NFT is sold or resold. The royalty rate is applied to the total amount of sale. This feature is supported for the NFT marketplaces that are willing to continuously fund artists and NFT creators. The marketplace checks the NFT royalty and pay it to the recipient. The royalty is not directly paid to the recipient when the NFT is sold (transferred). This feature is adopted for the OpenSea.

  • Polygon: Allowed to the 2 decimal places.
  • XPLA: Only an integer is allowed.
number Y
mintMsg.metadata the metadata

  • You need to check type and url (animationUrl, youtubeUrl, externalUrl) formats. If this data is incorrect, the API request may fail.
  • The metadata will be saved in the snake case to be used for OpenSea when it is saved in IPFS (example: animationUrlanimation_url)
json Y
mintMsg.metadata.name the NFT name string Y
mintMsg.metadata.description the NFT description string N
mintMsg.metadata.image This is the NFT image address. This is the public website address or the public IPFS address for uploading images to IPFS. string Y
mintMsg.metadata.animationUrl the address for the NFT animation string N
mintMsg.metadata.youtubeUrl the Youtube address string N
mintMsg.metadata.imageData the NFT image information string N
mintMsg.metadata.externalUrl the external url string N
mintMsg.metadata.backgroundColor the background color info of the token (OpenSea) string N
mintMsg.metadata.attributes These are the information of the metadata attributes. These contain the additional info that are not described in the metadata. json N
mintMsg.metadata.attributes.traitType The names of the items that constitute attributes string N
mintMsg.metadata.attributes.maxValue the maximum value of trait number N
mintMsg.metadata.attributes.value This is the trait value. It should be less than mintMsg.metadata.attributes.maxValue. If mintMsg.metadata.attributes.displayType is date, set this value following unix timestamp (seconds) format. string or number N
mintMsg.metadata.attributes.displayType This is the display type of the trait. The default value is string.

  • number: numeric type
  • boost_percentage: percentage (OpenSea Boosts)
  • boost_number: numeric (OpenSea Boosts)
  • date: date type (example: Tuesday, January 1st, 2019)
string N
encoded whether the returned transaction is encoded or not

  • true: Receive the encoded raw transaction string (data.rawTx).
  • false: Receive the decoded data.rawTx (JSON).
boolean Y
callbackUrl the address to which the result of sending transaction is returned string Y

Responses

Field Name Description Type
code api request result code, 0: success number
message the result message String
data API response data json
data.rawTx Transaction data. You receive this value only when isSend is false. string or json
data.hashedTx Hashed data.rawTx. You receive this value only when all the following conditions are met:

  1. x-network is polygon
  2. from is a multi-signature wallet address
  3. isSend is false
string
data.txhash Transaction hash received as a result of sending the transaction. You receive this value only when isSend is true. string
data.status Status of the sent transaction. If isSend is true and the transaction has been sent successfully, you will receive PENDING. If isSend is false, it means the transaction requires signing before sending, and you will receive WAITING. string
data.reqeustId the unique value that can identify each API request string

Request Sample

Response Sample

Get NFT Information

Get NFT information via the token ID (tokenId).

Request URL

Live URL https://bc-api.qpyou.cn/service/v1/nft/{contract}/tokens/{tokenId}
Sandbox URL https://sandbox-bc-api.qpyou.cn/service/v1/nft/{contract}/tokens/{tokenId}
HTTP Method POST
Content-Type application/json

Path Parameters

Field Name Description Type Required
contract the NFT contract address string Y
tokenId the token ID string Y

Header Parameters

Field Name Description Type Required
Authorization The authentication token required to call APIs string Y
x-network the blockchain networks {ploygon, xpla} string Y
x-appid This is the AppID of an app. Go to the Hive Console AppCenter > AppID lists to check an AppID. string Y

Responses

Field Name Description Type
code api request result code, 0: success number
message the result message String
data API response data json
data.nftContract the NFT contract address string
data.tokenId the token ID string
data.tokenUri the IPFS address of the token string
data.gatewayUrl the gateway address of the token string
data.metadata the metadata information json
data.metadata.name the NFT name string
data.metadata.description the NFT description string
data.metadata.image This is the NFT image address. This is the public website address or the public IPFS address. string
data.metadata.animationUrl the address for the NFT animation string
data.metadata.youtubeUrl the Youtube address string
data.metadata.imageData the NFT image information string
data.metadata.externalUrl the external url string
data.metadata.backgroundColor the background color info of the token (OpenSea) string
data.metadata.attributes{} These are the information of the metadata attributes. These contain the additional info that are not described in the metadata. json
data.metadata.attributes.traitType The names of the items that constitute attributes string
data.metadata.attributes.maxValue the maximum value of trait string
data.metadata.attributes.value This is the trait value. It should be less than data.metadata.attributes.maxValue. If data.metadata.attributes.displayType is date, set this value following unix timestamp (seconds) format. string or number
data.metadata.attributes.displayType This is the display type of the trait. The default value is string.

  • number: numeric type
  • boost_percentage: percentage (OpenSea Boosts)
  • boost_number: numeric (OpenSea Boosts)
  • date: date type (example: Tuesday, January 1st, 2019)
string

Request Sample

Response Sample

Lock API

Lock NFT

Locking an NFT means forbidding a minted NFT to be traded. When a gamer minted an NFT from a game item and wants this item to use in the game again, the minted NFT is locked and become unavailable for trading. Creates a lock transaction to lock down the NFT (tokenId). The owner (owner) of an NFT won’t be able to use this NFT.

Request URL

Live URL https://bc-api.qpyou.cn/service/v1/nft/contract/{contract}/lock
Sandbox URL https://sandbox-bc-api.qpyou.cn/
service/v1/nft/contract/{contract}/lock
HTTP Method POST
Content-Type application/json

Path Parameters

Field Name Description Type Required
contract the NFT contract address string Y

Header Parameters

Field Name Description Type Required
Authorization The authentication token required to call APIs string Y
x-network the blockchain networks {ploygon, xpla} string Y
x-appid This is the AppID of an app. Go to the Hive Console AppCenter > AppID lists to check an AppID. string Y

Request Body

Field Name Description Type Required
playerId the player id string Y
from the wallet address of the NFT owner string Y
isSend If true, when there is a wallet key in KMS, it automatically signs the transaction with this key and sends it to the blockchain. You will receive txHash as a response. If false, you will receive data.rawTx as a response, which is the transaction data that requires manual signing by the user. boolean Y
lockContract the address of the NFT lock contract string Y
tokenId NFT ID String Y
encoded whether the returned transaction is encoded or not

  • true: Receive the encoded raw transaction string (data.rawTx).
  • false: Receive the decoded data.rawTx (JSON).
boolean Y
callbackUrl the address to which the result of sending transaction is returned string Y

Responses

Field Name Description Type
code api request result code, 0: success number
message the result message String
data API response data json
data.rawTx Transaction data. You receive this value only when isSend is false. string or json
data.hashedTx Hashed data.rawTx. You receive this value only when all the following conditions are met:

  1. x-network is polygon
  2. from is a multi-signature wallet address
  3. isSend is false
string
data.txhash Transaction hash received as a result of sending the transaction. You receive this value only when isSend is true. string
data.status Status of the sent transaction. If isSend is true and the transaction has been sent successfully, you will receive PENDING. If isSend is false, it means the transaction requires signing before sending, and you will receive WAITING. string
data.reqeustId the unique value that can identify each API request string

Request Sample

Response Sample

Unlock NFT

Creates a unlocking transaction to release the NFT (tokenId) from being locked. The owner (owner) of an NFT will be able to use this NFT again.

Request URL

Live URL https://bc-api.qpyou.cn/service/v1/lock/contract/{contract}/unlock
Sandbox URL https://sandbox-bc-api.qpyou.cn/service/v1/lock/contract/{contract}/unlock
HTTP Method POST
Content-Type application/json

Path Parameters

Field Name Description Type Required
contract the address of the NFT lock contract string Y

Header Parameters

Field Name Description Type Required
Authorization The authentication token required to call APIs string Y
x-network the blockchain networks {ploygon, xpla} string Y
x-appid This is the AppID of an app. Go to the Hive Console AppCenter > AppID lists to check an AppID. string Y

Request Body

Field Name Description Type Required
playerId the PlayerID string Y
nftContract the NFT contract address string Y
from the wallet address of the owner of the NFT lock contract string Y
isSend If true, when there is a wallet key in KMS, it automatically signs the transaction with this key and sends it to the blockchain. You will receive txHash as a response. If false, you will receive data.rawTx as a response, which is the transaction data that requires manual signing by the user. boolean Y
tokenId NFT ID String Y
encoded whether the returned transaction is encoded or not

  • true: Receive the encoded raw transaction string (data.rawTx).
  • false: Receive the decoded data.rawTx (JSON).
boolean Y
callbackUrl the address to which the result of sending transaction is returned string Y

Responses

Field Name Description Type
code api request result code, 0: success number
message the result message String
data API response data json
data.rawTx Transaction data. You receive this value only when isSend is false. string or json
data.hashedTx Hashed data.rawTx. You receive this value only when all the following conditions are met:

  1. x-network is polygon
  2. from is a multi-signature wallet address
  3. isSend is false
string
data.txhash Transaction hash received as a result of sending the transaction. You receive this value only when isSend is true. string
data.status Status of the sent transaction. If isSend is true and the transaction has been sent successfully, you will receive PENDING. If isSend is false, it means the transaction requires signing before sending, and you will receive WAITING. string
data.reqeustId the unique value that can identify each API request string

Request Sample

Response Sample

Convert API

Exchange Game Currency and Game Token

Exchange the game token for the game currency or the vice versa.

  • to-token: Exchange the game currency (gameCurrencyCode) for the game token (gameToken).
  • to-currency: Exchange the game token (gameToken) for the game currency (gameCurrencyCode).

Request URL

Live URL https://bc-api.qpyou.cn/service/v1/convert/{type}
Sandbox URL https://sandbox-bc-api.qpyou.cn/service/v1/convert/{type}
HTTP Method POST
Content-Type application/json

Path Parameters

Field Name Description Type Required
Type the convert type

  • to-token: Exchange the game currency (gameCurrencyCode) for the game token (gameToken).
  • to-currency: Exchange the game token (gameToken) for the game currency (gameCurrencyCode).
string Y

Header Parameters

Field Name Description Type Required
Authorization The authentication token required to call APIs string Y
x-network the blockchain networks {ploygon, xpla} string Y
x-appid This is the AppID of an app. Go to the Hive Console AppCenter > AppID lists to check an AppID. string Y

Request Body

Field Name Description Type Required
playerId the PlayerID string Y
isSend If true, when there is a wallet key in KMS, it automatically signs the transaction with this key and sends it to the blockchain. You will receive txHash as a response. If false, you will receive data.rawTx as a response, which is the transaction data that requires manual signing by the user. boolean Y
owner the wallet address of the user string Y
convertPool the address of the convert pool string Y
gameTokenAmount the amount of the game token string Y
gameCurrencyCode the code of the game currency string Y
gameCurrencyAmount the amount of the game currency string Y
encoded whether the returned transaction is encoded or not

  • true: Receive the encoded raw transaction string (data.rawTx).
  • false: Receive the decoded data.rawTx (JSON).
boolean Y
callbackUrl the address to which the result of sending transaction is returned string Y

Responses

Field Name Description Type
code api request result code, 0: success number
message the result message String
data API response data json
data.rawTx Transaction data. You receive this value only when isSend is false. string or json
data.hashedTx Hashed data.rawTx. You receive this value only when all the following conditions are met:

  1. x-network is polygon
  2. from is a multi-signature wallet address
  3. isSend is false
string
data.txhash Transaction hash received as a result of sending the transaction. You receive this value only when isSend is true. string
data.status Status of the sent transaction. If isSend is true and the transaction has been sent successfully, you will receive PENDING. If isSend is false, it means the transaction requires signing before sending, and you will receive WAITING. string
data.reqeustId the unique value that can identify each API request string

Request Sample

Response Sample

Get Convert Pool Information

A convert pool is a place where the game token minted by the game studio and the game currency can be exchanged with each other. This API gets you the remaining amount of tokens and game currency in a convert pool.

Request URL

Live URL https://bc-api.qpyou.cn/service/v1/convert/pool/{convertPool}
Sandbox URL https://sandbox-bc-api.qpyou.cn/service/v1/convert/pool/{convertPool}
HTTP Method GET
Content-Type application/json

Path Parameters

Field Name Description Type Required
convertPool the address of the convert pool string Y

Header Parameters

Field Name Description Type Required
Authorization The authentication token required to call APIs string Y
x-network the blockchain networks {ploygon, xpla} string Y
x-appid This is the AppID of an app. Go to the Hive Console AppCenter > AppID lists to check an AppID. string Y

Responses

Field Name Description Type
code api request result code, 0: success number
message the result message String
data API response data json

Request Sample

Response Sample

Transaction API

Register Txhash

Register requestId that is returned in the API response after you created a transaction (mint, convert, lock API, etc.), and register txHash which is received after sending this transaction to a blockchain. The purpose of calling this API is tracking the request for creating a transaction and its status.

Request URL

Live URL https://bc-api.qpyou.cn/service/v1/tx/hash
Sandbox URL https://sandbox-bc-api.qpyou.cn/service/v1/tx/hash
HTTP Method PATCH
Content-Type application/json

Header Parameters

Field Name Description Type Required
Authorization The authentication token required to call APIs string Y
x-network the blockchain networks {ploygon, xpla} string Y
x-appid This is the AppID of an app. Go to the Hive Console AppCenter > AppID lists to check an AppID. string Y

Request Body

Field Name Description Type Required
requestId the unique value that can identify each API request string Y
txHash the transaction hash string Y

Responses

Field Name Description Type
code api request result code, 0: success number
message the result message String
data API response data json

Request Sample

Response Sample

Get Transaction List

This API gets you the list of transactions requested to be sent to a blockchain. If the requested transactions are successfully sent and recorded in a blockchain, its status (transactions.txStatus) is updated to “success.”

Request URL

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

Header Parameters

Field Name Description Type Required
Authorization The authentication token required to call APIs string Y
x-network the blockchain networks {ploygon, xpla} string Y
x-appid This is the AppID of an app. Go to the Hive Console AppCenter > AppID lists to check an AppID. string Y

Query Parameters

Field Name Description Type Required
playerId the PlayerID string N
startDate the start date of the search range for the transaction creation date (yyyy-mm-dd) string N
endDate the end date of the search range for the transaction creation date (yyyy-mm-dd) string N
page the current page no. number N
limit the number of transactions that will be displayed on a page. number N

Responses

Field Name Description Type
code api request result code, 0: success number
message the result message String
data API response data json
transactions the transaction information array
transactions.appid the unique code (AppID) for identification of an app registered at the AppCenter string
transactions.playerId the PlayerID number
transactions.address the wallet address of an account that created the transaction string
transactions.contract the contract address of the requested transaction string
transactions.requestId the unique value that can identify each API request string
transactions.requestParams the request parameters of the API json
transactions.txType the transaction type string
transactions.txStatus the transaction status string
transactions.txHash the transaction hash string
transactions.createdAt the date the transaction was created string
transactions.updatedAt the date the transaction was updated string
meta the pagination information json
meta.totalItems the total number number
meta.itemCount the number of exposures number
meta.itemsPerPage the number of exposures per page number
meta.totalPages the total number of pages number
meta.currentPage the current page no. number

Request Sample

Response Sample

Token API

Get Token Balance

This API gets you the current token balance of the token owner account address (from).

Request URL

Live URL https://bc-api.qpyou.cn/service/v1/ft/{contract}/account/{from}/balance
Sandbox URL https://sandbox-bc-api.qpyou.cn/service/v1/ft/{contract}/account/{from}/balance
HTTP Method GET
Content-Type application/json

Path Parameters

Field Name Description Type Required
contract the address of the token contract string Y
from the token owner address string Y

Header Parameters

Field Name Description Type Required
Authorization The authentication token required to call APIs string Y
x-network the blockchain networks {ploygon, xpla} string Y
x-appid This is the AppID of an app. Go to the Hive Console AppCenter > AppID lists to check an AppID. string Y

Responses

Field Name Description Type
code api request result code, 0: success number
message the result message String
data API response data json
data.value the token balance string
data.rawValue the token balance not applying data.decimals string
data.decimals the maximum decimal places of the token number
data.symbol the symbol of the token string
data.symbolUri the token symbol image URI string

Request Sample

Response Sample

Contract API

Get Contract Information

This API gets you the information of the contract that was deployed by an account address (owner).

Request URL

Live URL https://bc-api.qpyou.cn/service/v1/contract/owner/{owner}
Sandbox URL https://sandbox-bc-api.qpyou.cn/service/v1/contract/owner/{owner}
HTTP Method GET
Content-Type application/json

Path Parameters

Field Name Description Type Required
owner the account address that deployed the contract string Y

Header Parameters

Field Name Description Type Required
Authorization The authentication token required to call APIs string Y
x-network the blockchain networks {ploygon, xpla} string Y
x-appid This is the AppID of an app. Go to the Hive Console AppCenter > AppID lists to check an AppID. string Y

Query Parameters

Field Name Description Type Required
contractType the contract type string N
page the current page no. number N
limit the number of contracts that will be displayed on a page. number N

Responses

Field Name Description Type
code api request result code, 0: success number
message the result message String
data API response data json
data.contracts the contract information array
data.contracts.network the chain information string
data.contracts.owner the account address that deployed the contract string
data.contracts.address the contract address string
data.contracts.type the contract type string
data.contracts.name the contract name string
data.contracts.gameIndex the game index number
data.contracts.gameName the game name string
data.contracts.symbol the contract symbol image URI string
data.contracts.symbolUri the contract symbol image URI string
data.contracts.createdAt the date the contract was recorded string
meta the pagination information json
meta.totalItems the total number number
meta.itemCount the number of exposures number
meta.itemsPerPage the number of exposures per page number
meta.totalPages the total number of pages number
meta.currentPage the current page no. number

Request Sample

Response Sample