Jump to
Ctrl
+
/

Prepare Kaspa Transaction

POST
/prepare-transactions/kaspa/{network}/native-coins

Prepare a native KAS transfer on Kaspa (mainnet). Selects spendable UTXOs covering the amount plus a mass-based fee and returns the unsigned transaction - inputs (each with its full utxoEntry), outputs, change, and the fee - ready for signing.

Query Parameters

context string Optional

In batch situations the user can use the context to correlate responses with requests. This property is present regardless of whether the response was successful or returned as an error. context is specified by the user.

Request Body Schema application/json

context string Optional

In batch situations the user can use the context to correlate responses with requests. This property is present regardless of whether the response was successful or returned as an error. context is specified by the user.

data object Required
item object Required
fromAddress string Required

Sender's Kaspa address. Its spendable UTXOs fund the transaction.

recipients array Items (object) Required

The transaction recipients. One output is created per entry (multiple recipients in one transaction are supported).

address string Required

Recipient's Kaspa address.

amount string Required

Amount to send to this recipient in KAS main units.

feeOptions object Optional

Fee configuration.

priority string Optional

Fee priority - slow, standard or fast.

exactAmount string Optional

Optional exact fee override in KAS. When set, the mass-based fee is bypassed.

prepareStrategy string Optional

Represents the UTXO-selection strategy.

locktime integer Optional

Optional transaction lock time.

Response Schema

apiVersion string Required

Specifies the version of the API that incorporates this endpoint.

2024-12-12
requestId string Required

Defines the ID of the request. The requestId is generated by Crypto APIs and it's unique for every request.

601c1710034ed6d407996b30
context string Optional

In batch situations the user can use the context to correlate responses with requests. This property is present regardless of whether the response was successful or returned as an error. context is specified by the user.

yourExampleString
data object Required
item object Required
inputs array Items (object) Required

The selected spendable UTXOs consumed as inputs.

address string Required

The address owning this input.

kaspa:qqszjeudt3cs42zakd7ch8z5h8peu2qjj0kvsa3n3tq2lg3hca56v8xrmm86p
transactionId string Required

The transaction id of the spent output.

7a700499c9bd00cf123648b3bf85347198e6cab4304afb2ddcc52fdcc6932a61
outputIndex integer Required

The output index within that transaction.

0
sompi string Required

The input amount in sompi.

5154323
outputs array Items (object) Required

The transaction outputs (recipient, and change back to the sender when present).

address string Required

The output address.

kaspa:qrualxl99gnkdd7nyz9hcm88vv5t8xxvhf5jy8vqxnhk3jymem8dxl0yq3c9c
sompi string Required

The output amount in sompi.

1000000
fee object Required

The mass-based fee, in KAS main units.

amount string Required

The fee amount.

0.00417034
unit string Required

The fee denomination.

KAS
feePerGram object Required

The fee rate used, in sompi per gram of transaction mass.

amount string Required

The fee rate.

218
unit string Required

The rate denomination.

sompi
mass string Required

The transaction mass (grams) the fee was derived from.

1913
version integer Required

Transaction version.

0
lockTime string Required

Transaction lock time.

0
subnetworkId string Required

Subnetwork id (all-zero for the native subnetwork).

0000000000000000000000000000000000000000

Credits Cost

Blockchain protocol Credits for 1 Results
Default Cost 60
Kaspa 60
Was this page helpful?
Yes
No
Powered by
Language
URL

{
    "apiVersion": "2024-12-12",
    "requestId": "601c1710034ed6d407996b30",
    "context": "yourExampleString",
    "data": {
        "item": {
            "inputs": [
                {
                    "address": "kaspa:qqszjeudt3cs42zakd7ch8z5h8peu2qjj0kvsa3n3tq2lg3hca56v8xrmm86p",
                    "transactionId": "7a700499c9bd00cf123648b3bf85347198e6cab4304afb2ddcc52fdcc6932a61",
                    "outputIndex": 0,
                    "sompi": "5154323"
                }
            ],
            "outputs": [
                {
                    "address": "kaspa:qrualxl99gnkdd7nyz9hcm88vv5t8xxvhf5jy8vqxnhk3jymem8dxl0yq3c9c",
                    "sompi": "1000000"
                }
            ],
            "fee": {
                "amount": "0.00417034",
                "unit": "KAS"
            },
            "feePerGram": {
                "amount": "218",
                "unit": "sompi"
            },
            "mass": "1913",
            "version": 0,
            "lockTime": "0",
            "subnetworkId": "0000000000000000000000000000000000000000"
        }
    }
}