Embedded Wallets
How to
Wallet Operation
Sign Transaction

Sign Transaction

API Documentation: Sign Transaction

Overview

This API endpoint allows users to sign raw transaction using their MPC wallet.

  • HTTP Method: POST
  • Endpoint: /api/<VERSION>/wallet/sign-transaction

Request Body Parameters

  • transaction(required): Raw transaction data user want to sign.
  • network (required if chainId empty): The network used for transactions. You can see Networks Reference to get the network code.
  • chainId (required if network empty): The chain ID of the network used for transactions.
  • nonce (optional): The number used once to prevent duplicate transactions (this will be calculated automatically if not provided).
  • gasPrice (optional): Gas price in Wei (this will be calculated automatically if not provided).
  • gasLimit (optional): Gas limit for single transaction, transaction will be reverted if actual gas consumption is higher than gas limit (this will be calculated automatically if not provided).
  • maxFeePerGas (optional): Maximum fee per gas provided (this will be calculated automatically if not provided).
  • maxPriorityFeePerGas (optional): Maximum priority fee per gas you are willing to pay, this only used in EIP1559 support blockchain

Example Request Body

{
    "network": "ethereum",
    "chainId": "1",
    "transaction": {
        "from": "0x5B3A69CD0984c8621c75c54aa4dCA89e382523A9",
        "to": "0x5B3A69CD0984c8621c75c54aa4dCA89e382523A9",
        "data": "0x",
        "nonce": "0x00",
        "gasPrice": "0x1cb3fa334b",
        "gasLimit": "0x5208",
        "value": "0x00"
    }
}

Request

Request Headers

  • Authorization (required): JWT token which was generated when user login and do not have an MPC wallet.
  • x-client-secret (required): Client secret which was generated when register in Xellar Embedded Wallet API Service Dashboard.

Example Request Syntax

curl -X POST -H "Content-Type: application/json" -H "x-client-secret: $YOUR_CLIENT_SECRET" -H "Authorization: Bearer $YOUR_ACCESS_TOKEN" -d '{
	"transaction": {
		"from":"0x5B3A69CD0984c8621c75c54aa4dCA89e382523A9",
		"to":"0x5B3A69CD0984c8621c75c54aa4dCA89e382523A9",
		"data":"0x",
		"nonce":"0x00",
		"gasPrice":"0x1cb3fa334b",
		"gasLimit":"0x5208",
		"value":"0x00"
	}
}' <BASE_URL>/api/<VERSION>/wallet/sign-transaction

Response

The response will include a JSON object with the following properties:

  • status (number): The HTTP status code of the response (e.g., 200 for success).
  • message (string): A message providing additional information about the operation.
  • data (object): An object containing the signature of the transaction.

Example Response

{
    "status": 200,
    "message": "Sign Transaction is successfully",
    "data": {
        "signedTransaction": "0xf87184307830308c30783163623366613333346280945b3a69cd0984c8621c75c54aa4dca89e382523a98430783030801ca0bc01b69137a06e64c6f9a02e04b650d4a46cd98d04ae3fee0c1e3fe8d8186d58a02477caf3a20b4a44a16dc3c2c9b7a8edf78db712af0920d769a23d164c242c0f"
    }
}