Decode a transaction
Decode a raw transaction into the Tx shape without broadcasting it.
# Decode a transaction
`POST https://api.rarebl.com/open/tx/decode`
Decodes a raw transaction (signed or unsigned) into the v1 Tx shape, with status `unsent`, so you can check what you are about to send.
**Rate class:** compute (2 requests per second, burst 10, per IP). **Available since:** Open API v2.
## Request
Send a JSON body (`Content-Type: application/json`). No API key is needed: `X-API-KEY` is reserved and ignored.
Example: `curl -X POST "https://api.rarebl.com/open/tx/decode" -H "Content-Type: application/json" -d '{"chain":"dash","hex":"0200000001139f6185036ea872d9e52bd7424ba9165f31b6479556b021fe4b8f3f42e8087a010000006a473044022047ac8e878352d3ebbde1c94ce3a10d057c24175747116f8288e5d794d12d482f0220217f36a485cae903c713331d877c1f64677e3622ad4010726870540656fe9dcb012103ad1d8e89212f0b92c74d23bb710c00662ad1470198ac48c43f7d6f93a2a26873ffffffff0240420f00000000001976a91454072845a9ca039a5b585f5fd994d88d38feb31c88ac189f3419000000001976a9147fb0a45f00c25ff1cb67753221326c7c420b8b2388ac00000000"}'`
## Parameters
| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `chain` | string | Yes | The chain. One of: btc, ltc, bch, dash, eth, tron. |
| `hex` | string | No | The raw transaction hex. |
| `tx` | object | No | TRON only: the transaction JSON (use `tx` or `hex`). |
## Responses
### API200 (HTTP 200): OK
The decoded transaction, with `status: "unsent"`.
```json
{
"status": 1,
"code": "API200",
"message": "success",
"data": {
"tx": {
"chain": "dash",
"hash": "8235cfafa0ef70d4a5135331c6889a7c15780b7aeb3bc20721571c2a4b51ffa7",
"status": "unsent",
"block": null,
"blockHash": null,
"time": null,
"confirmations": 0,
"value": "4.23879",
"fee": "0.00000226",
"utxo": {
"size": 225,
"vsize": 225,
"weight": 900,
"locktime": 0,
"version": 2,
"rbf": false,
"coinbase": false,
"inputs": [
{
"txid": "7a08e8423f8f4bfe21b0569547b6315f16a94b42d72be5d972a86e0385619f13",
"vout": 1,
"address": "XnL1FvTKqe6aWfB8NrvgbUMuWCEA3dNxfF",
"value": "4.23879226",
"scriptType": "pubkeyhash",
"sequence": 4294967295,
"coinbase": false
}
],
"outputs": [
{
"n": 0,
"address": "XiM9Afap6UEb5LDkcWrg2YyA28hifkZZKM",
"value": "0.01",
"scriptType": "pubkeyhash",
"opReturn": null,
"spent": null
},
{
"n": 1,
"address": "XnL1FvTKqe6aWfB8NrvgbUMuWCEA3dNxfF",
"value": "4.22879",
"scriptType": "pubkeyhash",
"opReturn": null,
"spent": null
}
]
},
"details": [
{
"key": "status",
"label": "Status",
"value": "Unsent",
"kind": "text"
}
]
}
},
"go": null,
"meta": {
"requestid": "0123456789abcdef",
"notices": []
}
}
```
| Field | Type | Description |
| --- | --- | --- |
| `data.tx` | Tx | The v1 [Tx](https://docs.rarebl.com/data-types) shape. Prevout values are filled where the node knows them. |
### API400 (HTTP 400): Bad Request
A parameter is missing or malformed. `data.param` names it (here `hex`).
```json
{
"status": 0,
"code": "API400",
"message": "hex is required.",
"data": {
"param": "hex"
},
"go": null,
"meta": {
"requestid": "0123456789abcdef",
"notices": []
}
}
```
### API429 (HTTP 429): Too Many Requests
Rate limited (compute class: 2 requests per second, burst 10, per IP). A `Retry-After` header says how long to wait, in seconds.
```json
{
"status": 0,
"code": "API429",
"message": "Too many requests. Please retry shortly.",
"data": null,
"go": null,
"meta": {
"requestid": "0123456789abcdef",
"notices": []
}
}
```
### API502 (HTTP 502): Bad Gateway
The node is unavailable, still syncing or timed out. Retry later with a short back-off.
```json
{
"status": 0,
"code": "API502",
"message": "The node is unavailable or timed out. Please try again.",
"data": null,
"go": null,
"meta": {
"requestid": "0123456789abcdef",
"notices": []
}
}
```
## Notes
- The reply is the same `Tx` shape as [Transaction](https://docs.rarebl.com/api/tx/get), with `status: "unsent"`, no block and 0 confirmations.
- Use it to double-check outputs and fees before you broadcast.