Multi-sig API
With the multisignature (multi-sig) API, you can create a wallet that can create and send a transaction which requires signatures from multiple accounts, and you can convert a transaction into a multi-sig transaction by combining multiple signatures with it.
Create multi-sig wallet¶
Creates a wallet account that can send a transaction which requires multiple signatures to be sent to a blockchain.
Request URL¶
Live URL | https://bc-api.qpyou.cn/core/v1/multisig |
---|---|
Sandbox URL | https://sandbox-bc-api.qpyou.cn/core/v1/multisig |
HTTP Method | POST |
Content-Type | application/json |
Header parameters¶
Field Name | Description | Type | Required |
---|---|---|---|
x-network | the blockchain networks | string | Y |
Authorization | Authentication token required to call the API | string | Y |
Request body¶
Field Name | Description | Type | Required |
---|---|---|---|
from | This is the account address that will send the transaction of creating a multi-sig wallet. For the Polygon blockchain, from should sign the API response value data.rawTx to send this transaction to the Polygon blockchain. | string | Y |
signers | These are the wallet addresses that can sign a multi-sig transaction. For the XPLA, you need to provide active wallet addresses where you can get the public key for each wallet address. To make your wallet active, send any transaction from your wallet to the blockchain. | array | Y |
threshold | The number of signers required to send the transaction (quorum) | number | 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.address | the created multi-sig wallet address | string |
data.rawTx | This is the encoded transaction data of creating a multi-sig wallet. You only receives this data when you use the Polygon blockchain. | string |
Request Sample¶
curl -X 'POST'
'https://sandbox-bc-api.qpyou.cn/core/v1/multisig'
-H 'accept: */*'
-H 'x-network: polygon'
-H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJp...'
-d '{
"signers": [
"0xD6e69da7f1be111394dfef4C48eaC9b52ddf2Fd0",
"0xA10078576Ca6f63dc6f78ff9a8ed8bd05B51f463",
"0xa245824a24daf3b312d3f59c7debf162c4993e8b"
],
"threshold": 2,
"from": "0x5B38Da6a701c568545dCfcB03FcB875f56beddC4"
}'
Response Sample¶
// Polygon
{
"code": 0,
"message": "success",
"data": {
"address": "0x777358b228a4720ffa088516294b324f8d24639c",
"rawTx": "02f8748301388182010584c6ee355e84c6ee357682cdc49494853bdc9c6add50d7842..."
}
}
// XPLA
{
"code": 0,
"message": "success",
"data": {
"address": "xpla1qv6s9q8cpwjdwhxkcrrh447keslzu5t605w4gt"
}
}
Create Multi-sig Transaction¶
Converts a transaction into a multi-sig transaction by adding signatures to it. Refer to the steps below for creating a multi-sig transaction.
- Create a multi-sig wallet.
- Create a transaction that will be sent to a blockchain (Example: Send Token)
- The signers sign the created transaction data (
data.rawTx
ordata.hashedTx
) and each receives the "signature" string.- If the threshold value is 3, then there needs 3 "signature" strings.
- Each signer sends "signature" string to the person who will creates a multi-sig transaction.
- With the "signature" strings and the transaction data created at the step 2, the creator of a multi-sig transaction call this API with to create a multi-sig transaction (the transaction that will be recorded on the blockchain finally).
The creator of the multi-sig transaction above can sign the created transaction and send it to a blockchain. Note that for the XPLA blockchain, the creator should send the multi-sig transaction to the XPLA blockchain without signing it.
Warning
The signing on a transaction must be done by the gamer in his/her private wallet or must be served by the game studio.
- How to create multisignatures in Polygon
- How to create multisignatures in XPLA (Chrome Browser Extension Wallet > Manage Wallet > Sign a multisig tx)
Request URL¶
Live URL | https://bc-api.qpyou.cn/core/v1/multisig/tx |
---|---|
Sandbox URL | https://sandbox-bc-api.qpyou.cn/core/v1/multisig/tx |
HTTP Method | POST |
Content-Type | application/json |
Header parameters¶
Field Name | Description | Type | Required |
---|---|---|---|
x-network | the blockchain networks | string | Y |
Authorization | Authentication token required to call the API | string | Y |
Request body¶
Field Name | Description | Type | Required |
---|---|---|---|
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). | string | Y |
from | the wallet address that sends the multi-sig transaction to the blockchain | string | Y |
to | the multi-sig wallet address | string | Y |
tx | the data.rawTx which is returned as the response of the transaction creating APIs (Token API, NFT API, etc.) | string or json | Y |
signatures | the “signature” values (string) that each signer receives after they sign the transaction * polygon: the “signature” value that is obtained after signing data.hashedTx , which is returned as a response value of APIs that create transactions * XPLA: the “signature” value that is obtained after signing data.rawTx , which is returned as a response value of APIs that create transactions | array | 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 | This is the encoded transaction data of the created multi-sig transaction. For the Polygon blockchain, the creator of a multi-sig transaction can send the transaction to the blockchain after signing this value. | string |
data.reqeustId | the unique value that can identify each API request | string |
Request Sample¶
curl -X 'POST'
'https://sandbox-bc-api.qpyou.cn/core/v1/multisig/tx/0x777358b228a4720ffa088516294b324f8d24639c'
-H 'accept: application/json'
-H 'x-network: polygon'
-H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJp...'
-H 'Content-Type: application/json'
-d '{
"encoded": false,
"from": "0xD6e69da7f1be111394dfef4C48eaC9b52ddf2Fd0",
"to": "0x777358b228a4720ffa088516294b324f8d24639c",
"tx": "02f90113830138810c84a8d6983d84a8d6985483058bfe9431a6854383c81daab14089cba0b9de1d42ecd65f80",
"signatures": [
"0x53e8783e4da707daf58c96a8cea278e7b2a8a5f185af0913b518974556...",
"84655BB965D709A4AAD4104C7FFBD8E42F52F0BB313493FFDCA02B0..."
]
}'