Hive blockchain API เป็นเกมเว็บ 3.0 API ที่ขับเคลื่อนโดย Hive, โดยใช้มัน AppID และ PlayerID. ผู้เล่นเกมสามารถสร้างโทเค็นได้จำนวนมากในคราวเดียว มากถึง 200 โทเค็น และสตูดิโอเกมสามารถรับบันทึกธุรกรรมต่อผู้ใช้หนึ่งคน มีคุณสมบัติอื่น ๆ อีกมากมายที่เหมาะสมที่สุดสำหรับเกมบนเว็บ 3 กับ Hive blockchain APIคุณสามารถตั้งค่าการพัฒนา การดำเนินการ และการจัดการโปรเจ็กต์เกมบนเว็บ 3 ได้อย่างมีประสิทธิภาพ ที่ Hive blockchain API สนับสนุน Polygon และ XPLA blockchains.

Pre-requisites: Get API Authentication Token

หากต้องการโทรหาก Hive blockchain APIคุณต้องผนวก a auth โทเค็นที่ส่วนหัวของ API. นี่คือวิธีการรับของคุณ API auth เหรียญ

  1. ลงทะเบียนได้ที่ Hive คอนโซล go to AppCenter > Game List > ลงทะเบียนเกมใหม่
  2. สร้างใหม่ AppID at AppCenter > AppID List > ลงทะเบียนใหม่ AppID.
    • ลงทะเบียนใหม่ AppID: เข้าสู่ระบบเว็บไซต์ AppID
    • วัตถุประสงค์การใช้งาน: บล็อคเชน
    • AppID วิธีใช้: เลือก “สร้างโดยอัตโนมัติ AppID” หรือ “สร้างขึ้นโดยอัตโนมัติ AppID” ด้วย “ข้อมูลเพิ่มเติม”
  3. ไปที่ the Hive Console > Blockchain > ค้นหา API รหัสยืนยันตัวตน เลือกและค้นหาชื่อเกม และรับ ID และรหัสลับ
  4. แทรก ID และรหัสลับในเนื้อหาคำร้องของ auth-token API และเรียกสิ่งนี้ว่า API.
  5. คุณสามารถรับไฟล์ API auth ที่สำคัญเป็น data.accessToken ใน API การตอบสนอง

NFT API

Mint NFT

สร้างธุรกรรมที่โทเค็นโทเค็นไปยังที่อยู่เฉพาะ (to). โหลดที่จำเป็น NFT ข้อมูล (mintMsg.tokenId, mintMsg.metadataฯลฯ) ลงในอาร์เรย์แล้วเรียกสิ่งนี้ API- คุณสามารถสร้างโทเค็นได้สูงสุด 200/50 รายการต่อ 1 บัญชี XPLA/Polygon ต่อ API โทร. from ต้องเป็นบัญชีที่มีสิทธิ์ทำเหรียญกษาปณ์

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

เข้ามา NFT ข้อมูล

เข้ามา NFT ข้อมูลผ่านโทเค็น 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

การล็อค NFT หมายถึงการห้ามมิ้นต์ NFT ที่จะซื้อขาย เมื่อนักเล่นเกมทำเหรียญกษาปณ์ NFT จากไอเทมในเกมและต้องการให้ไอเทมชิ้นนี้กลับมาใช้ในเกมอีกครั้งที่มิ้นต์ NFT ถูกล็อคและไม่สามารถทำการซื้อขายได้ สร้างธุรกรรมการล็อคเพื่อล็อคลง NFT (tokenId). เจ้าของ (owner) ของ an NFT จะใช้สิ่งนี้ไม่ได้ 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

ตัวอย่างการตอบกลับ

Unlock NFT

สร้างธุรกรรมการปลดล็อคเพื่อปล่อย NFT (tokenId) จากการถูกล็อค เจ้าของ (owner) ของ an NFT จะสามารถใช้สิ่งนี้ได้ NFT อีกครั้ง

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

แลกเปลี่ยนสกุลเงินเกมและเกม Token

แลกเปลี่ยนโทเค็นเกมเป็นสกุลเงินของเกมหรือในทางกลับกัน

  • to-token: แลกเปลี่ยนสกุลเงินเกม (gameCurrencyCode) สำหรับโทเค็นเกม (gameToken).
  • to-currency: แลกเปลี่ยนโทเค็นเกม (gameToken) สำหรับสกุลเงินของเกม (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 พูลเป็นสถานที่ที่โทเค็นเกมที่สร้างโดยสตูดิโอเกมและสกุลเงินของเกมสามารถแลกเปลี่ยนระหว่างกันได้ นี้ API ทำให้คุณได้รับโทเค็นและสกุลเงินเกมที่เหลืออยู่ใน convert สระ

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

สมัครสมาชิก Txhash

สมัครสมาชิก requestId ที่ถูกส่งคืนใน API การตอบสนองหลังจากที่คุณสร้างธุรกรรม (mint, convert, ล็อค APIฯลฯ) และลงทะเบียน txHash ซึ่งจะได้รับหลังจากส่งธุรกรรมนี้ไปที่ blockchain. จุดประสงค์ของการเรียกสิ่งนี้ API กำลังติดตามคำขอสร้างธุรกรรมและสถานะ

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

เข้ามา Transaction รายการ

API ทำให้คุณได้รับรายการธุรกรรมที่ร้องขอให้ส่งไปยัง blockchain. หากธุรกรรมที่ร้องขอถูกส่งและบันทึกในก blockchainสถานะของมัน (transactions.txStatus) ได้รับการอัปเดตเป็น "ความสำเร็จ"

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

เข้ามา Token ยอดคงเหลือ

API ทำให้คุณได้รับยอดโทเค็นปัจจุบันของที่อยู่บัญชีของเจ้าของโทเค็น (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

เข้ามา Contract ข้อมูล

API รับข้อมูลสัญญาที่จัดทำโดยที่อยู่บัญชี (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